[Insight-users] Strange thing in itkWatershedImageFilter

Lemeur Yann Yann.Lemeur at stage.cnes.fr
Mon Aug 2 12:48:15 EDT 2004


Hi all!

I'm confronted with a big problem in the GetBasicSegmentation method of the itkWatershedImageFilter.
I tried with the example provided in the Itk package and it seems to be the same problem.
Here is: I want to get the image of the basic segmentation (i.e. the image built with the local minima of the gradient). So in the WatershedSegmentation1.cxx (folder Examples/Segmentation/), I've added the following stuff:

typedef itk::ImageFileWriter<LabeledImageType> LabeledFileWriterType;  // the Labeled Image Type is previosly defined as                                                                                                    								          // a 2D image of unsigned long
typedef itk::RawImageIO<unsigned long,2> RawImageType;

LabeledFileWriterType::Pointer writerLab=LabeledFileWriterType::New();
RawImageType::Pointer io=RawImageType::New();

writerLab->SetFileName("toto.raw");
writerLab->SetImageIO(io);
...............
.............
..............

writerLab->SetInput(watershed->GetBasicSegmentation() );
watershed->Update();


When I read the image toto.raw, it has the right size in bytes but there is a strange thing: it's like the first row and the first column are wrong (see attached image labels.raw which is 181col x 217lines of unsigned long). As you can see, there are a lot of zero-valued pixels (diagonals, first column, first line) which is unusual for a labeled image of the itkWatershedImageFilter...
If I connect this image to a color mapper filter (as made in the example), the .png file written is ok! But in the buffer, there are always zeros (you can check it with iterators on this image).
Strange isn't it?

Yann <<labels.raw>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: labels.raw
Type: application/applefile
Size: 122 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20040802/c0e11d7b/labels.bin


More information about the Insight-users mailing list