# Error in CropImageFilter example

**URL:** <https://discourse.itk.org/t/error-in-cropimagefilter-example/2264>\
**Category:** Uncategorized\
**Created:** [September 25, 2019, 1:42pm UTC](https://discourse.itk.org/t/error-in-cropimagefilter-example/2264 "2019-09-25T13:42:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alessandro\_Pilleri](https://discourse.itk.org/user_avatar/discourse.itk.org/alessandro_pilleri/32/1006_2.png) [@Alessandro\_Pilleri](https://discourse.itk.org/u/Alessandro_Pilleri)\
**Post date:** [September 25, 2019, 1:42pm UTC](https://discourse.itk.org/t/error-in-cropimagefilter-example/2264/1 "2019-09-25T13:42:31Z")

</div>

Hello everybody,  
I was adapting this example to my project: [https://itk.org/Doxygen/html/WikiExamples\_2ImageProcessing\_2CropImageFilter\_8cxx-example.html](https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2CropImageFilter_8cxx-example.html)

But I think that it is wrong within this statement

// The SetBoundaryCropSize( cropSize ) method specifies the size of  
// the boundary to be cropped at both the uppper & lower ends of the  
// image eg. cropSize/2 pixels will be removed at both upper & lower  
// extents  
cropFilter-\>SetBoundaryCropSize(cropSize);

It seems to me that the filter crops “cropSize” pixels from the top and “cropSize” from the bottom, not half of them as the example specify.

I thought It may be interesting for you to check and maybe fix the error in the example.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [September 25, 2019, 3:04pm UTC](https://discourse.itk.org/t/error-in-cropimagefilter-example/2264/2 "2019-09-25T15:04:44Z")

</div>

I created a [PR](https://github.com/InsightSoftwareConsortium/ITKExamples/pull/134) to fix this. Thanks for the report.
