Ignore:
Timestamp:
Apr 4, 2013, 10:54:25 PM (11 years ago)
Author:
sommeria
Message:

bugs corrected in series, ima_levels cleaned as exemple

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_input.m

    r603 r604  
    2525
    2626
    27 % Last Modified by GUIDE v2.5 04-Apr-2013 09:14:14
     27% Last Modified by GUIDE v2.5 04-Apr-2013 22:08:23
    2828% Begin initialization code - DO NOT EDIT
    2929gui_Singleton = 1;
     
    8282%% input file info
    8383RootPath=Param.InputTable{1,1};
     84set(handles.RootPath,'String',RootPath)
    8485RootFile=Param.InputTable{1,3};
    8586SubDir=Param.InputTable{1,2};
     
    116117        imageinput='';
    117118        Data=nc2struct(FileInput,'ListGlobalAttribute','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB');
     119        [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);
     120        [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);
     121        [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
     122        [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB);
     123        set(handles.Civ1_ImageA,'String',Civ1_ImageA)
     124        set(handles.Civ1_ImageB,'String',Civ1_ImageB)
     125        set(handles.Civ2_ImageA,'String',Civ2_ImageA)
     126        set(handles.Civ2_ImageB,'String',Civ2_ImageB)
    118127    if isfield(Data,'Txt')
    119128        errormsg=Data.Txt;
     
    121130        %TODO: introduce the image in the input table of series
    122131    end
    123         %         if  ~isempty(Data.Civ2_ImageB)%get the corresponding input image in the netcdf file
    124         %             imageinput=Data.Civ2_ImageB;
    125         %             [tild,ImaName,ImaExt]=fileparts(Data.Civ2_ImageA);
    126         %             set(handles.RootFile_1,'String',[ImaName ImaExt])
    127         %         elseif ~isempty(Data.Civ1_ImageB)
    128         %             imageinput=Data.Civ1_ImageB;
    129         %             [tild,ImaName,ImaExt]=fileparts(Data.Civ1_ImageA);
    130         %             set(handles.RootFile_1,'String',[ImaName ImaExt])
    131         %         end
    132         % settings for civx data,       
    133         % look for the corresponding input images
    134         check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$','once'));%detect pair label by letter
    135         NomTypeIma=NomTypeInput;
    136         if check_letter
    137             NomTypeIma=NomTypeInput(1:end-1);
    138         else
    139             r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names');
    140             if ~isempty(r)
    141                 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
    142             end
    143             r=regexp(NomTypeIma,'.-(?<num2>\d+)','names');
    144             if ~isempty(r)
    145                 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
    146             end
    147         end
    148 %         if ~exist(imageinput,'file')
    149 %             imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
    150 %         end
     132        [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA);
     133        [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB);
    151134    case 'civxdata'% case of  civx data,
    152135        NomTypeNc=NomTypeInput;
     
    407390
    408391%% determine nomenclature types and extension of the input files
    409 % [RootPath,SubDir,RootFile,i1,i2,j1,j2,ExtInput,NomTypeInput]=fileparts_uvmat(fileinput);
     392% [RootPath,SubDir,Civ2_ImageB,i1,i2,j1,j2,ExtInput,NomTypeInput]=fileparts_uvmat(fileinput);
    410393% NomTypeNc='';%default
    411394
     
    416399% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    417400% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    418 %[RootPath,ImageACiv1,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
     401%[RootPath,Civ1_ImageA,Civ2_ImageB,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
    419402switch Param.FileType{1}
    420403    case {'image','multimage','video','mmreader'}
     
    424407end
    425408set(handles.RootPath,'String',RootPath)
    426 set(handles.ImageACiv1,'String',SubDirImages)
    427 set(handles.RootFile,'String',RootFile)
     409set(handles.Civ1_ImageA,'String',SubDirImages)
     410set(handles.Civ2_ImageB,'String',RootFile)
    428411if strcmp(ExtInput,'.nc')
    429412    SubDirCiv=regexprep(SubDir,['^' SubDirImages],'');%suppress the root  SuddirImages;
     
    431414    SubDirCiv= '.civ';
    432415end
    433 set(handles.ImageBCiv1,'String',SubDirCiv)
    434 set(handles.ImageACiv2,'String',SubDirCiv)
     416set(handles.Civ1_ImageB,'String',SubDirCiv)
     417set(handles.Civ2_ImageA,'String',SubDirCiv)
    435418browse=get(handles.RootPath,'UserData');
    436419browse.incr_pair=[0 0];%default
     
    511494%------------------------------------------------------------------------
    512495% --- Executes on carriage return on the subdir checkciv1 edit window
    513 function ImageBCiv1_Callback(hObject, eventdata, handles)
    514 %------------------------------------------------------------------------
    515 SubDir=get(handles.ImageBCiv1,'String');
     496function Civ1_ImageB_Callback(hObject, eventdata, handles)
     497%------------------------------------------------------------------------
     498SubDir=get(handles.Civ1_ImageB,'String');
    516499menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
    517500ichoice=find(strcmp(SubDir,menu_str),1);
     
    523506set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
    524507if get(handles.CheckCiv1,'Value')% if Civ1 is performed
    525     set(handles.ImageACiv2,'String',SubDir);% set by default civ2 directory the same as civ1
     508    set(handles.Civ2_ImageA,'String',SubDir);% set by default civ2 directory the same as civ1
    526509%     set(handles.ListSubdirCiv2,'Value',ilist)
    527510else % if Civ1 data already exist
     
    534517%------------------------------------------------------------------------
    535518% --- Executes on carriage return on the SubDir checkciv1 edit window
    536 function ImageACiv2_Callback(hObject, eventdata, handles)
    537 %------------------------------------------------------------------------
    538 SubDir=get(handles.ImageBCiv1,'String');
     519function Civ2_ImageA_Callback(hObject, eventdata, handles)
     520%------------------------------------------------------------------------
     521SubDir=get(handles.Civ1_ImageB,'String');
    539522menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update
    540523ichoice=find(strcmp(SubDir,menu_str),1);
     
    609592% end
    610593set(handles.PairIndices,'Visible','on')
    611 set(handles.ImageBCiv1,'Visible','on')
     594set(handles.Civ1_ImageB,'Visible','on')
    612595set(handles.TitleSubdirCiv1,'Visible','on')
    613596if opening==0
     
    620603    set(handles.TitlePairCiv2,'Visible','on')
    621604    set(handles.TitleSubdirCiv2,'Visible','on')
    622     set(handles.ImageACiv2,'Visible','on')
     605    set(handles.Civ2_ImageA,'Visible','on')
    623606    %set(handles.ListSubdirCiv2,'Visible','on')
    624607    set(handles.ListPairCiv2,'Visible','on')
     
    631614else
    632615    set(handles.TitleSubdirCiv2,'Visible','off')
    633     set(handles.ImageACiv2,'Visible','off')
     616    set(handles.Civ2_ImageA,'Visible','off')
    634617    set(handles.ListPairCiv2,'Visible','off')
    635618end
     
    11301113
    11311114%% reads .nc subdirectoy and image numbers from the interface
    1132 SubDirImages=get(handles.ImageACiv1,'String');
    1133 subdir_civ1=[SubDirImages get(handles.ImageBCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
    1134 subdir_civ2=[SubDirImages get(handles.ImageACiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
     1115SubDirImages=get(handles.Civ1_ImageA,'String');
     1116subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data
     1117subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data
    11351118ref_i=str2double(get(handles.ref_i,'String'));
    11361119ref_j=[];
     
    11661149testpair=0;
    11671150RootPath=get(handles.RootPath,'String');
    1168 RootFile=get(handles.RootFile,'String');
     1151RootFile=get(handles.Civ2_ImageB,'String');
    11691152if index==1 % case civ1
    11701153    if ~get(handles.CheckCiv1,'Value') %
     
    15921575nbslice=1;
    15931576
    1594 % subdir=get(handles.ImageBCiv1,'String');
     1577% subdir=get(handles.Civ1_ImageB,'String');
    15951578[Path,Name]=fileparts(filebase);
    15961579if ~isdir(Path)
     
    16881671%     end   
    16891672% end
    1690 % set(handles.ImageBCiv1,'String',SubDir);
     1673% set(handles.Civ1_ImageB,'String',SubDir);
    16911674% errormsg=find_netcpair_civ(handles,1);
    16921675% if ~isempty(errormsg)
     
    17091692%     end
    17101693% end
    1711 % set(handles.ImageACiv2,'String',SubDir);
     1694% set(handles.Civ2_ImageA,'String',SubDir);
    17121695
    17131696%------------------------------------------------------------------------
     
    22022185
    22032186
    2204 function NcFileCiv2_Callback(hObject, eventdata, handles)
    2205 % hObject    handle to NcFileCiv2 (see GCBO)
    2206 % eventdata  reserved - to be defined in a future version of MATLAB
    2207 % handles    structure with handles and user data (see GUIDATA)
    2208 
    2209 % Hints: get(hObject,'String') returns contents of NcFileCiv2 as text
    2210 %        str2double(get(hObject,'String')) returns contents of NcFileCiv2 as a double
    2211 
    2212 
    2213 % --- Executes during object creation, after setting all properties.
    2214 function NcFileCiv2_CreateFcn(hObject, eventdata, handles)
    2215 % hObject    handle to NcFileCiv2 (see GCBO)
    2216 % eventdata  reserved - to be defined in a future version of MATLAB
    2217 % handles    empty - handles not created until after all CreateFcns called
    2218 
    2219 % Hint: edit controls usually have a white background on Windows.
    2220 %       See ISPC and COMPUTER.
    2221 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2222     set(hObject,'BackgroundColor','white');
    2223 end
    2224 
    2225 
    2226 
    2227 function ImageACiv1_Callback(hObject, eventdata, handles)
    2228 % hObject    handle to ImageACiv1 (see GCBO)
    2229 % eventdata  reserved - to be defined in a future version of MATLAB
    2230 % handles    structure with handles and user data (see GUIDATA)
    2231 
    2232 % Hints: get(hObject,'String') returns contents of ImageACiv1 as text
    2233 %        str2double(get(hObject,'String')) returns contents of ImageACiv1 as a double
Note: See TracChangeset for help on using the changeset viewer.