Fw: [Insight-users] Converting Image Data to Vector type

Samuel Rodríguez Bescos srodrigu at gbt . tfo . upm . es
Mon, 5 Aug 2002 12:02:07 +0200


Thanks Luis for your help.

 Your second reply solves my problem. But My first question in not the same
that you think. I have a grey scale images and I want to use the gibbs
segmentation filter. This filter need  a mask of the estimation of my object
and I want to use the gaussian classifier. I noticed that this filter need
the input in vector format. furthermore I want to read my image in .PNG
format and I think that It not  posible to read a gray-scale image in .PNG
format with pixels like  vectors of one dimension. Maybe I can't explain you
enough clearly, I'm sorry for that but my English is not so good.

Thank for your help. It very useful for me,

Samuel

----- Original Message -----
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: <srodrigu@gbt.tfo.upm.es>
Cc: <insight-users@public.kitware.com>
Sent: Friday, August 02, 2002 8:53 PM
Subject: Re: Fw: [Insight-users] Converting Image Data to Vector type


>
> Hi Samuel,
>
>
>  From your first answer I understand that you have a set
> of N .png files each one containing a gray-scale image
> and you want to load them into a itkImage with a
> ND vector as pixeltype. Is that right ?
>
> Here are two options:
>
> 1) use Image Adaptors.
>
> 2) use a two stage process : load the N image
>     and then copy their content to a Vector image.
>
> Option (1) will probably work better with the pipeline
> update mechanism.
>
> Please take a look at the class
>
http://www.itk.org/Insight/Doxygen/html/classitk_1_1NthElementImageAdaptor.h
tml
>
> It can be found at:
>
> Insight/Code/Common/itkNthElementImageAdaptor.h
>
> An example of the use of adaptors can be seen at:
>
>    Insight/Testing/Code/BasicFilters/itkImageAdaptorNthElementTest.cxx
>
> --------
>
> About the second answer:
>
> If you already have a labeled image and just want to reduce this
> one to a 1,0 images, the BinaryThresholdImageFilter:
>
http://www.itk.org/Insight/Doxygen/html/classitk_1_1BinaryThresholdImageFilt
er.html
>
> (as you pointed out) should solve the problem.
>
> This filter expect you to define lower and upper values
> for a gray-level range. Then the image is filtered and all
> the pixels with values outside this range will be mapped to
> an "OutsideValue" (provided by the user) while the pixels
> with values inside the range will be mapped to an "InsideValue".
>
> Something like the following code should do it:
>
>    binaryFitler.SetInput( myLabelFilter.GetOutput() );
>    binaryFilter.SetOutsideValue( 0 );
>    binaryFilter.SetInsideValue( 1 );
>    binaryFilter.SetUpperThreshold(myLabel+1);
>    binaryFilter.SetLowerThreshold(myLabel-1);
>
>    binaryFitler.Update();
>
>
> assuming that myLabelFilter is the one that label your image
> and the "myLabel" value is the one you are interested on.
>
>
> Please let us know if that helps.
>
> Thanks,
>
>    Luis
>
>
> =====================================================
> >>Hello Luis,
> >>
> >>The anwers for your questions,
> >>
> >>1) I want to read a .png image file into a vector image.The problem is
> >>
> > that
> >
> >>I'm using the Gibbs filter with a Gaussian estimator and the last one
> >>
> > needs
> >
> >>to have the input as vector image. I'm using grey-scales images.
> >>
> >>2) For the second question: I'm using the watershed class to segment an
> >>image of a slice of the human abdomen (the liver zone of the human
body).
> >>The output is an image with labeled  pixels. I want to create a new
image
> >>selecting the pixels that have the same label and the get one object.I
> >>
> > think
> >
> >>I can do that with BinaryThresholdImageFunction class. Is it possible?
> >>
> >>Thanks for your reply,
> >>
> >>Samuel
> >>
>