[Insight-users] WatershedImageFilter row misalignment problem (bug?)
Jarek Sacha
jpsacha@poczta.onet.pl
Mon, 20 May 2002 18:11:31 +200
WatershedImageFilter row misalignment problem (bug?)
I was trying to create a very simple program that loads a 2D image
from a file, runs it through a watershed filter, and saves output
(basic segmentation) to a file. The code is something like this:
typedef WatershedImageFilter<InputImageType> WatershedFilterType;
typedef WatershedFilterType::Pointer WatershedFilterPointer;
InputImagePointer inputImage = readImagePNG(inputFileName);
WatershedFilterPointer filter = WatershedFilterType::New();
filter->SetThreshold(0);
filter->SetLevel(1);
filter->SetInput(inputImage);
OutputImagePointer ouputImage = filter->GetBasicSegmentation();
filter->Update();
writeImageRaw(ouputImage, outputFileName);
The problem is that the output image has missaligned raws. Each row is
shifted by one pixel to the right in relation to previous row. This is
probably due to assumption made in WatersheadSegmenter::GenerateData()
method about one pixel padding. However, the WatershedImageFilter
documentation does not mention anything about requiring padding in the
input image.
Not counting the missalignmentm, the segmentation seems to be correct.
Is this a bug in the WatershedImageFilter? Am I setting the
WatershedImageFilter correctly?
Thanks,
Jarek