# question about the last reslice of vtkResliceImageViewer

**URL:** https://discourse.vtk.org/t/question-about-the-last-reslice-of-vtkresliceimageviewer/3238
**Category:** Support
**Created:** [May 7, 2020, 3:43pm UTC](https://discourse.vtk.org/t/question-about-the-last-reslice-of-vtkresliceimageviewer/3238 "2020-05-07T15:43:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yuhuimoon](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/c6cbf5/32.png) [@yuhuimoon](https://discourse.vtk.org/u/yuhuimoon)
#### Post date: [May 7, 2020, 3:43pm UTC](https://discourse.vtk.org/t/question-about-the-last-reslice-of-vtkresliceimageviewer/3238/1 "2020-05-07T15:43:47Z")

</div>

I’m using **vtkResliceImageViewer** to show the volume image. I set the viewer to the **oblique** mode. There are 192 slices in the sagittal direction. When I scroll the viewer to the image by mouse wheel, I can’t get the 192th slice, but only get the 191th slice as the last one. I confirm that I scroll the mouse wheel to the last slice. I check the source code in **vtkResliceImageViewer.cxx**. The function **IncrementSlice()**, which is called in **Execute()** in the class **vtkResliceImageViewerScrollCallback**. The following source, which casue me confused.

 ![2020-05-07_232921](https://discourse.vtk.org/uploads/default/original/2X/7/7720a2763622c91a849067db93a1ab09f80f1000.png)

The bounds of the image is (0, 191, 0, 255, 0, 255). The spacing of the image is (1, 1, 1). When the cursor is at the 192th slice, the c value I get is (191.501, 127.5, 127.5). I know the bounds is different from the actual extent of the image. When I try to scroll to the actual last slice(try to get the 192th slice), the **c[0]** is more than **bounds[1]** (191.501\>191)(The if statement in line590). So the next step can not go into the line 594. Instead of calling SetCenter(), it return out of the function directly. I guess that’s why I can not get 192th slice, and only get the 191th slice as the last slice. If I was wrong, please let me know.

So, I really want to use **vtkResliceImageViewer** to show the image. I still want to use the **oblique** mode and default interaction because it’s very convienious. But how to get and show the actual last slice successfully? If anyone can give me some tips, I will be very appreciated. Thanks in advance.
