Using Dicom in root

Hello,
I want to save a Dicom image with root. First of all, is that possible? I found a code, which says to import Dicom like this:

#include "DicomImage.h"

But that doesn’t work. I also tried to save the sourcePos from Singles in an csv and import it in python, that takes a real long time and is not a really nice way to do it. It would be perfect, if anyone has an idea, how to save a Dicom image directly from root.

Thank you a lot!

Dicom “is the international standard to transmit, store, retrieve, print, process, and display medical imaging information”. ROOT does not support this format. But I see there is png to Dicom converter (even online). May be that’s a possible solution?

Yes, I also tried this. But first there is a big information loss, if I make it like this and that’s not ideal. The bigger issue with that is, that I can not open the created image then. If I try to do it with imageJ e.g., I have no chance to open it, because the data structures are not correct.

may be the conversion tool you used was not a good one ? in any case ROOT does not provide such a format.

If I understand your question correctly, you would like to import a file that has been stored in Dicom format into ROOT. I assume to further analyze/manipulate the data with the existing ROOT tools .

Of course that is possible, however ROOT does not contain the necessary software to read/interpret the Dicom format but it is possible by linking it to the package DCMTK (OFFIS DICOM Toolkit) ; it contains the header file

#include "DicomImage.h"

in dcmimgle: an image processing library and utility apps

If after loading your image into ROOT, you use only the DCMTK tools, there is no point loading it into ROOT.

In order to access the DCMTK functionality in ROOT, your “include” statement is not enough but many people on this Forum can guide you through the steps.

-Eddy

ps. I see here a post from 2011 where somebody tried to access Dicom file using Python and manipulate it further in ROOT. Looking here I see that there are now many options in Python to access the Dicom data.

Thank you for your reply!

Actually I want to create a dicom image with root not only reading a dicom image. But I guess, that it’s not possible then. I tried to export the data in an csv file and create a dicom image with pydicom. So far, it’s also not working. Or do I have a huge fallacy and I can not create dicom images out of the root data at all?

I think your easiest access in ROOT to your your dicom file is through Python using one of the dicom Python packages.

Post a small dicom file and one could write an example.

You could use this C++ DICOM library: GitHub - lamyj/odil: Odil is a C++11 library for the DICOM standard

Thank you for your tips. I created a Dicom with pydicom out of an histogram now. If I want to use the raw exported data from root (so the sourcePos in xyz direction), I get error messages, that the arrays are too large (I have about 1.5 Million positions). But I think pydicom in general works now.
Do you know a good tool to reconstruct CT images out of root? I tried to install the astra toolbox, but that hasn’t worked out yet.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.