I have a 3D image and a sphere equation. I need to take out all the voxels that are outside the circle and want to apply a transformation to them. How do I differentiate those points from all the points? I’m not understanding how to actually write the code to access each voxel that satisfies my criteria.
Start from this iterator example. Use image->TransformIndexToPhysicalPoint()
. Apply your sphere equation to physical point coordinates to determine whether a pixel is inside or outside. If you want to modify pixel values, it.Set(newValue);
should do it. Possibly look at other iterator examples.