[ITK] [ITK-users] Segfault after SliceBySliceImageFilter

Jonas Teuwen jonasteuwen at gmail.com
Thu Aug 3 18:48:01 EDT 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170804/81983635/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://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


More information about the Community mailing list