[Insight-users] error using SliceBySliceImageFilter and WatershedFilter
Sara Rolfe
smrolfe at u.washington.edu
Thu Oct 11 14:54:01 EDT 2012
Hello,
I am attempting to do a slice-by-slice watershed segmentation of a 3D
image. First, I got the watershed segmentation working correctly on a
2D image. Next, I tried to implement it with the
SliceBySliceImageFilter. I connected the SliceBySliceImageFilter to a
pipeline with the gradient filter as the input filter and the
watershed filter as the output. Running gave me a continuous output
of the following error:
WaterShedFilter_SBS(5879,0xa0689720) malloc: *** error for object
0x48c187c: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
...
I have read the article on the slice-by-slice filter http://www.insight-journal.org/browse/publication/133
and have gotten it working with the gradient filter alone and a
pipeline of two gradient filters. However, when I put in the
watershed filter alone or with the gradient filter, I get the above
error. I'd appreciate any advice. An excerpt of my code is below.
Thanks,
Sara
const int inputDim =3;
const int sliceDim =2;
typedef itk::Image<float, inputDim> InputImageType;
typedef itk::Image<unsigned long, inputDim> OutputImageType;
typedef itk::Image<float, sliceDim> SliceFloatImageType;
typedef itk::ImageFileReader< InputImageType > ReaderType;
typedef itk::GradientMagnitudeImageFilter< SliceFloatImageType,
SliceFloatImageType > GradientMagnitudeImageFilterType;
typedef itk::WatershedImageFilter<SliceFloatImageType>
WatershedFilterType;
typedef itk::SliceBySliceImageFilter< InputImageType,
OutputImageType,GradientMagnitudeImageFilterType,
WatershedFilterType > SliceBySliceFilterType;
InputImageType::Pointer inputImage = reader->GetOutput();
GradientMagnitudeImageFilterType::Pointer
gradientMagnitudeImageFilter = GradientMagnitudeImageFilterType::New();
WatershedFilterType::Pointer watershedFilter =
WatershedFilterType::New();
watershedFilter->SetThreshold(threshold);
watershedFilter->SetLevel(level);
watershedFilter->SetInput(gradientMagnitudeImageFilter->GetOutput());
SliceBySliceFilterType::Pointer sliceBySliceFilter =
SliceBySliceFilterType::New();
sliceBySliceFilter -> SetInput(inputImage);
sliceBySliceFilter -> SetInputFilter(gradientMagnitudeImageFilter);
sliceBySliceFilter -> SetOutputFilter(watershedFilter);
sliceBySliceFilter->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121011/a87d9cd6/attachment-0001.htm>
More information about the Insight-users
mailing list