[Insight-users] simpleitk ipython notebook "Failed to allocate memory for image."

Bradley Lowekamp brad at lowekamp.net
Thu Oct 31 23:52:18 EDT 2013


I believe the crop filter takes the sizes the upper and lower
boundaries are reduced not the index:

http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1CropImageFilter.html

Likely there is a lack out out of bounds checking in ITK resulting in
some under flow.

> On Oct 31, 2013, at 11:18 PM, jmerkow <jmerkow at gmail.com> wrote:
>
> I am trying to Crop an image using sitk.Crop.  I get this error:
>
> ....SimpleITK-build/ITK-prefix/include/ITK-4.3/itkImportImageContainer.hxx:191:
> Failed to allocate memory for image.
>
>
> Code:
> # Extract 2D slice of image
> index = [0,0,idx[2]]
> newsize = list(img_T1.GetSize())
> newsize[2] = 0
> islice = sitk.Extract(img_T1_255,newsize,index)
> #myshow(islice)
> #plot(idx1[0],idx1[1],'r.')
> # Extract Crop
> center =[idx[0],idx[1],0]
> dx = 50
> dy = 50
> boxer = np.array([dx,dy,0],int)
> low= list(center - boxer)
> up = list(center + boxer)
> print low,up
> islice = sitk.Crop(islice,(180,350,0),(210,380,0))
> myshow(islice)
>
>
> Later on I allocate new images for segmentation (i.e. gradient etc) on the
> full image, so I don't think its a memory issue?
>
> Jameson
>
>
>
> --
> View this message in context: http://itk-users.7.n7.nabble.com/simpleitk-ipython-notebook-Failed-to-allocate-memory-for-image-tp32663.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list