Changeset 388 for trunk/src/civ.m
- Timestamp:
- Apr 6, 2012, 4:37:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r387 r388 919 919 drawnow 920 920 end 921 % datnum=[];922 921 Tabchar={}; 923 922 nbfiles=numel(civ_files); … … 1169 1168 nbfield=numel(i1_civ1); 1170 1169 nbslice=numel(j1_civ1); 1170 if ~strcmp(CivMode,'CivX') 1171 [Param.Civ1.FileTypeA,FileInfo,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1}); 1172 [Param.Civ1.FileTypeB,FileInfo,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1}); 1173 end 1171 1174 1172 1175 %% MAIN LOOP … … 1219 1222 Param.Civ1.ImageHeight=ImageInfo.Height; 1220 1223 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth; 1224 Param.Civ1.i1=i1_civ1; 1225 Param.Civ1.i2=i2_civ1; 1221 1226 % read mask parameters 1222 1227 if Param.Civ1.CheckMask % the lines below should be changed with the new gui … … 1227 1232 [RootPathMask,RootFileMask]=fileparts(maskbase); 1228 1233 Param.Civ1.Mask=fullfile_uvmat(RootPathMask,[],RootFileMask,'.png','_1',i1_mask); 1229 % Param.Civ1.Mask=name_generator(maskbase,i1_mask,1,'.png','_i');1230 1234 end 1231 1235 end … … 1388 1392 Param.Civ2.ImageHeight=ImageInfo.Height; 1389 1393 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth; 1394 Param.Civ2.i1=i1_civ2; 1395 Param.Civ2.i2=i2_civ2; 1390 1396 % TODO: case of movie 1391 1397 switch CivMode … … 1796 1802 %------------------------------------------------------------------------ 1797 1803 filecell=[];%default 1804 ListProgram=get(handles.ListProgram,'String'); 1805 CivMode=ListProgram{get(handles.ListProgram,'Value')};%Program to use , CivX or Matlab 1798 1806 1799 1807 %% get the root name and check dir … … 1809 1817 return 1810 1818 end 1811 [ xx,message]=fileattrib(RootPath);1819 [tild,message]=fileattrib(RootPath); 1812 1820 if ~isempty(message) && ~isequal(message.UserWrite,1) 1813 1821 msgbox_uvmat('ERROR',['No writting access to ' RootPath]) … … 2414 2422 set(handles.SubdirCiv2,'String',subdir_civ2);%update the edit box 2415 2423 2416 %COPY IMAGES TO THE FORMAT .png IF NEEDED 2417 if isequal(NomType_ima1,'*')%case of movie files 2418 NomType_imanew1='_i'; 2419 else 2420 NomType_imanew1=NomType_ima1; 2421 end 2422 if isequal(NomType_ima2,'*')%case of movie files 2423 NomType_imanew2='_i'; 2424 else 2425 NomType_imanew2=NomType_ima2; 2426 end 2427 if ~isequal(ext_ima,'.png') 2428 %%type of image file 2429 type_ima1='none';%default 2430 movieobject1=[];%default 2431 if strcmpi(ext_ima,'.avi') 2432 if ~isempty(which('mmreader'))% if the mmreader function is found (recent version of matlab) 2433 type_ima1='movie'; 2434 movieobject1=mmreader([filecell.filebase ext_ima]); 2435 else 2436 type_ima1='avi'; 2437 end 2438 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) 2439 form=imformats(ext_ima(2:end)); 2440 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2441 if isequal(NomType_ima1,'*'); 2442 type_ima1='multimage';%image series in a single image file 2424 % For CivX COPY IMAGES TO THE FORMAT .png IF NEEDED 2425 if strcmp(CivMode,'CivX') 2426 if isequal(NomType_ima1,'*')%case of movie files 2427 NomType_imanew1='_i'; 2428 else 2429 NomType_imanew1=NomType_ima1; 2430 end 2431 if isequal(NomType_ima2,'*')%case of movie files 2432 NomType_imanew2='_i'; 2433 else 2434 NomType_imanew2=NomType_ima2; 2435 end 2436 if ~isequal(ext_ima,'.png') 2437 %%type of image file 2438 type_ima1='none';%default 2439 movieobject1=[];%default 2440 if strcmpi(ext_ima,'.avi') 2441 if ~isempty(which('mmreader'))% if the mmreader function is found (recent version of matlab) 2442 type_ima1='movie'; 2443 movieobject1=mmreader([filecell.filebase ext_ima]); 2443 2444 else 2444 type_ima1=' image';2445 end 2446 e nd2447 end2448 type_ima2='none';%default2449 movieobject2=[];2450 if strcmpi(ext_ima,'.avi')2451 if ~isempty(which('mmreader'))% if the mmreader function is found (recent version of matlab)2452 type_ima2='movie';2453 movieobject2=mmreader([filecell.filebase ext_ima]);2454 else2455 type_ima2='avi';2456 end2457 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end))2458 form=imformats(ext_ima(2:end));2459 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab2460 if isequal(NomType_ima1,'*');2461 type_ima2='multimage';%image series in a single image file2445 type_ima1='avi'; 2446 end 2447 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) 2448 form=imformats(ext_ima(2:end)); 2449 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2450 if isequal(NomType_ima1,'*'); 2451 type_ima1='multimage';%image series in a single image file 2452 else 2453 type_ima1='image'; 2454 end 2455 end 2456 end 2457 type_ima2='none';%default 2458 movieobject2=[]; 2459 if strcmpi(ext_ima,'.avi') 2460 if ~isempty(which('mmreader'))% if the mmreader function is found (recent version of matlab) 2461 type_ima2='movie'; 2462 movieobject2=mmreader([filecell.filebase ext_ima]); 2462 2463 else 2463 type_ima2='image'; 2464 end 2465 end 2466 end 2467 if checkbox(1) %if civ1 is performed 2468 h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar 2469 for ifile=1:nbfield 2470 waitbar(ifile/nbfield); 2471 for j=1:nbslice 2472 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ1(ifile),[],j1_civ1(j)); 2473 if ~exist(filename,'file') 2474 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,i1_civ1(ifile),movieobject1); 2475 imwrite(A,filename,'BitDepth',16); 2464 type_ima2='avi'; 2465 end 2466 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) 2467 form=imformats(ext_ima(2:end)); 2468 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2469 if isequal(NomType_ima1,'*'); 2470 type_ima2='multimage';%image series in a single image file 2471 else 2472 type_ima2='image'; 2476 2473 end 2477 filecell.ima1.civ1(ifile,j)={filename}; 2478 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ1(ifile),[],j2_civ1(j)); 2479 if ~exist(filename,'file') 2480 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,i2_civ1(ifile),movieobject2); 2481 imwrite(A,filename,'BitDepth',16); 2474 end 2475 end 2476 if checkbox(1) %if civ1 is performed 2477 h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar 2478 for ifile=1:nbfield 2479 waitbar(ifile/nbfield); 2480 for j=1:nbslice 2481 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ1(ifile),[],j1_civ1(j)); 2482 if ~exist(filename,'file') 2483 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,i1_civ1(ifile),movieobject1); 2484 imwrite(A,filename,'BitDepth',16); 2485 end 2486 filecell.ima1.civ1(ifile,j)={filename}; 2487 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ1(ifile),[],j2_civ1(j)); 2488 if ~exist(filename,'file') 2489 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,i2_civ1(ifile),movieobject2); 2490 imwrite(A,filename,'BitDepth',16); 2491 end 2492 filecell.ima2.civ1(ifile,j)={filename}; 2482 2493 end 2483 filecell.ima2.civ1(ifile,j)={filename}; 2484 end 2485 end 2486 close(h) 2487 end 2488 if checkbox(4) %if civ2 is performed 2489 h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar 2490 for ifile=1:nbfield 2491 waitbar(ifile/nbfield); 2492 for j=1:nbslice 2493 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ2(ifile),[],j1_civ2(j)); 2494 if ~exist(filename,'file') 2495 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,i1_civ2(ifile)); 2496 imwrite(A,filename,'BitDepth',16); 2494 end 2495 close(h) 2496 end 2497 if checkbox(4) %if civ2 is performed 2498 h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar 2499 for ifile=1:nbfield 2500 waitbar(ifile/nbfield); 2501 for j=1:nbslice 2502 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ2(ifile),[],j1_civ2(j)); 2503 if ~exist(filename,'file') 2504 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,i1_civ2(ifile)); 2505 imwrite(A,filename,'BitDepth',16); 2506 end 2507 filecell.ima1.civ2(ifile,j)={filename}; 2508 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ2(ifile),[],j2_civ2(j)); 2509 if ~exist(filename,'file') 2510 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,i2_civ2(ifile)); 2511 imwrite(A,filename,'BitDepth',16); 2512 end 2513 filecell.ima2.civ2(ifile,j)={filename}; 2497 2514 end 2498 filecell.ima1.civ2(ifile,j)={filename}; 2499 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ2(ifile),[],j2_civ2(j)); 2500 if ~exist(filename,'file') 2501 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,i2_civ2(ifile)); 2502 imwrite(A,filename,'BitDepth',16); 2503 end 2504 filecell.ima2.civ2(ifile,j)={filename}; 2505 end 2506 end 2507 close(h); 2515 end 2516 close(h); 2517 end 2508 2518 end 2509 2519 end … … 3916 3926 Data.nx=[1 size(Data.A,2)]; 3917 3927 par_civ1=read_GUI(handles.Civ1); 3918 par_civ1.ImageWidth=size(Data.A, 1);3919 par_civ1.ImageHeight=size(Data.A, 2);3928 par_civ1.ImageWidth=size(Data.A,2); 3929 par_civ1.ImageHeight=size(Data.A,1); 3920 3930 par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation 3931 par_civ1.i1=i1_civ1; 3932 par_civ1.i2=i2_civ1; 3921 3933 Param.Civ1=par_civ1; 3922 3934 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
Note: See TracChangeset
for help on using the changeset viewer.