[ITK-dev] itkImageMaskSpatialObject malloc error

Senan Doyle senan.doyle at gmail.com
Mon Dec 8 21:36:33 EST 2014


Hi,
I'm having trouble with the ImageMaskSpatialObject class
The simple code below produces

malloc: *** error for object 0x109043840: pointer being freed was not
allocated

*** set a breakpoint in malloc_error_break to debug

A quick debugging shows the call to

m_Property = PropertyType::New();

in itkSpatialObject results in the smartpointer destructor for
spatialobject property being called


Anyone seen this before?Any ideas?




int main ( int argc, char* argv[] )

{


    for(int i=0;i<100;i++){

                typedef itk::ImageMaskSpatialObject< 3 >
MaskSpatialObjectType;

        MaskSpatialObjectType::Pointer  spatialObjectMask =
MaskSpatialObjectType::New();


        typedef itk::Image< unsigned char, 3 >   ImageMaskType;


        typedef itk::ImageFileReader< ImageMaskType >    MaskReaderType;

        MaskReaderType::Pointer  maskReader = MaskReaderType::New();

        maskReader->SetFileName( "/some/path/to/mask.nii");

        try

        {

            maskReader->Update();

        }

        catch( itk::ExceptionObject & err )

        {

            std::cerr << "ExceptionObject caught !" << std::endl;

            std::cerr << err << std::endl;

            return 0;

        }


        spatialObjectMask->SetImage( maskReader->GetOutput() );


    }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20141209/2444f8f3/attachment-0001.html>


More information about the Insight-developers mailing list