# How to use the slice command to visualize one image into two intersecting planes?

**URL:** <https://discourse.slicer.org/t/how-to-use-the-slice-command-to-visualize-one-image-into-two-intersecting-planes/27005>\
**Category:** Support\
**Created:** [January 1, 2023, 6:06pm UTC](https://discourse.slicer.org/t/how-to-use-the-slice-command-to-visualize-one-image-into-two-intersecting-planes/27005 "2023-01-01T18:06:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yousef\_Abohamra](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yousef_abohamra/32/14684_2.png) [@Yousef\_Abohamra](https://discourse.slicer.org/u/Yousef_Abohamra)\
**Post date:** [January 1, 2023, 6:06pm UTC](https://discourse.slicer.org/t/how-to-use-the-slice-command-to-visualize-one-image-into-two-intersecting-planes/27005/1 "2023-01-01T18:06:42Z")

</div>

Hi, I need to visualize one image in two intersecting planes. The attached picture shows an example of what I want to do. However, it uses an equation (V = X.\*exp(-X.^2-Y.^2-Z.^2)😉 while I want to insert my image instead.

[X,Y,Z] = meshgrid(-2:.2:2);

V = X.\*exp(-X.^2-Y.^2-Z.^2);

xslice = 0;

yslice = ;

zslice = 0;

slice(X,Y,Z,V,xslice,yslice,zslice)  
I’m using MATLAB but if it is easier to do it using 3D slice or any other software that will be fine for me.

Operating system:Windows  
Slicer version:I di not download it  
Expected behavior:

 ![112](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/8/c8f8e67f3d4b32b4272d4a52abd723c4458fabbe.png)

Actual behavior:

---

<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:** [January 3, 2023, 3:21am UTC](https://discourse.slicer.org/t/how-to-use-the-slice-command-to-visualize-one-image-into-two-intersecting-planes/27005/2 "2023-01-03T03:21:04Z")

</div>

You can fill an array based on a 3D function in Python very similar as in Matlab, and then you can visualize the volume in Slicer by a few more additional lines:

```python
# Create 3D array V containing 3D function value
import numpy as np
X, Y, Z = np.meshgrid(np.arange(-2, 2, 0.2), np.arange(-2, 2, 0.2), np.arange(-2, 2, 0.2))
V = -X **2-Y** 2-Z**2

# Create a Slicer volume node form the numpy array
volumeNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLScalarVolumeNode')
slicer.util.updateVolumeFromArray(volumeNode, V)

# Adjust visualization options
# Set color table to Viridis
volumeNode.CreateDefaultDisplayNodes()
volumeNode.GetDisplayNode().SetAndObserveColorNodeID('vtkMRMLColorTableNodeFileViridis.txt')
# Show volume in slice views
slicer.util.setSliceViewerLayers(background=volumeNode)

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/0/401f798023c2ac3004763baee9554ff6c963851e.png)

---

<div class="post-metadata">

**Author:** ![Yousef\_Abohamra](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yousef_abohamra/32/14684_2.png) [@Yousef\_Abohamra](https://discourse.slicer.org/u/Yousef_Abohamra)\
**Post date:** [January 4, 2023, 1:57am UTC](https://discourse.slicer.org/t/how-to-use-the-slice-command-to-visualize-one-image-into-two-intersecting-planes/27005/3 "2023-01-04T01:57:13Z")

</div>

Thank you, Andras.

 ![12](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/8/28fbc17619a3f0e9c995cb7b669fc16c32bb8c65.png)  
I want to use images instead of the plane equation. Please have a look at the attached picture.
