Skip to end of metadata
Go to start of metadata

Converting enhanced DICOM to NIFTI using dcm2nii for data from XNAT:

The following information is for investigators who have part of their data for a project on Bioscribe and new data going to XNAT. If you started your project fresh on XNAT you can skip the following message.

 

If you have project data for the same study on both Bioscribe and XNAT, you should be aware that the DICOM to NIFTI converter handles data coming from each system slightly differently.

 

Up to now, dcm2nii converter has been used to convert DICOM data from Bioscribe. However, we have noted that using the dcm2nii program to convert data downloaded from XNAT will result in slightly different header info. But this can be corrected (modified) so the NIFIT image is identical to the data from Bioscribe using the script outlined below:

 

[Please note: if you use a different conversion program, let us know and we are happy to test it out for you.Please send email to: discsupp@uw.edu for any question or comment.]

 

To view the image header, you can use command “fslhd”. This is a FSL command line utility.

To manually modify an image header, you can use command “fsledithd”.

Here are the header fields that need to be checked/modified (mostly Pixel dimension size related):

dx: replace with correct image dimension X

dy: replace with correct image dimension Y

dz: replace with correct image dimension Z

scl_sclop: replace with 1

sto_xyz & qto_xyz matrix: use following formula to replace all value in matrix [x y z t]

x*X/dx , y*Y/dy, z*Z/dz t

 

 

To automate header modification process, use following steps:

  • Find out the image pixel dimension information (X, Y,Z) from previous image on Bioscribe
  • Export xml-based header file (header.xml);
    fslhd –x original.nii.gz header.xml 
  • make a shellscript to modify header.xml with correct value, and save as newheader.xml
  • Apply newly modified header to original image file
    fslcreatehd newheader.xml original.nii.gz 

 

 

Maya Reiter has made the bash script for her data, it works great. She is very generously willing to share the script with other researcher.  The script is Downloadable  [here].

  • No labels