# vtkimagereslice does not work when i define z

**URL:** https://discourse.vtk.org/t/vtkimagereslice-does-not-work-when-i-define-z/699
**Category:** Support
**Created:** [April 7, 2019, 2:43pm UTC](https://discourse.vtk.org/t/vtkimagereslice-does-not-work-when-i-define-z/699 "2019-04-07T14:43:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [April 7, 2019, 2:43pm UTC](https://discourse.vtk.org/t/vtkimagereslice-does-not-work-when-i-define-z/699/1 "2019-04-07T14:43:31Z")

</div>

I want to get slices from a volume along a curve with points with vtkimagereslice and get a slice centered in each point and the orientation according to the orientation of these 2 points. The problem is when i define the z as a normal of the plane between x and y. The slice obtained does not make sense but if i do not define z it works excellent. Someone knows how can i define z to obain the same but with thickness. I would like to have z defined in depth z in the output coordinates (y in the original).

Thanks in advance

```auto
center_slice[0] = pts1[0] + (pts2[0] - pts1[0]) / 2;
center_slice[1] = pts1[1] + (pts2[1] - pts1[1]) / 2;
center_slice[2] = pts1[2] + (pts2[2] - pts1[2]) / 2;

reslice->SetOutputExtent(ext);
reslice->SetOutputOrigin(center_slice[0], center_slice[1], 
center_slice[2]);
reslice->UpdateInformation();

//We want plane tangent to the curve
double perpendicular[3] = { (pts2[0] - pts1[0]),(pts2[1] -  
pts1[1]),(pts2[2] - pts1[2]) };
perpendicular[2] = 0;
double *normalizedX = perpendicular;
vtkMath::Normalize(normalizedX);

//Height
double perpendicular2[3] = { 0,0,-1 };
double *normalizedY = perpendicular2;
perpendicular2[1] = 0;
vtkMath::Normalize(normalizedY);

//THE PROBLEM if i add the perpendicular of vector x and y i get something it does not  
//make sense. Like this it works but i do not get thickness
 double normalizedZ[3];
 normalizedZ[0] = 0;
 normalizedZ[1] = 0;
 normalizedZ[2] = 0;

```

}
