suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
943 stars 137 forks source link

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

Open toli opened 1 year ago

toli commented 1 year ago

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

suyashkumar commented 1 year ago

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 1 year ago

This is helpful Thanks for the ideas

toli commented 1 year ago

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?

suyashkumar commented 4 months ago

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!