Changeset 643 for trunk/src


Ignore:
Timestamp:
May 23, 2013, 12:33:52 AM (11 years ago)
Author:
sommeria
Message:

small bug corrections

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_file_series.m

    r639 r643  
    7070        if isempty(incr_i)
    7171            if isempty(first_j) || isempty(incr_j) % no j index or no defined increment for j
    72                 [ref_j,ref_i]=find(i1_series{iview});
     72                ref_j=find(max(i1_series{iview},[],2));
     73                ref_i=find(max(i1_series{iview},[],1));
    7374                ref_i=ref_i-1;
    7475                ref_j=ref_j-1;
     
    7778            else
    7879                ref_j=first_j:incr_j:last_j;
    79                 [tild,ref_i]=find(i1_series{iview}(:,ref_j));
     80                ref_i=find(max(i1_series{iview}(:,ref_j),[],1));
    8081                ref_i=ref_i-1;
    8182                ref_i=ref_i(ref_i>=first_i & ref_i<=last_i);
     
    8485            ref_i=first_i:incr_i:last_i;%default
    8586            if isempty(first_j) ||isempty(incr_j)% no j index or no defined increment for j
    86                 [ref_j,tild]=find(i1_series{iview});
     87                ref_j=find(max(i1_series{iview},[],2));
    8788                ref_j=ref_j-1;
    8889                ref_j=ref_j(ref_j>=first_j & ref_j<=last_j);
  • trunk/src/series.m

    r639 r643  
    448448%------------------------------------------------------------------------
    449449InputTable=get(handles.InputTable,'Data');
    450 view_set=get(handles.REFRESH,'UserData');% list of lines to refresh
     450% view_set=get(handles.REFRESH,'UserData');% list of lines to refresh
    451451set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
    452452drawnow
    453 for iview=view_set
     453empty_line=false(size(InputTable,1),1);
     454for iline=1:size(InputTable,1)
     455    empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));
     456end
     457InputTable(empty_line,:)=[];%remove empty lines
     458set(handles.InputTable,'Data',InputTable)
     459for iview=1:size(InputTable,1)
    454460    RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});
    455461    if ~exist(RootPath,'dir')
    456462        i1_series=[];
    457         RootPath=fileparts(RootPath); %will try the upped forldr
     463        RootPath=fileparts(RootPath); %will try the upped forlder
    458464    else
    459465        [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=...
     
    474480set(handles.REFRESH,'Visible','off')
    475481set(handles.REFRESH_title,'Visible','off')
    476 set(handles.REFRESH,'UserData',[])
     482% set(handles.REFRESH,'UserData',[])
    477483
    478484%------------------------------------------------------------------------
     
    864870        check_burst=cellfun(@isempty,regexp(PairString,'^j'));%=0 for burst case, 1 otherwise
    865871 %   check_nopair=cellfun(@isempty,PairString);
    866     if isempty(find(check_burst))% if all pair string begins by j (burst)
     872    if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
    867873        status_j='off'; % no j index needed for bust case
    868874    end
     
    876882xI=0.5:Position(3)-0.5;
    877883nbview=numel(SeriesData.i1_series);
    878 pair_max=cell(1,nbview);
     884j_max=cell(1,nbview);
     885MaxIndex_i=ones(1,nbview);%default
     886MinIndex_i=ones(1,nbview);%default
    879887for iview=1:nbview
    880     pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
    881     if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1)
    882         pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index
    883     end
    884     index_min(iview)=find(pair_max{iview}>0, 1 );
    885     index_max(iview)=find(pair_max{iview}>0, 1, 'last' );
    886 end
    887 index_min=min(index_min);
    888 index_max=max(index_max);
    889 range_index=index_max-index_min+1;
    890 scale_y=Position(4)/nbview;
    891 scale_x=Position(3)/range_index;
    892 x=(0.5:range_index-0.5)*Position(3)/range_index;
     888    pair_max=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
     889    j_max{iview}=max(pair_max,[],1);%max on j index
     890    MaxIndex_i(iview)=max(find(j_max{iview}))-1;% max ref index i
     891    MinIndex_i(iview)=min(find(j_max{iview}))-1;% min ref index i
     892%     pair_max{iview}=squeezSeriesData.i1_series{iview},[],1)); %max on pair index
     893%     if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1)
     894%         pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index
     895%     end
     896end
     897MinIndex_i=min(MinIndex_i);
     898MaxIndex_i=max(MaxIndex_i);
     899range_index=MaxIndex_i-MinIndex_i+1;
     900% scale_y=Position(4)/nbview;
     901% scale_x=Position(3)/range_index;
     902%x=(0.5:range_index-0.5)*Position(3)/range_index;% set of abscissa representing the whole i index range
    893903% y=(0.5:nbview-0.5)*Position(4)/nbview;
    894904range_y=max(1,floor(Position(4)/nbview));
    895 CData=zeros(nbview*range_y,floor(Position(3)));
     905npx=floor(Position(3));
     906file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
     907CData=zeros(nbview*range_y,npx);% initiate the image representing the existing files
    896908for iview=1:nbview
    897909    ind_y=1+(iview-1)*range_y:iview*range_y;
    898     LineData=zeros(1,range_index);
    899     x_index=find(pair_max{iview}>0)-index_min+1;
    900     LineData(x_index)=1;
    901     if numel(x)>1
    902     LineData=interp1(x,LineData,xI,'nearest');
     910    LineData=zeros(size(file_indices));
     911    file_select=file_indices(file_indices<=numel(j_max{iview}));
     912    ind_select=find(file_indices<=numel(j_max{iview}));
     913    LineData(ind_select)=j_max{iview}(file_select)~=0;
     914%     LineData=zeros(1,range_index);
     915%     x_index=find(j_max{iview}>0)-MinIndex_i;
     916%     LineData(x_index)=1;
     917%     if numel(x)>1
     918%         LineData
     919    %LineData=interp1(x,LineData,xI,'nearest');
    903920    CData(ind_y,:)=ones(size(ind_y'))*LineData;
    904     end
    905 end
    906 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData)));
     921%     end
     922end
     923CData=cat(3,zeros(size(CData)),CData,zeros(size(CData)));%make color images r=0,g,b=0
    907924set(handles.FileStatus,'CData',CData);
    908925
     
    17971814empty_line=false(size(Param.InputTable,1),1);
    17981815for iline=1:size(Param.InputTable,1)
    1799     empty_line(iline)=isequal(Param.InputTable(iline,1:3),{'','',''});
     1816    empty_line(iline)=isempty(cell2mat(Param.InputTable(iline,1:3)));
    18001817end
    18011818Param.InputTable(empty_line,:)=[];
     
    24052422%--------------------------------------------------------------
    24062423function CheckMask_Callback(hObject, eventdata, handles)
    2407 
    24082424if get(handles.CheckMask,'Value')
    2409     set(handles.Mask,'Visible','on')
    24102425    InputTable=get(handles.InputTable,'Data');
    2411     defaultname=InputTable{1,1};
    2412     MaskName=uigetfile_uvmat('select a mask image file:',defaultname);
    2413     if ~isempty(MaskName)
    2414         set(handles.Mask,'String',MaskName)
    2415     end
    2416 else
    2417     set(handles.Mask,'Visible','off')
    2418     set(handles.Mask,'String','')
     2426    for iview=1:size(InputTable,1)
     2427        RootPath=InputTable{iview,1};
     2428        SubDir=InputTable{iview,2};
     2429        MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
     2430        MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
     2431        if ~exist(MaskName,'file')
     2432            msgbox_uvmat('WARNING',['mask file '  MaskName ' not found'])
     2433            return
     2434        end
     2435    end
    24192436end
    24202437%--------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.