[ITK-users] Segfault after SliceBySliceImageFilter

Jonas Teuwen <[email protected]>
Newsgroups gmane.comp.lib.itk.user
Message-ID <CACsn5Gzk7aJnjMwnUVJUUtng=XcbMv03an6udW44o2eiQxzopg@mail.gmail.com>
Hi all,

I wish to apply a filter slice by slice, for which I use
SliceBySliceImageFilter (after the appropriate definitions):

"""
  typedef itk::LaplacianSharpeningImageFilter <ImageType3D,
FloatImageType3D> LaplacianSharpeningImageFilterType;
  LaplacianSharpeningImageFilterType::Pointer
LaplacianSharpeningImageFilter = LaplacianSharpeningImageFilterType::New();
  LaplacianSharpeningImageFilter->SetInput(reader->GetOutput());
  LaplacianSharpeningImageFilter->Update();

  typedef itk::FlatStructuringElement<2> StructuringElementType;
  StructuringElementType::RadiusType AnnulusRadius;
  AnnulusRadius.Fill(10);
  StructuringElementType StructuringElement =
StructuringElementType::Annulus(AnnulusRadius, Thickness, false, false);

  typedef itk::SliceBySliceImageFilter<FloatImageType3D, FloatImageType3D>
SliceFilterType;
  SliceFilterType::Pointer SliceFilter = SliceFilterType::New();

  typedef
itk::GrayscaleDilateImageFilter<SliceFilterType::InternalInputImageType,

SliceFilterType::InternalOutputImageType, StructuringElementType>
GrayscaleDilateImageFilterType;
  GrayscaleDilateImageFilterType::Pointer GrayscaleDilateImageFilter =
GrayscaleDilateImageFilterType::New();
  GrayscaleDilateImageFilter->SetKernel(StructuringElement);

  SliceFilter->SetInput(LaplacianSharpeningImageFilter->GetOutput());
  SliceFilter->SetFilter(GrayscaleDilateImageFilter);
"""
If I write the output of SliceFilter to a file, I get what I expact, but I
do want to compute the minimum between the result and the sharpened image:

  typedef itk::MinimumImageFilter<FloatImageType3D, FloatImageType3D,
FloatImageType3D> MinimumImageFilterType;
  typename MinimumImageFilterType::Pointer MinimumImageFilter;
  MinimumImageFilter->SetInput(0, SliceFilter->GetOutput());
  MinimumImageFilter->SetInput(1,
LaplacianSharpeningImageFilter->GetOutput());

But that immediately segfaults, even before the output is written to disk.
Whichever order, gdb tells me the program crashes at any ->SetInput in the
MinimumImageFilter.
If I on the other hand input a 2D image, and I do not use the
SliceBySliceImageFilter, the program seems to work as expected.

Are there any debugging steps which I could try to find the flaw?

Best,
Jonas

_____________________________________
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://www.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-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.