Ignore:
Timestamp:
Mar 12, 2025, 12:35:15 PM (2 days ago)
Author:
sommeria
Message:

background image introduced for civ1

File:
1 edited

Legend:

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

    r1171 r1176  
    12861286    end
    12871287    % browse for a mask
    1288     filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
    1289     if ~isempty(filemask)
    1290         [FilePath,FileName,FileExt]=fileparts(filemask);
     1288    filebackground= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
     1289    if ~isempty(filebackground)
     1290        [FilePath,FileName,FileExt]=fileparts(filebackground);
    12911291        [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName FileExt]);
    12921292        if strcmp(NomType,'_1')
     
    12971297            return
    12981298        end
    1299         set(hObject,'UserData',filemask);%store for future use
     1299        set(hObject,'UserData',filebackground);%store for future use
    13001300        testmask=1;
    13011301    end
     
    13031303if testmask
    13041304    set(handles.Mask,'Visible','on')
    1305     set(handles.Mask,'String',filemask)
     1305    set(handles.Mask,'String',filebackground)
    13061306    set(handles.CheckMask,'Value',1)
    13071307    if strcmp(NomType,'_1')
     
    19641964
    19651965
     1966% --- Executes on button press in CheckBackground.
     1967function CheckBackground_Callback(hObject, eventdata, handles)
     1968hparent=get(hObject,'parent');
     1969hchildren=get(hparent,'children');
     1970handle_txtbox=findobj(hchildren,'tag','Background');% look for the mask name box in the same panel
     1971testmask=0;
     1972if get(hObject,'Value')% if the checkbox is activated
     1973    hseries=findobj(allchild(0),'Tag','series');
     1974    hhseries=guidata(hseries);
     1975    InputTable=get(hhseries.InputTable,'Data');
     1976    if strcmp(InputTable{1,5},'.nc')
     1977        ind_A=2;%case of nc file as input (for civ3), image in second line
     1978    else
     1979        ind_A=1;% line index of the (first) image series
     1980    end
     1981    % browse for a mask
     1982    filebackground= uigetfile_uvmat('pick a background image file:',InputTable{ind_A,1},'image');
     1983    if ~isempty(filebackground)
     1984        [FilePath,FileName,FileExt]=fileparts(filebackground);
     1985        [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName FileExt]);
     1986        if strcmp(NomType,'_1')
     1987            NbSlice=i1_series(1,2,end);
     1988            set(handles.num_NbSlice,'String',num2str(NbSlice))
     1989        elseif ~strcmp(NomType,'*')
     1990            msgbox_uvmat('ERROR','multilevel background images must be labeled with a single index as _1,_2,...');
     1991            return
     1992        end
     1993        set(hObject,'UserData',filebackground);%store for future use
     1994        testmask=1;
     1995    end
     1996end
     1997if testmask
     1998    set(handles.Background,'Visible','on')
     1999    set(handles.Background,'String',filebackground)
     2000    set(handles.CheckBackground,'Value',1)
     2001    if strcmp(NomType,'_1')
     2002        set(handles.num_NbSlice,'Visible','on')
     2003    end
     2004else
     2005    set(hObject,'Value',0);
     2006    set(handle_txtbox,'Visible','off')
     2007    set(handles.num_NbSlice,'Visible','off')
     2008end
     2009set(handles.ConfigSource,'String','NEW')
     2010set(handles.ConfigSource,'BackgroundColor',[1 0 1])
     2011
     2012
     2013
     2014function Background_Callback(hObject, eventdata, handles)
     2015% hObject    handle to Background (see GCBO)
     2016% eventdata  reserved - to be defined in a future version of MATLAB
     2017% handles    structure with handles and user data (see GUIDATA)
     2018
     2019% Hints: get(hObject,'String') returns contents of Background as text
     2020%        str2double(get(hObject,'String')) returns contents of Background as a double
Note: See TracChangeset for help on using the changeset viewer.