[ITK-dev] itkImageMaskSpatialObject malloc error

Senan Doyle senan.doyle at gmail.com
Wed Dec 10 17:35:39 EST 2014


Posting the solution in case anyone else encounters this ...

It's a problem concerning Mac+Qt+ITK setups, as solved by Christian Lackas
here:
http://itk-insight-users.2283740.n2.nabble.com/ITK-crash-on-Lion-Qt-td6894083.html

On 9 December 2014 at 03:36, Senan Doyle <senan.doyle at gmail.com> wrote:

>
> 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/20141210/dfc5ea74/attachment-0001.html>


More information about the Insight-developers mailing list