# How to set source to detector distance

**URL:** <https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984>\
**Category:** Uncategorized\
**Created:** [April 21, 2020, 12:09pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984 "2020-04-21T12:09:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![isuruwi](https://discourse.itk.org/letter_avatar_proxy/v4/letter/i/c0e974/32.png) [@isuruwi](https://discourse.itk.org/u/isuruwi)\
**Post date:** [April 21, 2020, 12:09pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/1 "2020-04-21T12:09:39Z")

</div>

Hi,  
I’m currently looking GetDRRSiddonJacobsRayTracing [1] to generate DRR images from 3D-CT volumes. Does this example have a way to set source to detector distance ?

If so can you elaborate with an example.

[1] [https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration/blob/master/test/GetDRRSiddonJacobsRayTracing.cxx](https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration/blob/master/test/GetDRRSiddonJacobsRayTracing.cxx)

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [April 21, 2020, 2:43pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/2 "2020-04-21T14:43:29Z")

</div>

Maybe post this question on [RTK mailing list](https://public.kitware.com/mailman/listinfo/rtk-users). But even posting here, @simon.rit might answer.

---

<div class="post-metadata">

**Author:** ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)\
**Post date:** [April 21, 2020, 2:54pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/3 "2020-04-21T14:54:46Z")

</div>

This is actually not using RTK. The interpolate function which is used [itk::SiddonJacobsRayCastInterpolateImageFunction](https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration/blob/master/include/itkSiddonJacobsRayCastInterpolateImageFunction.h), does not seem to have such an option so I’m guessing the DRR is computed at the isocenter. Changing it to another distance is a simple matter of changing the spacing and the origin of your DRR I suppose.

---

<div class="post-metadata">

**Author:** ![isuruwi](https://discourse.itk.org/letter_avatar_proxy/v4/letter/i/c0e974/32.png) [@isuruwi](https://discourse.itk.org/u/isuruwi)\
**Post date:** [April 21, 2020, 3:05pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/4 "2020-04-21T15:05:14Z")

</div>

I need to add source to detector distance to this code as 1536 mm. In that case how can apply this change ? Could you please help me to figure it out ?

---

<div class="post-metadata">

**Author:** ![Henco](https://discourse.itk.org/letter_avatar_proxy/v4/letter/h/cab0a1/32.png) [@Henco](https://discourse.itk.org/u/Henco)\
**Post date:** [September 8, 2020, 2:31pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/5 "2020-09-08T14:31:16Z")

</div>

@isuruwi If you’re still having this issue, here is my solution. There are two ways to change the source to detector distance (scd) in the GetDRRSiddonJacobsRayTracing.cxx file you linked.

1. you can use a command line input when you call the program from the command line. For example, in the directory with the .exe you could type: “programName.exe -scd 1536 CTVolumeName.nrrd”. This will set the isocenter to 1536 for that one instance of the program.
2. If you’re looking to change the scd inside of the program, on line 109 the scd variable is defined. Changing this from the default 1000.0 to 1536. will cause the program’s default to be set to 1536. All subsequent instances of the program will use 1536 as their default scd

---

<div class="post-metadata">

**Author:** ![Xiaowanzi](https://discourse.itk.org/letter_avatar_proxy/v4/letter/x/b5ac83/32.png) [@Xiaowanzi](https://discourse.itk.org/u/Xiaowanzi)\
**Post date:** [January 13, 2021, 2:38pm UTC](https://discourse.itk.org/t/how-to-set-source-to-detector-distance/2984/6 "2021-01-13T14:38:43Z")

</div>

Hello, but I see the program notes. SCD is the distance from the source to the isocenter. Could it be used directly as the distance from the source to the detector?
