suyashkumar/dicom

Question: Is it possible to get to individual Pixels in dicom image?

toli opened this issue · 4 comments

toli commented

Hi

back with potentially stupid questions

I am helping out a friend who is a radiologist. He has MRI and CT (computer tomography) images that are in dicom format
Ideally, it'd be able to find a tumor on dicom image (visible with naked eye but need to find it programmatically)
He then applies radioactive isotopes, and later does a Nuclear Medicine scan
What i'd need to is look at NM scan, compare it to initial MRI/CT image and see what % of original tumor got radiation and how much radiation went to healthy liver tissues

So i don't have any dicom image processing experience, and i don't even know if what i want is possible
Ideally, i'd be able to scan the dicom image and find the tumor (bright color, for example)
Is that possible? I looked through the documentation but didn't find anything about getting the pixel

Now, i understand that dicom is usually a collection of images - let's say i have the same tumor scanned from top to bottom, there are about 100 images
is my only option to change one of these vertical dicom images to a regular png and examine to find the tumor (possibly lots of images from up to down)? or is there a different way?

apologies for asking basic questions - if there's some high-level reading i need to do, please let me know, with links if possible

Hi there! Sounds like you need a couple pieces

  1. Tumor Segmentation in a set of CT slices
  2. Registration of the NM slices to the CT image slices (align them in 3D space)
  3. Compute the metric of interest

Doing 1 programmatically will probably require some kind of ML model if the radiologist hasn't already segmented the tumor. You can google CT tumor segmentation to learn more. There are various registration algorithms as well, some ML based and some heuristic based (worth googling with these terms as well).

is my only option to change one of these vertical dicom images to a regular png and examine to find the tumor (possibly lots of images from up to down)? or is there a different way?

it might be easiest to go slice by slice yes, but your model may take in adjacent "context" slices as well for help.

This library could potentially help you preprocess dicom image slices, but if you're going to be doing a lot of modeling work, it may make sense to do the whole project in python (where libraries like pydicom might be helpful).

I have considered potentially building python bindings for this library, but that would only be worth it if there's a performance benefit because IIUC pydicom is pretty complete as it is.

Hope this is a helpful starting point, and good luck!

toli commented
toli commented

back with more questions
I looked at the API, didn't see a way to write one vertical image out (is there once and i'm just blind?)
say i read the file using dicom.ParseFile and then i want to go through and write out all the (PNG?) images that i can vertically for my CAT scan
and then i will process each resuting image to find the tumor

i'd prefer not to switch to python, i have lots more experience with Golang

@suyashkumar Is it possible to write out an image (PNG, JPG, whatever) from DICOM given all the x/y and z values?

Hi @toli sorry for the delay--you'd have to manually get the pixel values out of the PixelDataInfo frames and create your own Golang image--which might be a bit of a pain, but should be doable. Right now there isn't much in the library to do this for you out of the box!