Hi all,<br><br>I am using the CannyEdgeDetectionImageFilter and for small 3D images it works fine. For a bigger image (300x300x512) the following error appears:<br><span style="color: rgb(255, 0, 0);"> itk::ExceptionObject (0153C7B4)</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> Location: "double *__thiscall itk::ImportImageContainer<unsigned long,double>::A</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> llocateElements(unsigned long) const"</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> File: h:\itk\insighttoolkit-3.16.0\code\common\itkImportImageContainer.txx</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> Line: 188</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> Description: Failed to allocate memory for image.</span><br><br>The source code for the filter is:<br><br><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">typedef double RealPixelType;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">typedef itk::Image<RealPixelType, Dimension> RealImageType;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">typedef itk::CastImageFilter<ImageType, RealImageType> CastToRealFilterType;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">typedef itk::RescaleIntensityImageFilter<RealImageType, ImageType> RescaleFilterType;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);"> </span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">typedef itk::CannyEdgeDetectionImageFilter<RealImageType, RealImageType> CannyFilterType; </span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">CastToRealFilterType::Pointer toReal = CastToRealFilterType::New();</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">RescaleFilterType::Pointer rescale = RescaleFilterType::New();</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">CannyFilterType::Pointer cannyFilter = CannyFilterType::New(); </span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">rescale->SetOutputMinimum(0.0);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">rescale->SetOutputMaximum(255.0);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">toReal->SetInput(image);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">cannyFilter->SetInput(toReal->GetOutput());</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">cannyFilter->SetVariance(var);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">cannyFilter->SetUpperThreshold(up*1.0);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">cannyFilter->SetLowerThreshold(low*1.0);</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">rescale->SetInput(cannyFilter->GetOutput());</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">try</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">{</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);"> rescale->Update(); //Filterung</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);"> image = rescale->GetOutput();</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">}</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">catch(itk::ExceptionObject & err)</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">{</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);"> std::cout<< "ExceptionObject caught!"<<std::endl;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 102);"> std::cout<< err << std::endl;</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 102);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 102);">}</span><br style="color: rgb(51, 51, 51);">
<br><br>Does someone know how to avoid this error?<br><br>Thanks a lot and have a nice weekend!<br>Melanie<br>