# how to implement registration between DSA(2d)-CTA(3d) image

**URL:** https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415
**Category:** Beginner Questions
**Created:** [October 14, 2022, 3:33am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415 "2022-10-14T03:33:46Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 14, 2022, 3:33am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/1 "2022-10-14T03:33:46Z")

</div>

Is there any method to register DSA(2d)-CTA(3d) images? For every point in CTA, I want to know the corresponding point in DSA.

I find an example for [2d-3d registration](https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration/blob/master/test/TwoProjection2D3DRegistration.cxx). In this [`ITKTwoProjectionRegistration`](https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration), I don’t know what’s the meaning of `two projection`? I have only one DSA. Can I use this example?

---

<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: [October 14, 2022, 2:22pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/2 "2022-10-14T14:22:52Z")

</div>

The [IJ paper](https://www.insight-journal.org/browse/publication/784) references [IntensityBased2D3DRegistration](https://github.com/InsightSoftwareConsortium/ITKApps/tree/master/IntensityBased2D3DRegistration), complaining that it only does single-projection registration. ITKApps has been discontinued for a long time now, but you could try to revive this particular application. I don’t know whether ITKTwoProjectionRegistration works with a single projection.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 17, 2022, 9:29am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/3 "2022-10-17T09:29:49Z")

</div>

@dzenanz Thanks for your kindly reply. Do you know where can I find the input data `/data/BrainWeb/brainweb165a10f17.mha `

---

<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: [October 17, 2022, 12:55pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/4 "2022-10-17T12:55:19Z")

</div>

That file, along with some other test data, can be found [here](https://data.kitware.com/#folder/57b769c08d777f10f269af3a).

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 18, 2022, 6:52am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/5 "2022-10-18T06:52:02Z")

</div>

@dzenanz `IntensityBased2D3DRegistration` is what I want~~~

But I still have two questions:

1. how to understand `itk::RayCastInterpolateImageFunction`, what’s the meaning of `itk::RayCastInterpolateImageFunction::m_FocalPoint`? Could you please recommand me some information to understand this `ray cast` model?

2. Is there any `InterpolateImageFunction` can obtain the `maximum intensity projection` rather than `ray cast integrate`?

---

<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: [October 18, 2022, 1:25pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/6 "2022-10-18T13:25:17Z")

</div>

[RayCastInterpolateImageFunction](https://itk.org/Doxygen/html/classitk_1_1RayCastInterpolateImageFunction.html)’s docs link to [DigitallyReconstructedRadiograph1.cxx](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/Filtering/) example. That example has a lot of helpful comments. Also read about [perspective projection](https://en.wikipedia.org/wiki/3D_projection).

There is [MaximumProjectionImageFilter](https://itk.org/Doxygen/html/classitk_1_1MaximumProjectionImageFilter.html), looking at its source code might help.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 19, 2022, 2:04am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/7 "2022-10-19T02:04:18Z")

</div>

@dzenanz Can `MaximumProjectionImageFilter` be used in registration? I want a `MIPInterpolateImageFunction` which can replace the `RayCastInterpolateImageFunction`, and be used in 3D-2D registration.

---

<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: [October 19, 2022, 1:09pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/8 "2022-10-19T13:09:41Z")

</div>

`ProjectionImageFilter` does projection only along an axis, it does not do perspective.

But changing [itkRayCastInterpolateImageFunction.hxx](https://github.com/InsightSoftwareConsortium/ITK/blob/v5.2.1/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx#L1319) to do max instead of a sum should not be that hard. You could subclass and only override that method, or change the existing function to have a MIP/accumulate switch.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 20, 2022, 6:16am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/9 "2022-10-20T06:16:56Z")

</div>

@dzenanz Is DSA a perspective or parallel projection to the imaged object? Does `RayCastInterpolateImageFunction` can generate projection image similar to DSA?

---

<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: [October 20, 2022, 12:40pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/10 "2022-10-20T12:40:43Z")

</div>

I assume that digital subtraction angiography uses perspective projection, and that RayCastInterpolateImageFunction emulates that.

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [October 20, 2022, 1:02pm UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/11 "2022-10-20T13:02:17Z")

</div>

Hello @zhang-qiang-github,

The question is mixing two things, camera geometry and how it is used to create the image.

DSA - Digital Subtraction Angiography using a fluoroscope which is commonly modeled as a pin-hole camera, per @dzenanz’s answer. The second step is that two images are acquired, pre-contrast and with contrast. The pre-contrast is subtracted from the contrast.

That being said, when modeling the world we are always using approximations. Depending on the needs, an approximation can be coarse or fine.

You already indicated that you are approximating the subtraction operation by acquiring a single maximal intensity projection. If the focal point of your x-ray machine is very far from the detector it can be reasonably approximated by a parallel projection. With most C-arm based fluoroscopy machines a perspective projection is more appropriate.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)
#### Post date: [October 21, 2022, 1:56am UTC](https://discourse.itk.org/t/how-to-implement-registration-between-dsa-2d-cta-3d-image/5415/12 "2022-10-21T01:56:12Z")

</div>

@dzenanz @zivy Thank you for the nice reply.
