Print

Print


 
Hello Joe,
 
I recently converted the result of my matlab computation to .nii using spm_write_vol shown below:
 
Write an image volume to disk, setting scales and offsets as appropriate
  FORMAT V = spm_write_vol(V,Y)
  V (input)  - a structure containing image volume information (see spm_vol)
  Y          - a one, two or three dimensional matrix containing the image voxels
  V (output) - data structure after modification for writing.
 
Though my matlab file was a 3D, I dont know if you can use this for 4D, but you can convert from 4D to 3D if need be.
 
FORMAT V = spm_write_vol(V,Y)
 
Y is your Matlab file and V is your header information. Format V is your nifti file, which is your output. You have to choose V from the SPM template.
 
I hope this helps.
 
Regards,
 
Moses
 
 
Moses Olufemi SOKUNBI,
SINAPSE PhD student,
Aberdeen Biomedical Imaging Centre,
Research MRI,
Lilian Sutton Building,

 

Foresterhill,
Aberdeen,
AB25 2ZD.
Scotland,
United Kingdom.
 
Office Tel:  +44 (0)1224 559731
Mobile: +44 (0)7551 408 357
Email: [log in to unmask]
 

From: SPM (Statistical Parametric Mapping) [[log in to unmask]] On Behalf Of Joseph Whittaker [[log in to unmask]]
Sent: 15 May 2009 14:33
To: [log in to unmask]
Subject: [SPM] converting to nifti

Hi

Does anyone know how to convert matlab files into .nii files that can be read by SPM. I am trying to use SPM to analyse some optical imaging data.

I have arranged my data into a 4D struct [x y z t] although as it is not fMRI data there are only 2 spatial dimentsions so I have 60 frames of 512x512 14 bit images arranged in a matlab file as (512,512,1,60).

I used the make_nii function that is available in the MatLab NIFTI and ANALZYE toolbox, and although it seems to work and it creats an image file with a header etc, when I save it as a .nii file I am still unable to open it with SPM.

Maybe I'm barking up the wrong tree in thinking I can treat my optical imaging data like fMRI data, but my supervisor is convinced I can use SPM with optical imaging data.

Any advice ot information would be much appreciated

Thanks

Joe


The University of Aberdeen is a charity registered in Scotland, No SC013683.