[ITK-users] Segfault after SliceBySliceImageFilter
Richard Beare
richard.beare at gmail.com
Thu Aug 3 20:05:27 EDT 2017
You haven't created the MinimumImageFilter:
typename MinimumImageFilterType::Pointer MinimumImageFilter =
MinimumImageFilterType::New()
On Fri, Aug 4, 2017 at 8:48 AM, Jonas Teuwen <jonasteuwen at gmail.com> wrote:
> 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 = LaplacianSharpeningImageFilter
> Type::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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170804/61ea76bf/attachment.html>
More information about the Insight-users
mailing list