users > Nrrd to Nifti
Showing 1-2 of 2 posts
Display:
Results per page:
Sep 27, 2012  04:09 PM | Stephanie Del Tufo
Nrrd to Nifti
I'm looking for a conversion from NRRD to Nifti. Any chance CMTK can do this? 
-Stephanie
Sep 27, 2012  04:09 PM | Torsten Rohlfing
RE: Nrrd to Nifti
Hi Stephanie:

Yes, but with limitations. In general, CMTK's "convertx" tool will convert an input file in any supported format to an output file in any supported format. (Alternatively, you can use the "reorient" tool to do a conversion with simultaneous modification of image coordinate space and image orientation).

The exact commands would be:

cmtk convertx input.nrrd output.nii

or

cmtk reorient input.nrrd output.nii

Used like this, both commands would do exactly the same thing, namely read input.nrrd and write output.nii. To see what additional operations each of the tools can do, if you care, simply run "cmtk convertx --help" or "cmtk reorient --help".

(Note that all these assume you have built and installed CMTK with the "cmtk" wrapper script (this is always the case in NeuroDebian). Otherwise, simply use the absolute path to the tools, such as: /path/to/bin/convertx

NOW for the limitations - CMTK does not read all types of images and can, therefore, not convert all types. Specifically, CMTK reads 2- or 3-dimensional, scalar-valued images. It cannot read (or convert) 4D, 5D, vector-valued, or RGB images. Also, not all meta-information will be piped through into the output file, such as Nrrd information on measurement frame. In reverse, things like NIFTI intent codes would get lost.

If you need to convert higher-dimensional or non-scalar files, I recommend a tool from the InsightApplications, which go with ITK - there is some image format conversion tool there, which can convert between any types supported by ITK (a lot more general than CMTK's support). The exact name escapes me right now, but it should be easy to identify.

Best,
 Torsten