[Insight-users] Strange thing in itkWatershedImageFilter

Luis Ibanez luis.ibanez at kitware.com
Mon Aug 2 23:53:01 EDT 2004


Hi Yann,


Please don't use the RawImgaeIO class.

You can simply use the MetaImage file format by
passing an image filename with extension .mhd.


The ImageFileReader will then create files

        toto.mhd
        toto.raw


the .mhd file contains the meta information
about the image, while the .raw file contains
the pixel data in binary format.

You will find details about this in the Data
page of ITK

    http://www.itk.org/HTML/Data.htm


Regards,


    Luis


--------------------
Lemeur Yann wrote:

> 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>> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users






More information about the Insight-users mailing list