Changeset 73 for trunk/src/series/ima2vol.m
- Timestamp:
- Mar 30, 2010, 11:50:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/ima2vol.m
r72 r73 60 60 %main loop 61 61 vol=[]; 62 for ifile=1:nbfield1*nbfield2 63 update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2)) 64 filename=name_generator(basename,ifile-1,1,Series.FileExt,Series.NomType); 65 num_j=mod(ifile-1,nbfield2)+1; 66 num_i=floor((ifile-1)/nbfield2)+1; 67 A=imread(filename); 68 if test_level 69 A=levels(A); 70 end 71 vol=[vol;A];%concacene along y 72 if num_j==nbfield2 73 filename_new=name_generator(basename_new,num_i,1,'.vol','_i'); 74 imwrite(vol,filename_new,'png','BitDepth',16)% WRITE IN 16 bits 75 vol=[]; 76 end 77 end 62 for ifile=1:nbfield1*nbfield2 63 update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2)) 64 stopstate=get(hseries.RUN,'BusyAction'); 65 if isequal(stopstate,'queue') % enable STOP command 66 filename=name_generator(basename,ifile-1,1,Series.FileExt,Series.NomType); 67 num_j=mod(ifile-1,nbfield2)+1; 68 num_i=floor((ifile-1)/nbfield2)+1; 69 A=imread(filename); 70 Atype=class(A); 71 if test_level 72 A=levels(A,16); 73 display(num2str(num_i)) 74 end 75 vol=[vol;A];%concacene along y 76 if num_j==nbfield2 77 filename_new=name_generator(basename_new,num_i,1,'.vol','_i'); 78 imwrite(vol,filename_new,'png','BitDepth',16)% WRITE IN 16 bits: needed for the current version of civ3C3D 79 display([filename_new 'written (16bits image)']) 80 vol=[]; 81 end 82 end 83 end 78 84 79 85 80 86 81 function C=levels(A )87 function C=levels(A,bitdepth) 82 88 %whos A; 83 89 B=double(A(:,:,1)); … … 115 121 cmin=min(c_select); 116 122 cmax=max(c_select); 117 C=(C-cmin)/(cmax-cmin)*256; 118 %C=uint8(C); 123 if isequal(bitdepth,16) 124 C=((C-cmin)/(cmax-cmin))*256*256; 125 C=uint16(C); 126 else 127 C=((C-cmin)/(cmax-cmin))*256; 128 C=uint8(C); 129 end
Note: See TracChangeset
for help on using the changeset viewer.