Re: [ITK-users] Segfault after SliceBySliceImageFilter
Richard Beare <[email protected]>
| Newsgroups | gmane.comp.lib.itk.user |
|---|---|
| Message-ID | <CA+V7QS8=V=jcddQ2qs+7f-RsvOyjnwYHh1QZTMxw=zCuP4ErJQ@mail.gmail.com> |
You haven't created the MinimumImageFilter: typename MinimumImageFilterType::Pointer MinimumImageFilter = MinimumImageFilterType::New() On Fri, Aug 4, 2017 at 8:48 AM, Jonas Teuwen <[email protected]> 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 > > _____________________________________ 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