- clitk::AndNot<MaskImageType>(S4RL, S2R, GetBackgroundValue());
- clitk::AndNot<MaskImageType>(S4RL, S2L, GetBackgroundValue());
- S4RL = clitk::AutoCrop<MaskImageType>(S4RL, GetBackgroundValue());
+ MaskImagePointType p;
+ // Right part
+ clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2R, GetBackgroundValue(),
+ 2, true, p);
+ S4R = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4R, 2,
+ p[2], true, GetBackgroundValue());
+ // Left part
+ clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2L, GetBackgroundValue(),
+ 2, true, p);
+ S4L = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4L, 2,
+ p[2], true, GetBackgroundValue());