[ITK] [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/community/attachments/20141209/2444f8f3/attachment.html>
-------------- next part --------------
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list