Changeset 184 for trunk/src/series
- Timestamp:
- Jan 27, 2011, 8:11:15 PM (14 years ago)
- 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) 2 3 %---------------------------------------------------------------------- 3 4 function GUI_input=relabel_i_j(num_i1,num_i2,num_j1,num_j2,Series) … … 13 14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 15 16 %% PARAMETERS (for RDvision system) 17 display('RDvision system') 18 first_label=0 %image numbers start from 0 19 errorfactor=2 %correct a factor of 2 in NbDk+1 20 21 %% create dir of the new images 15 22 basename=fullfile(Series.RootPath,Series.RootFile) ; 16 17 %create dir of the new images18 23 [dir_images,namebase]=fileparts(basename); 19 24 [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) 25 newdir=fullfile(path,[subdir_ima '_ij']); 26 mkdir(newdir); 27 [xx,msg2] = fileattrib(newdir,'+w','g'); %yield writing access (+w) to user group (g) 24 28 if ~strcmp(msg2,'') 25 29 msgbox_uvmat('ERROR',['pb of permission for ' subdir_ima ': ' msg2])%error message for directory creation 26 cd(dircur)27 30 return 28 31 end 29 cd(curdir); 30 basename_new=fullfile( path,[subdir_ima '_ij'],namebase);32 display(['relabelled images in the directory ' newdir]) 33 basename_new=fullfile(newdir,namebase); 31 34 32 % read imadoc35 %% read imadoc 33 36 [XmlData,warntext]=imadoc2struct([basename '.xml']); 34 nbfield1=size(XmlData.Time,1) 35 nbfield2=size(XmlData.Time,2) 37 nbfield1=size(XmlData.Time,1)/errorfactor; 38 nbfield2=size(XmlData.Time,2); 39 set(hseries.first_i,'String',num2str(first_label))% display the first image in the process 40 set(hseries.last_i,'String',num2str(nbfield1*nbfield2-1+first_label))% display the last image in the process 36 41 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) 43 answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m'); 44 test_level=isequal(answer,'Yes'); 39 45 40 % copythe xml file46 %% copy and adapt the xml file 41 47 if exist([basename '.xml'],'file') 42 48 copyfile([basename '.xml'],[basename_new '.xml']);% copy the .civ file … … 49 55 end 50 56 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'); 52 58 [pth,ImageName]=fileparts(ImageName); 53 59 ImageName=[ImageName '.png'] … … 75 81 end 76 82 77 % main loop83 %% main loop 78 84 for ifile=1:nbfield1*nbfield2 79 85 update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2)) 80 86 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; 83 89 filename_new=name_generator(basename_new,num_i,num_j,'.png','_i_j'); 84 90 if test_level
Note: See TracChangeset
for help on using the changeset viewer.