# How to project model node to different slice view according to their projection geometry

**URL:** <https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218>\
**Category:** Development\
**Created:** [August 18, 2023, 8:34am UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218 "2023-08-18T08:34:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [August 18, 2023, 8:34am UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218/1 "2023-08-18T08:34:08Z")

</div>

I want to get the Projection Slice Intersection of a model node to two slice view.

I have calculated the projection matrix of the 2 images. The projection matrix projects 3D(RAS) coordinate to 2D(image) coordinate.

Is it possible to setup the slice view (or slice node) properties to get the right projection? If not, how can I do that?

---

<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:** [August 18, 2023, 12:11pm UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218/2 "2023-08-18T12:11:44Z")

</div>

You can enable projection of a model node into a slice view in Models module → Display → Slice display → Mode: Projection.

If you want to set this mode programmatically, then you can do that by modifying the display node of the model node:

```python
modelNode.GetDisplayNode().SetVisibility2D(True)
modelNode.GetDisplayNode().SetSliceDisplayModeToProjection()

```

---

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [August 21, 2023, 1:44am UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218/3 "2023-08-21T01:44:41Z")

</div>

`modelNode.GetDisplayNode().SetSliceDisplayModeToProjection()` This line projects the model node to Axial, Coronal and Sagittal plane, however, the image planes are not parallel to these three planes.

The projection geometry is calculated using DLT algorithm and represented by projection matrix. I want to project the model node using the projection matrix, is it possible?

---

<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:** [August 21, 2023, 6:51am UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218/4 "2023-08-21T06:51:24Z")

</div>

You can set slice view planes to any position and orientation, so you can use it for any parallel projection.

If you want to do perspective projection then you can set the transform and the model’s polydata as as inputs in vtkTransformPolyDataFilter and set the result in a new model node for visualization.

If you do stent visualization for augmented/simulated fluroscopy then you may also consider using a 3D view for rendering, as it can render both the DRR and devices in 3D in real-time.

---

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [August 21, 2023, 11:52am UTC](https://discourse.slicer.org/t/how-to-project-model-node-to-different-slice-view-according-to-their-projection-geometry/31218/5 "2023-08-21T11:52:41Z")

</div>

> [@lassoan](#):
>
> You can set slice view planes to any position and orientation

I noticed that there is a method `SetSliceToRASByNTP` to set the position and orientation. However, my image is a 2D image, when the position is not the center of the image or orientation is not perpendicular to the Z-axis(IS axis), part of the image is not visible, just like the screenshots below:

 ![Screenshot from 2023-08-21 19-47-17](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/9/09f160147779095061faf8f9f5837b9273b51bd2.png)

 ![Screenshot from 2023-08-21 19-47-46](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/6/96c465f4d248cd0c7f1d8a021afc28bbd9a4a738.png)

> [@lassoan](#):
>
> If you do stent visualization for augmented/simulated fluroscopy then you may also consider using a 3D view for rendering, as it can render both the DRR and devices in 3D in real-time.

My goal is to do the similar thing but instead of DRR, I’m using a real X-Ray image, so rendering it in 3D view has the similar problem as I mentioned above. How can I solve that?
