# Inserting an image under the interactive plot

**URL:** <https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737>\
**Category:** Development\
**Tags:** plots\
**Created:** [February 1, 2022, 7:01pm UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737 "2022-02-01T19:01:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![armandanesh](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@armandanesh](https://discourse.slicer.org/u/armandanesh)\
**Post date:** [February 1, 2022, 7:01pm UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/1 "2022-02-01T19:01:10Z")

</div>

Hello,

I was wondering if there would be a way in order to get the interactive plot to work over an image. For example, to have a cartesian grid overlay a particular image such that we can plot points on particular positions on the image? Thank you in advance for your response.

Best,  
Arman

---

<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:** [February 2, 2022, 2:49am UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/2 "2022-02-02T02:49:13Z")

</div>

Can you draw a sketch that shows what you would like to get as an end result?

---

<div class="post-metadata">

**Author:** ![armandanesh](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@armandanesh](https://discourse.slicer.org/u/armandanesh)\
**Post date:** [February 2, 2022, 6:35am UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/3 "2022-02-02T06:35:38Z")

</div>

So this is just a rough image I pulled off google but essentially I am asking if it would be possible to have an interactive scene where instead of having a white background, the background is actually an image of our choice with the cartesian grid on top of it. For example, can it be an ultrasound image as the background of the interactive scene and we plot points on top of it?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/4/d499aa9df62ce2f5b72bf21057241036a3bddaa2.jpeg)

---

<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:** [February 2, 2022, 1:23pm UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/4 "2022-02-02T13:23:44Z")

</div>

You need to add an actor to the VTK renderer for this.

For augmented reality applications you can display a background planar image as siren in this example: [https://kitware.github.io/vtk-examples/site/Python/Images/BackgroundImage/](https://kitware.github.io/vtk-examples/site/Python/Images/BackgroundImage/)

For displaying the 3D content in immersive environment you can display a skybox: [https://kitware.github.io/vtk-examples/site/Cxx/Rendering/PBR\_Skybox](https://kitware.github.io/vtk-examples/site/Cxx/Rendering/PBR_Skybox)

See how to access the VTK renderer here: [Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html)

Alternatively, you can add lines over the 3D content using 2D actors.

---

<div class="post-metadata">

**Author:** ![armandanesh](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@armandanesh](https://discourse.slicer.org/u/armandanesh)\
**Post date:** [February 2, 2022, 4:37pm UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/5 "2022-02-02T16:37:43Z")

</div>

Hello,

Thank you so much!!! Just to confirm, this allows me to insert a 2d image as the background of the 2d interactive scene containing the cartesian grid, correct?

---

<div class="post-metadata">

**Author:** ![armandanesh](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@armandanesh](https://discourse.slicer.org/u/armandanesh)\
**Post date:** [February 2, 2022, 9:31pm UTC](https://discourse.slicer.org/t/inserting-an-image-under-the-interactive-plot/21737/6 "2022-02-02T21:31:59Z")

</div>

![Screen Shot 2022-02-02 at 4.27.31 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/d/0da7e3c5d6e88274a2a434daf8cfa8dcd9011b5e.png)  
For reference, I am talking about changing the background on the top right scene.
