Ignore:
Timestamp:
Apr 30, 2018, 8:01:35 PM (6 years ago)
Author:
sommeria
Message:

miscellaneous updates

File:
1 edited

Legend:

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

    r1027 r1033  
    8080    set(handles.num_CorrSmooth,'String',{'1';'2'})
    8181    set(handles.CheckThreshold,'Visible','on')
    82     set(handles.CheckDeformation,'Value',0)% desactivate (work in progress)
     82    set(handles.CheckDeformation,'Value',0)% desactivate
    8383end
    8484switch Param.Action.ActionName
     
    9595FileType='image';%fdefault
    9696FileInfo=[];
    97 if isfield(SeriesData,'FileType')&&isfield(SeriesData,'FileInfo')...
    98         &&numel(SeriesData.FileType)>=1&&numel(SeriesData.FileInfo)>=1
    99     FileType=SeriesData.FileType{1};%type of the first input file series
    100     FileInfo=SeriesData.FileInfo{1};% info on the first input file series
     97if isfield(SeriesData,'FileInfo')...
     98    FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series
     99    FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series
    101100else
    102101    set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed
     
    109108iview_image=1;%line # for the input images
    110109switch FileType
    111     case {'image','image_DaVis','multimage','video','mmreader','cine_phantom','netcdf'}
    112 %         NomTypeImaA=NomTypeInput;
    113 %         iview_image=1;%line # for the input images
    114110    case 'civdata'
    115111        if ~strcmp(Param.Action.ActionName,'civ_series')
     
    154150        return
    155151    otherwise
     152        if ~strcmp(FieldType,'image')
    156153        msgbox_uvmat('ERROR','civ_series needs images, scalar fields in netcdf format, or civ data as input')
    157154        return
     155        end
    158156end
    159157
     
    308306    end
    309307    if isfield(Param.ActionInput,'Civ2')
    310        CheckDeformation_Callback(hObject, eventdata, handles)
    311     end
    312 end
    313        if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ListCompareMode')&&...
    314                strcmp(Param.ActionInput.ListCompareMode,'displacement')
    315             set(handles.PairIndices,'Visible','off')
    316         end
     308        CheckDeformation_Callback(hObject, eventdata, handles)
     309    end
     310end
     311if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ListCompareMode')&&...
     312        strcmp(Param.ActionInput.ListCompareMode,'displacement')
     313    set(handles.PairIndices,'Visible','off')
     314        set(handles.CheckRefFile,'Visible','on')
     315else
     316    set(handles.CheckRefFile,'Visible','off')
     317end
    317318
    318319%% set the menu and default choice of civ pairs
     
    370371%% list the possible index pairs, depending on the option set in ListPairMode
    371372ListPairMode_Callback([], [], handles)
    372 %ListPairCiv1_Callback(hObject, eventdata, handles)
    373373
    374374%% set the GUI to modal: wait for OK to close
     
    714714    mode_selected=mode_list{mode_value};
    715715end
    716 % displ_num=[];%default
    717716ref_i=str2double(get(handles.ref_i,'String'));
    718 % last_i=str2num(get(handles.last_i,'String'));
    719717CivInputData=get(handles.civ_input,'UserData');
    720718TimeUnit=get(handles.TimeUnit,'String');
     
    725723nbfield2=siztime(2)-1;
    726724%indchosen=1;  %%first pair selected by default
    727 %displ_num used to define the indices of the civ_input pairs
    728725% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
    729726% are relative to the reference indices ref_i and ref_j respectively.
    730727if isequal(mode_selected,'pair j1-j2')
    731728    dt=1;
    732     displ='';
    733729    index=0;
    734730    numlist_a=[];
     
    751747    end
    752748    [dtsort,indsort]=sort(displ_dt);
    753     if ~isempty(numlist_a)
    754         displ_num(1,:)=numlist_a(indsort);
    755         displ_num(2,:)=numlist_b(indsort);
    756     end
    757     displ_num(3,:)=0;
    758     displ_num(4,:)=0;
    759749    enable_j(handles, 'off')
    760750elseif isequal(mode_selected,'series(Dj)') %| isequal(mode,'st_series(Dj)')
    761     index=1:200;
    762     displ_num(1,index)=-floor(index/2);
    763     displ_num(2,index)=ceil(index/2);
    764     displ_num(3:4,index)=zeros(2,200);
    765751    enable_j(handles, 'on')
    766752elseif isequal(mode_selected,'series(Di)') %| isequal(mode,'st_series(Di)')
    767 %     index=1:200;
    768 %     displ_num(1:2,index)=zeros(2,200);
    769 %     displ_num(3,index)=-floor(index/2);
    770 %     displ_num(4,index)=ceil(index/2);
    771753    enable_i(handles, 'on')
    772754    if nbfield2 > 1
     
    776758    end
    777759elseif isequal(mode_selected,'displacement')%the pairs have the same indices
    778     displ_num(1,1)=0;
    779     displ_num(2,1)=0;
    780     displ_num(3,1)=0;
    781     displ_num(4,1)=0;
    782760    if nbfield > 1 || nbfield==0
    783761        enable_i(handles, 'on')
     
    791769    end
    792770end
    793 %set(handles.ListPairCiv1,'UserData',displ_num);
    794771errormsg=find_netcpair_civ( handles,1);
    795     if ~isempty(errormsg)
     772if ~isempty(errormsg)
    796773    msgbox_uvmat('ERROR',errormsg)
    797     end
    798 % find_netcpair_civ2(handles)
    799 
     774end
     775
     776%------------------------------------------------------------------------
    800777function enable_i(handles, state)
    801778set(handles.itext,'Visible',state)
    802 % set(handles.MinIndex_i,'Visible',state)
    803 % set(handles.last_i,'Visible',state)
    804 % set(handles.incr_i,'Visible',state)
    805779set(handles.MaxIndex_i,'Visible',state)
    806780set(handles.ref_i,'Visible',state)
    807781
     782%------------------------------------------------------------------------
    808783function enable_j(handles, state)
    809784set(handles.jtext,'Visible',state)
    810 % set(handles.MinIndex_j,'Visible',state)
    811 % set(handles.last_j,'Visible',state)
    812 % set(handles.incr_j,'Visible',state)
    813785set(handles.MinIndex_j,'Visible',state)
    814786set(handles.MaxIndex_j,'Visible',state)
    815787set(handles.ref_j,'Visible',state)
    816 %hseries=findobj(allchild(0),'Tag','series');
    817 %hhseries=guidata(hseries);
    818 %series('enable_j',hhseries,state); %file input with xml reading  in uvmat, show the image in phys coordinates
    819 
    820 
    821788
    822789%------------------------------------------------------------------------
     
    874841errormsg='';
    875842CivInputData=get(handles.civ_input,'UserData');
    876 %browse=get(handles.RootPath,'UserData');
    877843compare_list=get(handles.ListCompareMode,'String');
    878844val=get(handles.ListCompareMode,'Value');
     
    896862menu_pair=get(handles.ListPairCiv2,'String');%previous menu of ListPairCiv1
    897863PairCiv2Init=menu_pair{get(handles.ListPairCiv2,'Value')};%previous choice of pair
    898 
    899 %% determine nom_type_nc, nomenclature type of the .nc files:
    900 %[nom_type_nc]=nomtype2pair(nom_type_ima,mode);
    901864
    902865%% reads .nc subdirectoy and image numbers from the interface
     
    924887nbpair=200;%default
    925888select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    926 %nbpair=200; %default
    927889
    928890%% determine the menu display in .ListPairCiv1
     
    991953        end
    992954    case 'displacement'
    993         displ_pair={'Di=Dj=0'};
    994         displ_pair_dt={'Di=Dj=0'};
    995 end
    996 if index==1
     955%         displ_pair={'Di=Dj=0'};
     956%         displ_pair_dt={'Di=Dj=0'};
     957        set(handles.PairIndices,'Visible','off')
     958end
     959if index==1 && ~strcmp(mode_selected,'displacement')
    997960    set(handles.ListPairCiv1,'String',displ_pair_dt');
    998961end
     
    1011974   set(handles.ListPairCiv1,'Value',1)
    1012975end
    1013 % if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1))
    1014 %     set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    1015 % end
    1016976
    1017977%% determine the default selection in the pair menu for Civ2
     978if ~strcmp(mode_selected,'displacement')
    1018979if strcmp(get(handles.ListPairCiv2,'Visible'),'on')
    1019980    end_pair=regexp(PairCiv2Init,' :dt=');
     
    1031992end
    1032993set(handles.ListPairCiv2,'String',displ_pair_dt');
     994end
    1033995set(gcf,'Pointer','arrow')% Indicate that the process is finished
    1034996
     
    23052267if ~isempty(filexml)
    23062268    Param=xml2struct(filexml);% read the input xml file as a Matlab structure
    2307 
    2308    % Param.Action.RUN=0; %desactivate the input RUN=1
    23092269    if ~isfield(Param,'InputTable')||~isfield(Param,'IndexRange')
    23102270        msgbox_uvmat('ERROR','invalid config file: open a file in a folder ''/0_XML''')
     
    23262286end
    23272287
     2288%------------------------------------------------------------------------
    23282289% --- Executes on selection change in CheckCiv3.
     2290%------------------------------------------------------------------------
    23292291function CheckCiv3_Callback(hObject, eventdata, handles)
    23302292
     2293%------------------------------------------------------------------------
    23312294% --- Executes on button press in CheckRefFile.
     2295%------------------------------------------------------------------------
    23322296function CheckRefFile_Callback(hObject, eventdata, handles)
    23332297
    2334     hseries=findobj(allchild(0),'Tag','series');
    2335     hhseries=guidata(hseries);
    2336     InputTable=get(hhseries.InputTable,'Data');
    2337     InputFile=fullfile(InputTable{1,1},InputTable{1,2},[InputTable{1,3} InputTable{1,5}]);
    2338  % browse for a reference file for displacement
    2339     fileref= uigetfile_uvmat('pick a reference image file:',InputFile);
    2340         if ~isempty(fileref)
    2341     set(handles.RefFile,'String',fileref)
    2342     set(handles.ConfigSource,'String','NEW')
    2343     set(handles.ConfigSource,'BackgroundColor',[1 0 1])
    2344         end
     2298hseries=findobj(allchild(0),'Tag','series');
     2299hhseries=guidata(hseries);
     2300InputTable=get(hhseries.InputTable,'Data');
     2301i1=str2num(get(hhseries.num_first_i,'String'));
     2302j1=str2num(get(hhseries.num_first_j,'String'));
     2303InputFile=fullfile_uvmat(InputTable{1,1},InputTable{1,2},InputTable{1,3},InputTable{1,5},InputTable{1,4},i1,[],j1);
     2304% browse for a reference file for displacement
     2305fileref= uigetfile_uvmat('pick a reference image file:',InputFile);
     2306if ~isempty(fileref)
     2307    FileInfo=get_file_info(fileref);
     2308    CheckImage=strcmp(FileInfo.FieldType,'image');% =1 for images
     2309    if ~CheckImage
     2310        msgbox_uvmat('ERROR',['invalid file type input for reference image: ' FileInfo.FileType ' not an image'])
     2311    else
     2312        if isfield (FileInfo,'NumberOfFrames')&& FileInfo.NumberOfFrames>1
     2313            set(handles.num_OriginIndex,'Visible','on')
     2314            set(handles.OriginIndex_title,'Visible','on')
     2315        else
     2316            set(handles.num_OriginIndex,'Visible','off')
     2317            set(handles.OriginIndex_title,'Visible','off')
     2318        end
     2319        set(handles.RefFile,'String',fileref)
     2320        set(handles.ConfigSource,'String','NEW')
     2321        set(handles.ConfigSource,'BackgroundColor',[1 0 1])
     2322    end
     2323end
    23452324
    23462325%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.