[Insight-users] [insight-users] ConnectedThresholdImageFilter - Memory allocation

Juan Carlos Prieto juanprietob at gmail.com
Thu Mar 4 04:56:58 EST 2010


Hello Insight Users

I just started ITK and I have a problem using the
ConnectedThresholdImageFilter, I have a big image volume as input and then
when performing the update there is a memory allocation problem.

Can some body help me with the procedure on how to execute the filter by
regions (if possible)

A part of my code:

typedef ITKToVTKImageImport::itkImageType InternalImageType;
        InternalImageType* image;
        InternalImageType* imageout;
        typedef itk::ConnectedThresholdImageFilter< InternalImageType,
InternalImageType > ConnectedFilterType;
        ConnectedFilterType::Pointer connectedThreshold;
        InternalImageType::IndexType  index;
        itk::Vector<TypeImage, DIM> spc;

        image = this->getITKImage();    //Huge image input
        connectedThreshold = ConnectedFilterType::New();
        connectedThreshold->SetInput( image );
        connectedThreshold->SetLower(  *_min  );
        connectedThreshold->SetUpper(  *_max  );
        spc = image->GetSpacing();

        index[0] = (*_point)[0]*spc[0];
        index[1] = (*_point)[1]*spc[1];
        index[2] = (*_point)[2]*spc[2];

        connectedThreshold->SetSeed( index );
        connectedThreshold->SetReplaceValue( 255 );
        connectedThreshold->Update();                      //Throws
exception indicating the memory allocation problem
        imageout = connectedThreshold->GetOutput();



Thank you very much
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100304/88ef5af2/attachment.htm>


More information about the Insight-users mailing list