Fw: [Insight-users] Converting Image Data to Vector type
Luis Ibanez
luis . ibanez at kitware . com
Fri, 02 Aug 2002 14:53:31 -0400
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.html
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_1BinaryThresholdImageFilter.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
>>