# Slicing operation of VTK or ITK in C++

**URL:** <https://discourse.itk.org/t/slicing-operation-of-vtk-or-itk-in-c/4509>\
**Category:** Beginner Questions\
**Created:** [October 18, 2021, 9:13am UTC](https://discourse.itk.org/t/slicing-operation-of-vtk-or-itk-in-c/4509 "2021-10-18T09:13:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![buyierfei](https://discourse.itk.org/user_avatar/discourse.itk.org/buyierfei/32/2309_2.png) [@buyierfei](https://discourse.itk.org/u/buyierfei)\
**Post date:** [October 18, 2021, 9:13am UTC](https://discourse.itk.org/t/slicing-operation-of-vtk-or-itk-in-c/4509/1 "2021-10-18T09:13:54Z")

</div>

In C++, does the ITK or VTK volume data class contain a numpy-like slicing method?

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [October 18, 2021, 1:02pm UTC](https://discourse.itk.org/t/slicing-operation-of-vtk-or-itk-in-c/4509/2 "2021-10-18T13:02:26Z")

</div>

The [itkSliceImageFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1SliceImageFilter.html) contains much of the same functionality. Using filter provide the benefits of ITK’s pipeline and requested region propagation through upstream filters and IO.

C++'s operator[] does not support the same generality, flexibility and syntactic sugar as Python has.

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [October 27, 2021, 8:23pm UTC](https://discourse.itk.org/t/slicing-operation-of-vtk-or-itk-in-c/4509/3 "2021-10-27T20:23:22Z")

</div>

We could perhaps [make the pixel buffer an xtensor array](https://github.com/InsightSoftwareConsortium/ITK/issues/2844) to provide the NumPy-like interface.
