I’m trying to convert a FA map in nifti format to DICOM format. I tried intermediary steps of converting the nifti file to NRRD first (and TIF), but the output has no contrast. DICOM files are created, but the image contrast is incorrect.
On the DICOM, it looks like all the image values are either 0 or 1.
Traditional dicom files do not support floating point, only integer types. There is a way to provide rescale parameters (slope and intercept). You could have a look at how commercial scanners/workstations represent FA maps and just copy that format.
@pieper for completeness, it is worth noting that DICOM does support float32 (Float Pixel Data: 7FE0,0008) and float64 (Double Float Pixel Data: 7FE0,0009), but these representations are very rare (I have only personally seen them in context of radiotherapy). I do not think many DICOM tools support these datatypes, so for practical purposes it may be worth avoiding creating these datatypes.
My own solution to this problem would be to save the data as signed 16-bit integers. I would multiply the each voxel’s FA value by x32000, and then set the rescale slope (0028,1053) to 1/32000, with the rescale intercept (0028,1052) set to zero. The int16 supports integer values of -32768…32768 but the conservative 32000 could in theory retain edges for higher order interpolation.
I always set our scanner to discard FA images as we can derive better images after we process with degibbs, dwidenoise, eddy and topup. However, I will keep this in mind and see if I can acquire some sample data to show how Siemens does save their FA maps. As I recall, Siemens does not store spatial transforms for their FA and colored direction-modulated-by-FA images, so I do not think I would copy them too carefully.
Thanks for the extra info @Chris_Rorden. Yes, there are some more modern options (rare, as you say). I suggested “traditional” approaches because I guessed that @snnstuff probably wants some kind of interoperable solution. But even for that there are options so the answer, as usual, really is ‘it depends on why you want to export to dicom’.
Thanks for the information… yes, I compute my own FA maps offline after a proper preprocessing pipeline.
I ended up multiplying each voxel value on the source NIFTI FA maps by 1000 then doing the conversion to DICOM.
This certainly produced a DICOM image with contrast similar to the source NIFTI image (although, I’m now guessing not identical based on the prior posts).
Given that the DICOM FA maps are sometimes downloaded from PACS and used with 3rd party software (research ROI analysis or VBA; or more critically, tractography for surgical navigation) the accuracy and values matter. The optimal scenario would be saving the DICOM in floating point given potential use with 3rd party software to retain the expected range of voxel values between 0 and 1.
Yes, if you need to put the images through a clincial PACS, then following the traditional method of scaling by 1000 (or 32000 as Chris suggests) and storing as an MR image or secondary capture is a reasonable path. You’d really want to reverse engineer from the end use (e.g. surgical navication system) to determine the highest fidelity format it can consume.
You may also want to generate an additional Parametric Map series, which floating point pixels with header fields like QuantityValueCode and MeasurementMethodCode to be very explicit about what the data is meant to represent and how you calculated it. This information about the dcmqi tools should give you a good idea how to do that:
Note that some PACS may be set to refuse to accept SOP classes that they don’t expect.