[Insight-users] Watershed with Image<float, 3>

Luis Ibanez luis.ibanez@kitware.com
Fri, 11 Oct 2002 15:13:02 -0400


Hi Harri,

There are two problem with the modifications you are making to the example.

A)  The dimension of the image is specified in two different places in 
this example.
   One is line 96 as you indicated. The second place is line 177 were an 
ImageType
   is defined. This latter image type is then used to instantiate a 
ImageFileWriter.

  The compiler error that you are getting is due to trying to  connect 
an image
  of type

                   itk::Image<float,3>   // Image 3D float

   into an image file writer that is expecting
 
                   itk::Image<float,2>  // Image 2D float


B) The second problem is that this example is saving the result in PNG 
format
    (since the images were 2D).  

   If you change the image types in lines 96 and 177 to 3D, you will 
also have
   to change the section of code that is writing the image to a file. 
PNG is no longer
    an option since it doesn't support 3D images.

   You  may choose to use the RawImageIO class or the MetaImageIO class.


Please let us know if you find any further problems,

Thanks


  Luis




==========================================

Harri Tapio Jaalinoja wrote:

>Hi all,
>
>I'm trying to make a watershed transformation of 3D density data.
>I start by modifying the existing watershed example
>
>Insight/Examples/WatershedSegmentation/itkWatershedSegmentationExample.cxx
>
>To reproduce my problem, go to line 96 and replace
>  typedef itk::Image<float, 2> ImageType;
>with
>  typedef itk::Image<float, 3> ImageType;
>
>When I "make" it, I get:
>
>/home/butcher/Harri/Insight/Examples/WatershedSegmentation/itkWatershedSegmentationExample.cxx:
>In function `int main (int, char **)':
>/home/butcher/Harri/Insight/Examples/WatershedSegmentation/itkWatershedSegmentationExample.cxx:225:
>no matching function for call to `itk::ImageFileWriter<main (int, char
>**)::UnsignedImageType>::SetInput
>(itk::Image<long unsigned int, 3> *)'
>/home/butcher/Harri/Insight/Code/IO/itkImageFileWriter.txx:51:
>candidates are:
>void itk::ImageFileWriter<TInputImage>::SetInput (const TInputImage *)
>[with TInputImage = main (int, char **)::UnsignedImageType]
>make[1]: *** [itkWatershedSegmentationExample.o] Error 1
>make: *** [default_target] Error 2
>
>
>Your help is highly appreciated. I am new to c++, so please bear with me
>if this is trivial :)
>
>Thanks,
>Harri
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-users
>