[Insight-users] CannyEdgeDetectionImageFilter: Failed to allocate memory for image

Melanie Uks meluks2010 at googlemail.com
Fri Mar 11 08:04:44 EST 2011


Hi all,

I am using the CannyEdgeDetectionImageFilter and for small 3D images it
works fine. For a bigger image (300x300x512) the following error appears:
  itk::ExceptionObject (0153C7B4)
  Location: "double *__thiscall itk::ImportImageContainer<unsigned
long,double>::A
  llocateElements(unsigned long) const"
  File: h:\itk\insighttoolkit-3.16.0\code\common\itkImportImageContainer.txx
  Line: 188
  Description: Failed to allocate memory for image.

The source code for the filter is:

typedef double RealPixelType;
typedef itk::Image<RealPixelType, Dimension> RealImageType;

typedef itk::CastImageFilter<ImageType, RealImageType> CastToRealFilterType;
typedef itk::RescaleIntensityImageFilter<RealImageType, ImageType>
RescaleFilterType;

typedef itk::CannyEdgeDetectionImageFilter<RealImageType, RealImageType>
CannyFilterType;
CastToRealFilterType::Pointer toReal = CastToRealFilterType::New();
RescaleFilterType::Pointer rescale = RescaleFilterType::New();
CannyFilterType::Pointer cannyFilter = CannyFilterType::New();

rescale->SetOutputMinimum(0.0);
rescale->SetOutputMaximum(255.0);
toReal->SetInput(image);
cannyFilter->SetInput(toReal->GetOutput());
cannyFilter->SetVariance(var);
cannyFilter->SetUpperThreshold(up*1.0);
cannyFilter->SetLowerThreshold(low*1.0);
rescale->SetInput(cannyFilter->GetOutput());

try
{
    rescale->Update(); //Filterung

    image = rescale->GetOutput();
}
catch(itk::ExceptionObject & err)
{
     std::cout<< "ExceptionObject caught!"<<std::endl;
     std::cout<< err << std::endl;
}


Does someone know how to avoid this error?

Thanks a lot and have a nice weekend!
Melanie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110311/e6b9eb15/attachment.htm>


More information about the Insight-users mailing list