FNNDSC / med2image

Converts medical images to more displayable formats, e.g. NIfTI to jpg.
MIT License
185 stars 56 forks source link

Incorrect scale after image convert #38

Open toby-cnr opened 2 years ago

toby-cnr commented 2 years ago

The output image dimension for coronal and sagittal (x and y axis) were all squeezed to incorrect shape. In my case, the 512x512 image becomes 512x120. Is there any way to ensure the output scale or dimension? Really appreciate if anyone could help. I have been finding a solution for days with no luck. Thank you.

rudolphpienaar commented 2 years ago

What is your exact CLI? Also, do you have a sample input?

rudolphpienaar commented 2 years ago

Is there anyway you can anon your input? Is it a volume or a single image? It's going to be much easier to debug with your actual edge case than otherwise.

Do you get the same for other inputs, etc?

Best

On Thu, 2022-01-20 at 04:12 -0800, Toby Lam wrote:

What is your exact CLI? Also, do you have a sample input?

Basically, I just want to be able to convert a nii or dicom file to jpg or png. I tried using the below command with reslice as I need all the [x,y,z] positions. med2image -i sample.nii -d output -o sample --outputFileType jpg -- sliceToConvert -1 --showSlices --reslice

I cannot give you the output or original file as I contains the personal information. I have created a mask for demo purpose. Input: https://github.com/toby-cnr/dicom/raw/main/sample.png  Output: https://github.com/toby-cnr/dicom/raw/main/output.jpg

The output image is in 512x120 but that is different from what I see from other DICOM viewer tools like ITK-SNAP I used. Other issues includes:

  1. Image flipped in the wrong direction
  2. The output was corrupted with horizontal lines for every images

Much appreciated if anyone could give me some advise as I am not a developer/programmer and I just want to be able to extract all the slices to jpg/png in the same orientation I view from the general 3d medical imaging tools e.g. Slicer or ITK-SNAP. Would it be any settings in any other tools to make sure the orientation and scale is correct? Thank you.

rudolphpienaar commented 2 years ago

I mean the best way to debug this is for you to send me your actual datafile since this hasn't happened before to my/our knowledge. I was asking if you could anonymize your input file and thus be willing to share it.

Sometimes NIfTIs can have a weird slice that is has a different "size" than other slices in a volume.

Best

On Thu, 2022-01-20 at 07:43 -0800, Toby Lam wrote:

@rudolphpienaar It is a volume. You may find the metadata below: https://github.com/toby-cnr/dicom/raw/main/info.png https://github.com/toby-cnr/dicom/raw/main/metadata.png https://github.com/toby-cnr/dicom/raw/main/metadata2.png And same result on the coronal and sagittal output for all other nii/dicom files. For input anon, what does that mean? And would there be any other sample nii files with [512x512x120] dimension that I can try and compare? Thanks a lot for your help.