# How to Create shadows of the segments?

**URL:** <https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406>\
**Category:** Support\
**Created:** [July 5, 2023, 12:16pm UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406 "2023-07-05T12:16:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [July 5, 2023, 12:16pm UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/1 "2023-07-05T12:16:54Z")

</div>

Dear Developers and Users

I want to create an image, with a certain matrix and pixel sizes, of the shadows of the segments in RTSTRUCTURE (one of the inputs used in SlicerRT) on a plan at a distance of 160 cm from the target and perpendicular to the central axis of beam.

Please suppose that I want the matrix size of this image to be equal to 1024x1024 and pixel size to be equal to 0.4x0.4 mm.

It is assumed that the source of producing these shadows is the target of the linear accelerator (LINAC).  
I have shown this in the following figure.

 ![YellowPlan](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/4/e44ae11a060bc26eb0b5708b5ae8d09367ea0104.png)

In this figure, the radiation field (Beam) is seen in green. The plane I talked about is displayed in yellow.

At this figure, the segments that I want shadows to be created on this plan include the following:

RightLungCTNormal,  
LeftLungCTNormal,  
HEARTCTNormal,  
CTVCTNormal and  
LADCTNormal

I want the pixel value of each shadow area of the segments to be specific and different from the other.

Please guide me.

Best regards.

Shahrokh

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 7, 2023, 9:03am UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/2 "2023-07-07T09:03:52Z")

</div>

Hi Shahrokh,

This is an interesting problem. The first thing that occurs me is to check out the implementation of the “Markups perspective projection on the imager plane” part of the DRR Image Computation module, maybe it is easy to extend it to projections of segments.

FYI there is an RT planar image class in SlicerRT, probably it would make sense to use that instead of the model node.

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [July 7, 2023, 9:59am UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/3 "2023-07-07T09:59:55Z")

</div>

Hi Csaba

Thank you very much for your advice.  
I will definitely check this issue, tomorrow.

I want to calculate the dose distribution inside the shadows of the segments at the EPID position and then plot the curve of dose versus area.

I converted DRR and EPID images to absorbed dose distribution.

Best regards.  
Shahrokh.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 7, 2023, 11:30am UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/4 "2023-07-07T11:30:21Z")

</div>

I’m not sure if it helps, but you can add segments to a volume (using Mask volume effect) and then simulate an EPID image using DRR.

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [July 7, 2023, 1:09pm UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/5 "2023-07-07T13:09:39Z")

</div>

Hello Andras

This is also an interesting and creative method. Based on this, I can create (or projects) from the segments added to volume.

Best regards.  
Shahrokh

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [July 8, 2023, 11:56am UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/6 "2023-07-08T11:56:31Z")

</div>

Hello Csaba and Andras

Thank you very much again for your guidance.

As you suggested, I tried to use the **DRR Image Computation** module. I have the SlicerRT module on Slicer version 5.0.2 r30822.  
Unfortunately, I do not find **Markups perspective projection on the imager plane** part in the module of **DRR Image Computation**.

Anyway at first, I used Andras’ guide by converting the Segment to Volume with the **Mask Volume Effect** in the **Segment Editor** module, as shown in below:

 ![figure01](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/a/4add5fa75b9956097f7dd2ca63a4021a68a33cd3.png)

Then I converted _LabelMapVolumeCTVCTNormal_ to Volume in the **Volumes** module. I renamed _LabelMapVolumeCTVCTNormal_ to _CTVCTNormalVolume_.

In the last step, I used the **DRR Image Computation** module. The settings made in this module are shown in the figure below:

 ![figure02](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/0/d02dfafb24a5dac43b879cc9115ec423c14de417.png)

As you can see in the above figure, I don’t see an the part of **Markups perspective projection on the imager plane** in this module.  
In this regard, where can I use (or tick) this part in this module?

Anyway, I get the following DRR image.

 ![figure03](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/5/c51e2b4e994e677296ac6d0bdb795590bb4a05ee.png)

The pixel value range in this DRR image is between -255 and zero.

Because I want an the accurate shadow of the segments in the form of a binary image (with sharp edges and no penumbra), the only way I can think of is to use Effects in the **Segment Editor** module; as following:

1- Threshold Effect  
Threshold range -255 to -255  
2- Logical Operators  
Operation: Invert  
3- Mask Volume.  
Outside fill value: 0  
Inside fill value: 1

 ![figure04](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/5/e57aed18a2851353944ee4e090ca5a7acecbde19.png)

Result:

 ![figure05](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/1/01b176807a447994411763733e511e58b2ba87fe.png)

Here is a question for me:

Can this final image be the geometric shadow of the segment of CTVCTNormal?

Please guide me.  
Best regards.  
Shahrokh.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 9, 2023, 8:48am UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/7 "2023-07-09T08:48:13Z")

</div>

You use a Slicer version that is years old, so many features we now have are missing. Please update.

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [July 18, 2023, 12:19pm UTC](https://discourse.slicer.org/t/how-to-create-shadows-of-the-segments/30406/8 "2023-07-18T12:19:56Z")

</div>

Hi Csaba

Thank you very much for your advice.  
Unfortunately, I did not succeed. I am trying to create the desired segment shadow in the imager position according to your guidance using **Markups perspective projection on the imager plane** part of the DRR Image Computation module.
