[Insight-users] Failed to allocate memory for image

Luis Ibanez luis.ibanez at kitware.com
Sun Oct 10 16:52:04 EDT 2004


Hi Zhi,

You shouldn't have to deal witht the memory allocation
in order to use the CurvesLevelsetFilter.

Please find below the minimum code that you need in
order to use this filer:

======================================================

typedef itk::Image<float,2> ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;

ReaderType::Pointer reader1 = ReaderType::New();
ReaderType::Pointer reader2 = ReaderType::New();

reader1->SetFileName("InitialLevelSet.hdr");
reader2->SetFileName("EdgePotentialMap.hdr");

typedef itk::CurvesLevelSetImageFilter<
      ImageType, ImageType >   CurvesFilterType;

CurvesFilterType::Pointer curvesFilter = CurvesFilterType::New();

curvesFilter->SetInput(        reader1->GetOutput() );
curvesFilter->SetFeatureImage( reader2->GetOutput() );

curvesFilter->SetPropagationScaling( 1.0 );
curvesFilter->SetCurvatureScaling( 0.1 );
curvesFilter->SetAdvectionScaling( 0.5 );
curvesFilter->SetMaximumRMSError( 0.03 );
curvesFilter->SetNumberOfIterations( 200 );

WriterType::Pointer writer = WriterType::New();
writer->SetFileName("OutputLevelSet.mhd");
writer->SetInput( curvesFilter->GetOutput() );
writer->Update();

==========================================================

For instructions on how to create an EdgePotentialMap,
and an initial level set, please read the Segmentation
chapter of the ITK Software Guide


    http://www.itk.org/ItkSoftwareGuide.pdf


In particular, Section 9.3, pdf-page 363-395.


Regards,


    Luis


----------------------
Zhi Rong Ng wrote:

> Hi,
> 
> I have been trying to implement the curves filter using an ANALYZE
> image as the input but it caught an exception that goes like this ....
> 
> itk::ExceptionObject<0104FC44>
> Location:"ImportImageContainer::AllocateElements"
> FIle: .../.../..itkImportImageContainer.txx
> Line:186
> Description : Failed to allocate memory for image.
> 
> I have went through the header file but I have gotten no clue. Can
> anyone kindly tell me how I can go about solving this ???
> 
> Sorry if I am asking a stupid question but I am rather new to ITK.    
> 
> 






More information about the Insight-users mailing list