Neuroimaging data is usually acquired in a format unsuitable for data processing (e.g. missing or incomplete support for data manipulation in existing files), such as DICOM or PAR/REC (Philips proprietary). SPM comes with an import function for this, and the dcm2nii function collects the required information and passes it on to the SPM Job manager.
To be able to use this function you must have
dcm2nii - convert DICOM to NII files FORMAT: dcm2nii(source, target, opts) Input fields: source source folder containing DICOM files target target folder opts optional settings .dcmpat DICOM file pattern, default: '*.dcm' .format either {'img'} or 'nii' No output fields.
In case you have multiple sessions of data in the source folder, these files must have a unique filename pattern per session, so that by re-setting the .dcmpat
field you can selectively choose which files to import!
This code imports the DICOM files contained in one folder into a different folder:
% import DICOM images % - from /Data/Study/Subjects/s04/func/raw/192_r1 % - into /Data/Study/Subjects/s04/func/prepro/r01_192 % - save resulting images as .nii files dcm2nii( ... '/Data/Study/Subjects/s04/func/raw/192_r1', ... '/Data/Study/Subjects/s04/func/prepro/r01_192', ... struct('format', 'nii'));