Ignore:
Timestamp:
Feb 2, 2017, 1:25:44 PM (7 years ago)
Author:
sommeria
Message:

various

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_cine_phantom.m

    r980 r991  
    2222    fseek(fid, imageLocations( frames(ii) ), 'bof');
    2323    if ~BitmapInfoHeader.biCompression
     24%         [A,count]=fread(fid, 10000)
    2425        imTemp = fread(fid, [BitmapInfoHeader.biWidth BitmapInfoHeader.biHeight],'uint16');
    2526        imMat(:,:,ii) = imTemp';
    2627    else
    27     imTemp = fread(fid, [BitmapInfoHeader.biWidth BitmapInfoHeader.biHeight], 'ubit10','b');
    28     im = imTemp';
    29     im( im < 1 ) = 1;
    30     im =reshape( interp1( 1:1024, lookupTable, im(:) ), BitmapInfoHeader.biHeight, BitmapInfoHeader.biWidth);
    31     im( im < CameraSetup.BlackLevel ) = CameraSetup.BlackLevel;
    32     im( im > 4064 )=4064;
    33     imMat(:,:,ii) = reshape(interp1( CameraSetup.BlackLevel:4064, linspace(0,4095,4064 - CameraSetup.BlackLevel+1), im(:)),...
    34         BitmapInfoHeader.biHeight, BitmapInfoHeader.biWidth);
    35    
    36     if mod( round(0.01*Nf), ii)
    37        if ~exist('dispStr', 'var')
    38            dispStr = ' ';
    39            disp( dispStr )
    40        end
    41        
    42      lenDispStr = length( dispStr );
    43      dispStr = ['Reading is ' num2str( round( 100*ii/Nf ) ) '% complete'];
    44      disp( [char(8)*ones(1,lenDispStr+1) dispStr] )
    45     end
     28        imTemp = fread(fid, [BitmapInfoHeader.biWidth BitmapInfoHeader.biHeight], 'ubit10','b');
     29        im = imTemp';
     30        im( im < 1 ) = 1;
     31        im =reshape( interp1( 1:1024, lookupTable, im(:) ), BitmapInfoHeader.biHeight, BitmapInfoHeader.biWidth);
     32        im( im < CameraSetup.BlackLevel ) = CameraSetup.BlackLevel;
     33        im( im > 4064 )=4064;
     34        imMat(:,:,ii) = reshape(interp1( CameraSetup.BlackLevel:4064, linspace(0,4095,4064 - CameraSetup.BlackLevel+1), im(:)),...
     35            BitmapInfoHeader.biHeight, BitmapInfoHeader.biWidth);
     36       
     37        if mod( round(0.01*Nf), ii)
     38            if ~exist('dispStr', 'var')
     39                dispStr = ' ';
     40                disp( dispStr )
     41            end
     42            
     43            lenDispStr = length( dispStr );
     44            dispStr = ['Reading is ' num2str( round( 100*ii/Nf ) ) '% complete'];
     45            disp( [char(8)*ones(1,lenDispStr+1) dispStr] )
     46        end
    4647    end
    4748end
     
    5051end
    5152
    52 function lookupTable = lookupTablePackedFun() 
     53function lookupTable = lookupTablePackedFun()
    5354% function to transform the compressed 10 bit images back, close to the 12 bit camera images
    5455lookupTable = [ 2,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  17,  18,...
Note: See TracChangeset for help on using the changeset viewer.