medicalImageLabeler converts single precision nii format image into uint8.

Hello,
We have a bunch of 3D X-ray CT volumes stored in nifTI (.nii) format.
When they are loaded into medicalImageLabeler, it converts the Hounsfield unit (HU) in single precision format, with the range [-1000, 3000], into uint8 format with the range [0, 255].
The value is not preserved, and the conversion depends on the min/max value so we cannot use the same thresholding method for automatic labeling. The classifier MONAI also does not work well with the uint8 format that is not HU.
The images are loaded correctly with niftiread(), only medicalImageLabeler converts the precision automatically.
Did anyone encounter the same problem, and find a way to work around it?

4 Comments

I'm not able to duplicate using a sample data set in MATLAB (lung_027.gz). I found that data here: https://www.mathworks.com/help/medical-imaging/ug/Label-3-d-medical-image-using-medical-image-labeler.html
Here the voxel range is [-1024, 3071] even after being pulled into the Medical image Labeler app.
What are your slope and intercept values?
Hi Cris,
Thank you for the reply!
I see that the example lung file works fine, but mine still does not work.
From the niftiinfo() result of my file, I see that
raw.scl_slope = 1,
raw.scl_inter = 0,
which are the same as the lung example.
I attached the niftiinfo() result of my file for more info.
Could you please take a look and see what is missing?
Again, niftiread() reads the data correctly in the original single precision HU values, but medicalimagelabeler converts the data into 'uint8'.
Can you also provide the ".nii" file so that I can replicate the workflow at my end?
It seems that the inherent volumeViewer converts the image into uint8 depending on the compressibility of the image.
As a minimal reproducible example, I prepared a script that produces a set of synthetic 3D images.
The original image is simple enough that the file size shrinks significantly when compressed.
This image is loaded correctly on the medicalimagelabeler, in its original single precision values, either compressed or not.
However, for the noisy image data, in which AWGN is applied to the original image, medicalimagelabeler converted it into uint8 when loaded.
This is a synthetic example but we have real patient ".nii" data that show the similar behavior, which we cannot share due to NDA.

Sign in to comment.

Answers (1)

I don't see anything in the info that would explain what you are seeing. Could you attach your niifti file?
Either way, I would suggest reporting this to MathWorks by contacting Support: https://www.mathworks.com/support/contact_us.html

Categories

Products

Release

R2024a

Asked:

on 21 Oct 2024

Edited:

on 22 Oct 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!