Changeset 184 for trunk


Ignore:
Timestamp:
Jan 27, 2011, 8:11:15 PM (14 years ago)
Author:
sommeria
Message:

small bug repair and improvement of relabel_i_j

File:
1 edited

Legend:

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

    r128 r184  
    1 % relabel_i_j: relabel an image series with two indices, according to the time matrix given by ImaDoc
     1% relabel_i_j: relabel an image series with two indices, according to the time matrix given by ImaDoc
     2% (specific to RDvision system)
    23%----------------------------------------------------------------------
    34function GUI_input=relabel_i_j(num_i1,num_i2,num_j1,num_j2,Series)
     
    1314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1415
     16%% PARAMETERS (for RDvision system)
     17display('RDvision system')
     18first_label=0 %image numbers start from 0
     19errorfactor=2 %correct a factor of 2 in NbDk+1
     20
     21%% create dir of the new images
    1522basename=fullfile(Series.RootPath,Series.RootFile) ;
    16 
    17 %create dir of the new images
    1823[dir_images,namebase]=fileparts(basename);
    1924[path,subdir_ima]=fileparts(dir_images);
    20 curdir=pwd;
    21 cd(path);
    22 mkdir([subdir_ima '_ij']);
    23 [xx,msg2] = fileattrib(subdir_ima,'+w','g'); %yield writing access (+w) to user group (g)
     25newdir=fullfile(path,[subdir_ima '_ij']);
     26mkdir(newdir);
     27[xx,msg2] = fileattrib(newdir,'+w','g'); %yield writing access (+w) to user group (g)
    2428if ~strcmp(msg2,'')
    2529    msgbox_uvmat('ERROR',['pb of permission for ' subdir_ima ': ' msg2])%error message for directory creation
    26     cd(dircur)
    2730    return
    2831end
    29 cd(curdir);
    30 basename_new=fullfile(path,[subdir_ima '_ij'],namebase);
     32display(['relabelled images in the directory ' newdir])
     33basename_new=fullfile(newdir,namebase);
    3134
    32 % read imadoc
     35%% read imadoc
    3336[XmlData,warntext]=imadoc2struct([basename '.xml']);
    34 nbfield1=size(XmlData.Time,1)
    35 nbfield2=size(XmlData.Time,2)
     37nbfield1=size(XmlData.Time,1)/errorfactor;
     38nbfield2=size(XmlData.Time,2);
     39set(hseries.first_i,'String',num2str(first_label))% display the first image in the process
     40set(hseries.last_i,'String',num2str(nbfield1*nbfield2-1+first_label))% display the last image in the process
    3641
    37 answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m')
    38 test_level=isequal(answer,'Yes')
     42%% apply the image rescaling function 'level' (avoid bright particles)
     43answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m');
     44test_level=isequal(answer,'Yes');
    3945
    40 %copy the xml file
     46%% copy and adapt the xml file
    4147if exist([basename '.xml'],'file')
    4248    copyfile([basename '.xml'],[basename_new '.xml']);% copy the .civ file
     
    4955    end   
    5056    uid_ImageName=find(t,'ImaDoc/Heading/ImageName');
    51     ImageName=name_generator(basename_new,num_i1(1),num_j1(1),'.png','_i_j');
     57    ImageName=name_generator(basename_new,1,1,'.png','_i_j');
    5258    [pth,ImageName]=fileparts(ImageName);
    5359    ImageName=[ImageName '.png']
     
    7581end
    7682
    77 %main loop
     83%% main loop
    7884for ifile=1:nbfield1*nbfield2
    7985    update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2))
    8086    filename=name_generator(basename,ifile-1,1,Series.FileExt,Series.NomType);
    81     num_j=mod(ifile-1,nbfield2)+1;
    82     num_i=floor((ifile-1)/nbfield2)+1;
     87    num_j=mod(ifile-1+first_label,nbfield2)+1;
     88    num_i=floor((ifile-1+first_label)/nbfield2)+1;
    8389    filename_new=name_generator(basename_new,num_i,num_j,'.png','_i_j');
    8490    if test_level
Note: See TracChangeset for help on using the changeset viewer.