[Insight-users] itkImageMaskSpatialObject segmentation fault

Paolo Zaffino p.zaffino at yahoo.it
Thu Jun 27 16:25:01 EDT 2013


Dear ITK community,
I'm facing a strange ITK behavior.
I wrote this code:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageMaskSpatialObject.h"

int main( int argc, char **argv )
{
   typedef itk::Image<unsigned char,3> ImageType;
   typedef itk::ImageFileReader<ImageType> ReaderType;

   typedef itk::ImageMaskSpatialObject<3> MaskImageType;
   typedef MaskImageType::Pointer MaskTypePointer;

   ReaderType::Pointer reader = ReaderType::New();

   reader->SetFileName( argv[1] );
   reader->Update();

   MaskTypePointer mask = MaskImageType::New();
   mask->SetImage(reader->GetOutput());

   return 0;
}

and it compiles without error.
When I try to run the executable I get a segmentation error (core dumped).
What's is wrong?
I'm using ITK 3.20.1 on a 64 bit Linux box.
If needed I can provide the mask image.

Thanks a lot for your help.
Best regards.
Paolo


More information about the Insight-users mailing list