OCT-Converter icon indicating copy to clipboard operation
OCT-Converter copied to clipboard

Issue when converting single image Dicom

Open yehudahkay opened this issue 2 years ago • 7 comments

Hi,

Thank you for the great tool! We are using it to convert all the formats however we are noticing that when a dicom file contains only a single image, the tool splits it into many single pixel slices. Do you know how we can prevent this or determine the if dicom is only a single image?

Thank you!

yehudahkay avatar Oct 05 '21 10:10 yehudahkay

In the meantime I found I could determine the number of frames in dcm.py using the following code, however I don't know how to convert a single image dicom. Our application however doesn't require this.

if hasattr(dicom_data, 'NumberOfFrames'):
            self.number_of_frames = dicom_data.NumberOfFrames

yehudahkay avatar Oct 06 '21 11:10 yehudahkay

Hi, I haven't encountered single image slices but agree it would be useful to handle this. If you manage to extend it to handle this case feel free to submit a PR! Thanks, Mark

marksgraham avatar Oct 11 '21 10:10 marksgraham

Hi Mark, it wasn't complicated to change the code to check NumberOfFrames before converting the image, however I found that also pydicom wasn't handling the colors correctly for my test image. I tried the myriad of solutions I saw for this but didn't yet get the image colors to come out correctly. It makes me wonder whether the multiple frame dcms will also have color issues with pydicom.

yehudahkay avatar Oct 11 '21 10:10 yehudahkay

Hi Mark, it wasn't complicated to change the code to check NumberOfFrames before converting the image, however I found that also pydicom wasn't handling the colors correctly for my test image. I tried the myriad of solutions I saw for this but didn't yet get the image colors to come out correctly. It makes me wonder whether the multiple frame dcms will also have color issues with pydicom.

Hey! It would be helpful if you could post your code so far.

AndriasScheuchzeri avatar Jan 16 '22 14:01 AndriasScheuchzeri

I simply used the code I posted above to exit if it isn’t a multi frame dcm, for a single frame dcm I would rather use a different tool which converts the colors correctly

yehudahkay avatar Jan 17 '22 05:01 yehudahkay

I simply used the code I posted above to exit if it isn’t a multi frame dcm, for a single frame dcm I would rather use a different tool which converts the colors correctly

I understand that one - Moreover, I was wondering how you converted them smoothly into 3D .dcm in the first place. Thanks for replying so fast!

AndriasScheuchzeri avatar Jan 23 '22 12:01 AndriasScheuchzeri

Users upload dcm and other oct files to our web app and then we need to display them. I'm using this project to convert them to images and then display them in the browser. We had an issue though where this tool isn't converting the single frame dcm files correctly, so for those I am using our original php nanodicom converter. I did manage to convert single frame dcms using pydicom, however for my test file the colors were not correct and I couldn't find a solution for this.

yehudahkay avatar Jan 23 '22 12:01 yehudahkay

Closing as this seems to be an upstream problem with pydicom

marksgraham avatar Nov 22 '22 15:11 marksgraham