Generate digitally reconstructed radiograph from 3DCT

Hello again,

I would like to create some digitally reconstructed radiographs (DRR) in slicer from come 3DCt data that I have to compare to actual radiograph images that I have acquired. I saw one thread here:

that talked about how to do it. At the end, Andras suggested installing the plastimatch module for more realistic DRR generation. I did install this extension (well I installed slicerRT which contains the plastimatch module) but I didn’t see the option anywhere to create a DRR.

Ideally I want to create a DRR at a specified angle and then export it out to matlab (or use the matlab bridge). Any help would be appreciated thanks. Sorry if I missed something obvious

I think Plastimatch DRR generator is not bundled with SlicerRT, so you need to download & install Plastimatch separately and run the tool from the command line. See details in Plastimatch documentation.

1 Like

To extend this question or make it more useful as reference, is there a possibility that I could get the plastimatch drr options normal vector, vup vector and isocenter from the 3D view in Slicer? Meaning I have volume rendering and the desired projection set up in slicer, get these values and create a shot from my volume with command line drr?

That would be extraordinarily useful. I think the information has to be there (in the 3d view settings). Implementing a simple drr shot module based on the command line could be a child’s play. Can you give me a hint where to find the information? Python is no problem.

After more research, I found this:

so this is already possible.

There was some discussion of this in SlicerRT. Maybe a DRR module was added to SlicerRT already.

What kind of DRR would you like to generate and for what purpose?

Greetings,

Platimatch single image mode DRR calculation has been added recently into SlicerRT. See modules description. It is highly recommended to use loadable module “DRR Image Computation”, and create RTBeam in “External Beam Planning” module beforehand to use gantry and patient support rotation angles correctly. SlicerRT issue.

1 Like

Thanks, I will be trying to create DRRs of pelvic anatomy in various projections, hopefully I can get simulated screws in -> convert to label and add to the base CT image, that way possibly I will have a screw like opacity in the DRR.

Thanks very much for the information about SlicerRT, I was not able to get the extension I linked above to work (some VTK error / mismatch with float volume being loaded where short was expected, did not look into it really).

Module is expecting CT volume pixel type as Hounsfield Units aka short type. Can you recast your CT volume from float type into short type (for example using itk::CastImageFilter)?

You can use SlicerRtData for testing (SlicerRtData/eclipse-8.1.20-phantom-prostate at master · SlicerRt/SlicerRtData · GitHub).

In Slicer it is available in “Cast scalar volume” module and in Simple Filters module.

So just to clarify:
The extension that did not work for me was this one: [lancelevine/SlicerDRRGenerator ]

I think it has nothing to do with SlicerRT DRR generation. And I did try to use a short image (ConvertImage from ANTs, but that did not work, now I see the file i generated is INT32 … weird). I gave up on that extension, and started experimenting with SlicerRT, now it has DRR.

But I think I need help with that, see the attached screenshot. I try to align the beam with the screw (actually, with the line between posterior superior iliac spine and the anterior inferior iliac spine, to get the teardrop view, with the screw in the middle), but somehow the geometry of the DRR created is completely detached from the beam. Is the beam not the source for the vector for DRR generation?

And, I will repeat my question, I would actually like to get the vector from the 3D view only, without setting up the beam, to use on command line, can I get the vector somewhere using the python interactor?

The volume renderer can directly generate DRR:

  • Choose CT-X-Ray preset
  • Set 3D view background to black
  • Optional: tune Advanced / Volume properties / Scalar opacity mapping function as needed

The advantage of using the volume renderer for this is that the DRR generation is real-time (hundreds of frames per second if you use a good GPU; but even on an ultrabook without discrete GPU you get 8-10 images per second).

The most suitable method depends on what you are trying to achieve.
What is your overall goal?
What will you use the DRR for - generate image for 2D/3D image registration, training data for a volume reconstructor CNN, …?

1 Like

Beam vector in SlicerRT defined by two points: isocenter and source-axis distance and beam transformation. You can set required isocenter position in “External Beam Planning” module.
image.

Beam transformation can be changed by clicking the “Edit” button on beam node
image.

I would actually like to get the vector from the 3D view only, without setting up the beam

There is no such feature (not yet) in DRR calculation in SlicerRT. May be later.

Hi Mikhail, thanks for the answer. As you can see from the screenshot, the isocenter was set at the screw head and I edited the beam to come from the screw direction. The geometry of the DRR did not correspond to this direction. Please look at the screenshots. You see that the image actually lands outside of the beam, and there is not so much IN the beam. I do not know if it supposed to work like that.

Andras> thanks for the suggestion, this will probably be the easiest way to achieve what I want, which is just illustration of the screw trajectories in spinopelvic fixation.

Amir

Do you mean the image is just bigger than beam jaws, or there is misalignment between DRR image center and the projection of the screw head on the image?

If the latter then it’s a bug (because i have only tested module with DICOM CT data). Can you share your data and describe parameters of the beam with the position of isocenter?

Hmmm… How to install it…? Using Extension Wizard?

Hello,
I want to create DRR image from CT scan.
I found SlicerDRRGenerator, but I don’t know how to install it to Slicer…
I used the Extension Wizard. The extension is not fully installed. The GUI differs from the one in the published paper by the developer.
If the extension is not working, is there any method to create DRR?
Thanks.

You can install extensions using Extensions Manager.

There are several methods, they have all pros and cons, so you can choose the one that best fits your needs:

  • Using volume rendering module: magnitudes faster than any other methods, projection is set up by the 3D view’s camera, you can control properties of the X-ray, materials, and processing in the imaging system using a transfer function
  • SlicerRT: new DRR module in SlicerRT, projection parameters are set up using beams, see above for details
  • Thick slab reformatting using “mean” slab mode: projection parameters uses slice position and normal, can only compute parallel projection, see topic and script for details
  • SlicerDRR generator: I don’t know much about this one, you need to contact the author if you have any questions

I didn’t find the module in Extensions Manager at the beginning…
I spent time learning how to install it via source code…
I found it just now…
Thank you.

1 Like

Hi, I have tried the DRR Generator tool, but there is always showing the error. Do you know how to deal with it?
The error message is below:
" The message detail is:

Exception thrown in event: /Volumes/D/S/S-0-build/ITK/Modules/IO/NRRD/src/itkNrrdImageIO.cxx:1118:

ITK ERROR: NrrdImageIO(0x7f96ce8fbee0): Write: Error writing output_fixed.nrrd:

[nrrd] nrrdSave: couldn’t fopen(“output_fixed.nrrd”,“wb”): Read-only file system"

Wish for your reply!

Hi Mik,

I am running into the same issue that Amir encountered. The DRR doesn’t match the rendering of the beam in the 3D view.

Screenshot
Screenshot 2

I am using file 629 from the VerSe 2020 data set, which is accessible through this link. verse/README.md at main · anjany/verse · GitHub

Here is a screenshot of an .mha export of the DRR in ImageJ.

The isocenter of the beam is positioned at L3 and I verified that the coordinates are correct.
image

Here are the beam parameters
image

And here is the read only Plastimatch command arguments shown in the DRR Image Computation module
plastimatch drr -A cpu
–nrm “1 -3.44509e-16 -1.22465e-16”
–vup “-3.44509e-16 -1 2.22045e-16”
–sad 1120.71 --sid 1411.71
-r “2000 2000”
-z “500 500”
-c “999.5 999.5”
-o “-2 -227 -1190”
-e --autoscale --autoscale-range “0 255”
-i uniform -P preprocess -O Out -t raw