Filter to get data around a point

Which ITK/SimpleITK filter can cut down a bit of volume and let the rest as it is ? To be more specific: user choose a point, 3d point. And I am intend to use this point into a filter that will make a hole around that point plus minus, let say, 20 pixels. Is there any filter that can do that ?

I read all SimpleITK filter: https://simpleitk.readthedocs.io/en/master/filters.html

but I don’t know what filter does like this. Can you guide me a little bit ?

It is unclear what “make a hole around that point…” means. Do you just want to set the pixels/voxels around that voxel to 0, or -1000 (HU value for air)? Why do you need a filter to do this, instead of directly assigning the values as shown below?

import SimpleITK as sitk

img = sitk.Image([256,256,30], sitk.sitkInt16)
index = [40,30,20]
print(img[index])
img[index] = -1000
print(img[index])

It’s a starting point tough …

So, if I go around that 3d point with 20 pixels, and setup Image values to 0, is kind of what I need (for the moment) … but as long I don’t know Python, can you tell me how to access img[40,30,20] in C++ ? I didn’t saw any [] operator here: https://simpleitk.org/doxygen/latest/html/sitkImageOperators_8h_source.html

Using an iterator is the way to go for what you want. For setting value of just one pixel in C++: img->SetPixel(index,-1000);

In order to avoid translating SimpleITK to ITK, is there any way to use an iterator in SimpleITK only ? Or, a way to access that img[40, 30, 20] in SimpleITK ?

https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1Image.html

Ahh, is obvious. Thank you.