# The extent of vtkResliceCursorRepresentation output.

**URL:** <https://discourse.vtk.org/t/the-extent-of-vtkreslicecursorrepresentation-output/13978>\
**Category:** Development\
**Tags:** code\
**Created:** [June 4, 2024, 11:02am UTC](https://discourse.vtk.org/t/the-extent-of-vtkreslicecursorrepresentation-output/13978 "2024-06-04T11:02:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@leo](https://discourse.vtk.org/u/leo)\
**Post date:** [June 4, 2024, 11:02am UTC](https://discourse.vtk.org/t/the-extent-of-vtkreslicecursorrepresentation-output/13978/1 "2024-06-04T11:02:53Z")

</div>

The vtkResliceCursorRepresentation::UpdateReslicePlane() sets extentX/extentY to a power of 2 may cause the program to slow down when the center is moved to the edge of the image, where extent may be 2048. I would like to ask if extent has to be a power of 2? What are the considerations for this?

```auto
void vtkResliceCursorRepresentation::UpdateReslicePlane()
{
  ...

  double realExtentX = (spacingX == 0) ? VTK_INT_MAX : planeSizeX / spacingX;

  // Sanity check the input data:
  // * if realExtentX is too large, extentX will wrap
  // * if spacingX is 0, things will blow up.
  if (realExtentX > (VTK_INT_MAX >> 1))
  {
    vtkErrorMacro(<< "Invalid X extent: " << realExtentX);
    extentX = 0;
  }
  else
  {
    extentX = 1;
    while (extentX < realExtentX)
    {
      extentX = extentX << 1;
    }
  }
  ...
}

```

---

<div class="post-metadata">

**Author:** ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)\
**Post date:** [June 6, 2024, 11:44am UTC](https://discourse.vtk.org/t/the-extent-of-vtkreslicecursorrepresentation-output/13978/2 "2024-06-06T11:44:09Z")

</div>

Some GPUs and platforms only supports power of 2 images, I guess this was the reason but I am not sure this is still true on modern GPUs.  
  
However I don’t understand why you report that it will be slower depending on the center position, the position of the center should not have influence on the size of the plane, but I might be missing something

---

<div class="post-metadata">

**Author:** ![leo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@leo](https://discourse.vtk.org/u/leo)\
**Post date:** [June 7, 2024, 2:31am UTC](https://discourse.vtk.org/t/the-extent-of-vtkreslicecursorrepresentation-output/13978/3 "2024-06-07T02:31:25Z")

</div>

Thanks for the reply, you’ve made me realize that maybe our design doesn’t make sense and I need to recheck it.
