Ignore:
Timestamp:
Aug 29, 2018, 12:39:05 PM (6 years ago)
Author:
sommeria
Message:

reading color images repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_cells.m

    r1049 r1057  
    306306        CellInfo{icell}.DimOrder=[];
    307307        if NbDim(icell)==3
    308             %coord z
    309             for ivar=ind_coord_z
    310                 if check_coord_names(ivar)
    311                     DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
     308            if strcmp(DimCell_var{3},'rgb')
     309                NbDim(icell)=2;% case of color images
     310            else
     311                %coord z
     312                for ivar=ind_coord_z
     313                    if check_coord_names(ivar)
     314                        DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
     315                        check_coord=~isempty(DimRank);
     316                    elseif check_coord_raster(ivar)
     317                        DimRank=find(strcmp(Data.ListVarName{ivar},DimCell_var));
     318                        check_coord=~isempty(DimRank);
     319                    end
     320                    %                 check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{1}))||...% coord varbable
     321                    %                     (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{1})); % rasrewr coord defined by min and max
     322                    if check_coord
     323                        CellInfo{icell}.CoordType='grid';
     324                        CellInfo{icell}.CoordIndex(1)=ivar;
     325                        CellInfo{icell}.ZName=Data.ListVarName{ivar};
     326                        CellInfo{icell}.ZIndex=ivar;
     327                        CellInfo{icell}.DimOrder=DimRank;
     328                        break
     329                    end
     330                end
     331            end
     332        end
     333        for ivar=ind_coord_y
     334            if check_coord_names(ivar)
     335                DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
    312336                check_coord=~isempty(DimRank);
    313337            elseif check_coord_raster(ivar)
     
    315339                check_coord=~isempty(DimRank);
    316340            end
    317 %                 check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{1}))||...% coord varbable
    318 %                     (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{1})); % rasrewr coord defined by min and max
    319                 if check_coord
    320                     CellInfo{icell}.CoordType='grid';
    321                     CellInfo{icell}.CoordIndex(1)=ivar;
    322                     CellInfo{icell}.ZName=Data.ListVarName{ivar};
    323                     CellInfo{icell}.ZIndex=ivar;
    324                     CellInfo{icell}.DimOrder=DimRank;
    325                     break
    326                 end
    327             end
    328         end
    329         for ivar=ind_coord_y
    330             if check_coord_names(ivar)
    331                     DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
    332                 check_coord=~isempty(DimRank);
    333             elseif check_coord_raster(ivar)
    334                 DimRank=find(strcmp(Data.ListVarName{ivar},DimCell_var));
    335                 check_coord=~isempty(DimRank);
    336             end
    337 %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)-1}))||...% coord variable
    338 %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)-1})); % rasrewr coord defined by min and max
     341            %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)-1}))||...% coord variable
     342            %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)-1})); % rasrewr coord defined by min and max
    339343            if check_coord
    340344                CellInfo{icell}.CoordType='grid';
     
    348352        for ivar=ind_coord_x
    349353            if check_coord_names(ivar)
    350                     DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
     354                DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
    351355                check_coord=~isempty(DimRank);
    352356            elseif check_coord_raster(ivar)
     
    354358                check_coord=~isempty(DimRank);
    355359            end
    356 %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)}))||...% coord variable
    357 %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)})); % raster coord defined by min and max
     360            %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)}))||...% coord variable
     361            %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)})); % raster coord defined by min and max
    358362            if check_coord
    359363                CellInfo{icell}.CoordIndex(NbDim(icell))=ivar;
     
    400404                    CellInfo{icell}.CoordSize=[size(Data.(VarName),3) size(Data.(VarName),2) size(Data.(VarName),1)];
    401405                else
    402                     CellInfo{icell}.CoordSize=[size(Data.(VarName),2) size(Data.(VarName),1)];
     406                    CellInfo{icell}.CoordSize=[size(Data.(VarName),1) size(Data.(VarName),2)];
    403407                end
    404408            case 'tps'
Note: See TracChangeset for help on using the changeset viewer.