Changeset 73 for trunk/src/series


Ignore:
Timestamp:
Mar 30, 2010, 11:50:35 PM (15 years ago)
Author:
sommeria
Message:

ima2vol: provides volume images in 16 bit (presently needed for the software 3D3C)
set_grid: small bug repairs
uvmat: small bug repairs.
civ: bug repair following previous changes (RUN and BATCH functions merged)
plot_field: cleaning of parameter transmission. Introduction of a parameter handle of a text box (not yet used)

File:
1 edited

Legend:

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

    r72 r73  
    6060%main loop
    6161 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
    7884
    7985
    8086
    81 function C=levels(A)
     87function C=levels(A,bitdepth)
    8288%whos A;
    8389B=double(A(:,:,1));
     
    115121cmin=min(c_select);
    116122cmax=max(c_select);
    117 C=(C-cmin)/(cmax-cmin)*256;
    118 %C=uint8(C);
     123if isequal(bitdepth,16)
     124    C=((C-cmin)/(cmax-cmin))*256*256;
     125    C=uint16(C);
     126else
     127    C=((C-cmin)/(cmax-cmin))*256;
     128    C=uint8(C);
     129end
Note: See TracChangeset for help on using the changeset viewer.