SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
58 stars 29 forks source link

MR DICOM Writer casts float pixel values to integers #987

Open johannesmayer opened 2 years ago

johannesmayer commented 2 years ago

The DICOM writer stores the pixel values in the DICOMs as 16-bit unsigned integers. Any float value is seemingly cast to an integer.

An SL Phantom written to DICOM will look like the left one where the data in the memory are the right image: image

Should we norm qualitative data to [0,1] and then multiply (2**16 - 1) before writing?

KrisThielemans commented 2 years ago

This really should be handled by the writer code itself (which I don't think is ours?). In PET DICOM and probably also MR, there is an opportunity to have a scale factor and intercept per file. I'm not sure if it's common to use it in MR, so might be dangerous to have different scales per slice as most readers would ignore it.

If we have control over this, I would suggest we do as you suggest, and then put the scale factor in the DICOM header. That way, if we read it back in, we at least get an image back that is the same as the one we wrote.

If we cannot write scale factors in the DICOM header, I guess we have no choice and just live with it. We'd need a warning somewhere that a write/read cycle won't give you the same scale. (This could of course be problematic for iterative recon initialisation, but if there's nothing we can do...).

Might be worth checking what recent Gadgetron does, and raising an issue with them. Of course, that means we still have to fix it ourselves.

@DANAJK might have an opinion on all this