Changeset 1010 for trunk/src/series


Ignore:
Timestamp:
Sep 22, 2017, 12:33:16 PM (7 years ago)
Author:
sommeria
Message:

multimask introduced

Location:
trunk/src/series
Files:
1 added
1 deleted
3 edited

Legend:

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

    r1007 r1010  
    15161516hchildren=get(hparent,'children');
    15171517handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel
    1518 
     1518handle_NbSlice=findobj(hchildren,'tag','num_NbSlice');% look for the mask name box in the same panel
    15191519testmask=0;
    15201520if value
     
    15261526        ind_A=2;
    15271527    end
    1528     [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name
    1529     if isequal(flag_mask,1)
    1530         filemask=[num2str(nbslice) 'mask'];
    1531         testmask=1;
    1532     else % browse for a mask
     1528%     [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name
     1529%     if isequal(flag_mask,1)
     1530%         filemask=[num2str(nbslice) 'mask'];
     1531%         testmask=1;
     1532%     else % browse for a mask
    15331533        filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
     1534        [FilePath,FileName,Ext]=fileparts(filemask);   
     1535        [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName,Ext]);
     1536        if strcmp(NomType,'_1')
     1537           NbSlice=i1_series(1,2,end);
     1538           set(handle_NbSlice,'String',num2str(NbSlice))
     1539        end
    15341540        set(hObject,'UserData',filemask);%store for future use
    15351541        if ~isempty(filemask)
    15361542            testmask=1;
    1537         end
    1538     end
     1543         end
     1544%     end
    15391545end
    15401546if testmask
     
    15421548    set(handles.Mask,'String',filemask)
    15431549    set(handles.CheckMask,'Value',1)
     1550    if strcmp(NomType,'_1')
     1551        set(handles.num_NbSlice,'Visible','on')
     1552    end
    15441553else
    15451554    set(hObject,'Value',0);
    15461555    set(handle_txtbox,'Visible','off')
     1556    set(handles.num_NbSlice,'Visible','off')
    15471557end
    15481558set(handles.ConfigSource,'String','NEW')
     
    23752385    drawnow
    23762386end
     2387
     2388
     2389
     2390function num_NbSlice_Callback(hObject, eventdata, handles)
     2391% hObject    handle to num_NbSlice (see GCBO)
     2392% eventdata  reserved - to be defined in a future version of MATLAB
     2393% handles    structure with handles and user data (see GUIDATA)
     2394
     2395% Hints: get(hObject,'String') returns contents of num_NbSlice as text
     2396%        str2double(get(hObject,'String')) returns contents of num_NbSlice as a double
     2397
     2398
     2399% --- Executes during object creation, after setting all properties.
     2400function num_NbSlice_CreateFcn(hObject, eventdata, handles)
     2401% hObject    handle to num_NbSlice (see GCBO)
     2402% eventdata  reserved - to be defined in a future version of MATLAB
     2403% handles    empty - handles not created until after all CreateFcns called
     2404
     2405% Hint: edit controls usually have a white background on Windows.
     2406%       See ISPC and COMPUTER.
     2407if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2408    set(hObject,'BackgroundColor','white');
     2409end
  • trunk/src/series/civ_series.m

    r1007 r1010  
    276276
    277277%%%%% MAIN LOOP %%%%%%
    278 maskname='';% initiate the mask name
     278maskoldname='';% initiate the mask name
    279279FileType_A='';
    280280FileType_B='';
     
    440440        Data.VarAttribute{4}.Role='vector_y';
    441441        Data.VarAttribute{5}.Role='warnflag';
     442        % case of mask
    442443        if par_civ1.CheckMask&&~isempty(par_civ1.Mask)
    443             if strcmp(maskname,par_civ1.Mask)% mask exist, not already read in civ1
     444            if isfield(par_civ1,'NbSlice')
     445                [RootPath_mask,SubDir_mask,RootFile_mask,i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ1.Mask);
     446                i1_mask=mod(i1-1,par_civ1.NbSlice)+1;
     447                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     448            else
     449                maskname=Param.ActionInput.Civ1.Mask;
     450            end
     451            if strcmp(maskoldname,maskname)% mask exist, not already read in civ1
    444452                par_civ1.Mask=mask; %use mask already opened
    445453            else
    446454                try
    447                     par_civ1.Mask=imread(par_civ1.Mask);%update the mask, an store it for future use
     455                    par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
    448456                catch ME
    449457                    if ~isempty(ME.message)
     
    454462                end
    455463                mask=par_civ1.Mask;
    456                 maskname=par_civ1.Mask;
     464                maskoldname=maskname;
    457465            end
    458466        end
     
    704712            end
    705713        end
    706         if par_civ2.CheckMask&&~isempty(par_civ2.Mask)
    707             if strcmp(maskname,par_civ2.Mask)% mask exist, not already read in civ1
     714        if par_civ2.CheckMask&&~isempty(par_civ2.Mask)       
     715            if isfield(par_civ2,'NbSlice')
     716                [RootPath_mask,SubDir_mask,RootFile_mask,i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ2.Mask);
     717                i1_mask=mod(i1-1,par_civ2.NbSlice)+1;
     718                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     719            else
     720                maskname=Param.ActionInput.Civ2.Mask;
     721            end
     722            if strcmp(maskoldname,maskname)% mask exist, not already read in civ1
    708723                par_civ2.Mask=mask; %use mask already opened
    709724            else
    710                 par_civ2.Mask=imread(par_civ2.Mask);%update the mask, and store it for future use
     725                try
     726                    par_civ2.Mask=imread(maskname);%update the mask, an store it for future use
     727                catch ME
     728                    if ~isempty(ME.message)
     729                        errormsg=['error reading input image: ' ME.message];
     730                        disp_uvmat('ERROR',errormsg,checkrun)
     731                        return
     732                    end
     733                end
    711734                mask=par_civ2.Mask;
    712                 maskname=par_civ2.Mask;
    713             end
    714         end
     735                maskoldname=maskname;
     736            end
     737        end
     738
    715739        if CheckInputFile % else Dt given by par_civ2
    716740            if strcmp(Param.ActionInput.ListCompareMode,'displacement')
Note: See TracChangeset for help on using the changeset viewer.