# (vtkmodules.vtkImagingCore.vtkImageReslice)0x7f580e63ec20

**URL:** https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710
**Category:** Support
**Created:** [September 27, 2021, 11:13pm UTC](https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710 "2021-09-27T23:13:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aleena98](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@aleena98](https://discourse.vtk.org/u/aleena98)
#### Post date: [September 27, 2021, 11:13pm UTC](https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710/1 "2021-09-27T23:13:35Z")

</div>

I am trying to understand a code to generate MIPs for nifti format images  
could you please help me with:  
\*\*(vtkmodules.vtkImagingCore.vtkImageReslice)0x7f580e63ec20 \*\*  
what exactly is this line

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [September 28, 2021, 12:26pm UTC](https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710/2 "2021-09-28T12:26:16Z")

</div>

How is this line being created? Can you share your code?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 28, 2021, 1:15pm UTC](https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710/3 "2021-09-28T13:15:10Z")

</div>

That’s the repr() of a VTK object in the Python wrappers. It’s the type and address of the object.

```python
Python 3.8.10 (default, Jun 2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> reslice = vtk.vtkImageReslice()
>>> reslice
(vtkmodules.vtkImagingCore.vtkImageReslice)0x7f962eb526a0

```

---

<div class="post-metadata">

### Author: ![aleena98](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@aleena98](https://discourse.vtk.org/u/aleena98)
#### Post date: [September 28, 2021, 1:39pm UTC](https://discourse.vtk.org/t/vtkmodules-vtkimagingcore-vtkimagereslice-0x7f580e63ec20/6710/4 "2021-09-28T13:39:54Z")

</div>

image\_path = “/content/drive/MyDrive/10001.zip (Unzipped Files)/10001/orig/TOF.nii.gz”  
reader = vtk.vtkNIFTIImageReader()  
reader.SetFileName(image\_path)  
reader.SetDataExtent(0, 63, 0, 63, 1, 93)  
reader.SetDataSpacing(3.2, 3.2, 1.5)  
reader.SetDataOrigin(0.0, 0.0, 0.0)  
reader.SetDataScalarTypeToUnsignedShort()  
reader.UpdateWholeExtent()  
#reader.TimeAsVectorOn()  
reader.Update()  
(xMin, xMax, yMin, yMax, zMin, zMax) = reader.GetExecutive().GetWholeExtent(reader.GetOutputInformation(0))  
(xSpacing, ySpacing, zSpacing) = reader.GetOutput().GetSpacing()  
(x0, y0, z0) = reader.GetOutput().GetOrigin()

center = [x0 + xSpacing \* 0.5 \* (xMin + xMax),  
y0 + ySpacing \* 0.5 \* (yMin + yMax),  
z0 + zSpacing \* 0.5 \* (zMin + zMax)]  
axial = vtk.vtkMatrix4x4()  
axial.DeepCopy((1, 0, 0, center[0],  
0, 1, 0, center[1],  
0, 0, 1, center[2],  
0, 0, 0, 1))

coronal = vtk.vtkMatrix4x4()  
coronal.DeepCopy((1, 0, 0, center[0],  
0, 0, 1, center[1],  
0,-1, 0, center[2],  
0, 0, 0, 1))

sagittal = vtk.vtkMatrix4x4()  
sagittal.DeepCopy((0, 0,-1, center[0],  
1, 0, 0, center[1],  
0,-1, 0, center[2],  
0, 0, 0, 1))

oblique = vtk.vtkMatrix4x4()  
oblique.DeepCopy((1, 0, 0, center[0],  
0, 0.866025, -0.5, center[1],  
0, 0.5, 0.866025, center[2],  
0, 0, 0, 1))  
reslice = vtk.vtkImageReslice()  
reslice.SetInputConnection(reader.GetOutputPort())  
reslice.SetOutputDimensionality(2)  
reslice.SetResliceAxes(sagittal)  
reslice.SetInterpolationModeToLinear()

table = vtk.vtkLookupTable()  
table.SetRange(0, 2000) # image intensity range  
table.SetValueRange(0.0, 1.0) # from black to white  
table.SetSaturationRange(0.0, 0.0) # no color saturation  
table.SetRampToLinear()  
table.Build()

color = vtk.vtkImageMapToColors()  
color.SetLookupTable(table)  
color.SetInputConnection(reslice.GetOutputPort())  
actor = vtk.vtkImageActor()  
actor.GetMapper().SetInputConnection(color.GetOutputPort())

renderer = vtk.vtkRenderer()  
renderer.AddActor(actor)

window = vtk.vtkRenderWindow()  
window.AddRenderer(renderer)

This is the code it is causing to crash the runtime after actor.GetMapper().SetInputConnection(color.GetOutputPort())
