Brain Image File Conversion/Import Tips

1. How to read huge analyze file into MALAB (Dec 5, 2007)

Please d/l and install
http://www.sph.sc.edu/comd/rorden/mricro.html
It is the simplest way to view medical images one slice at a time.
Get image dimension from MRICRO and run the following code
 
fid=fopen('F213-18-07.img');
for i=1:711
    [a,count]=fread(fid,512*512,'int8');
    if i==427
        b=a;
    end;
end;
b=reshape(b,512,512);
imagesc(b)
 
It will load the 427th image slice into MATLAB.
Now compare the loaded image with MRIcro display.

2. Converting MINC to BRIK

/apps/linux/afni/3dMINCtoAFNI  
This is the part of AFNI package
 

3. Converting BRIK to MINC

/apps/linux/afni/3dAFNItoMINC 
This is the part of AFNI package


4. Loading BRIK into MATLAB
This is based on the AFNI MATLAB package written by Ziad Saad of NIH.

BrikName='jacob2';
Opt.Format = 'matrix';
[err, image, Info, ErrMessage] = BrikLoad (BrikName, Opt);

% image = 181 x 217 x 181