[Insight-users] visible human project data
Luis Ibanez
luis.ibanez at kitware.com
Wed Dec 1 20:29:04 EST 2010
Hi H-B,
You shouldn't access the parameters of the ImageIO class.
(the RawImageIO is the only exception to this rule).
You should simply read the PNG image using the
itk::ImageFileReader<>
and let the ImageIO factory figure out what ImageIO
class to use to read your png image.
Then you could use the itk::ChangeImageInformation filter
to correct the values of spacing (if you are certain that
they are incorrect in the png files that you have).
Then, as Jon suggested, you could use the
RGBToLuminanceImageFilter to convert the image to
grayscale.
Your initial pipeline will look like:
ImageFileReader ->
ChangeInformationFilter ->
RGBToLuminanceImageFilter
Luis
----------------------------------------
On Tue, Nov 30, 2010 at 4:46 PM, H-B <h4cd at yahoo.com> wrote:
> Hello Jon,
>
> thank you for this idea, i saw example VisibleHumanStreamReadWrite
>
> but its for .raw data not .png
> so i am working in itkPNGImageIO, not in itkRawImageIO.
>
> in the example with raw format, they create chanel for each color
> // create a ImageIO for the red channel
> typedef itk::RawImageIO<PixelType, 2> ImageIOType;
> ImageIOType::Pointer rimageio = ImageIOType::New();
> rimageio->SetDimensions( 0, 2048 );
> rimageio->SetDimensions( 1, 1216 );
> rimageio->SetSpacing( 0, .33 );
> rimageio->SetSpacing( 1, .33 );
> rimageio->SetHeaderSize(rimageio->GetImageSizeInPixels()*0);
>
> i just need the red one so i modefiy the code as follow (i dont know what
> they mean by spacing in the example but i think the but .33 for each chanel,
> for that i put 1 for the red chanel and zero for green and blue):
> // create a ImageIO for the red channel
> typedef
> itk::PNGImageIO ImageIOType;//itkPNGImageIO
> ImageIOType::Pointer rimageio = ImageIOType::New();
> rimageio->SetDimensions( 0, 2048 );
> rimageio->SetDimensions( 1, 1216 );
> rimageio->SetSpacing( 0, 1 );
> //was .33
> rimageio->SetSpacing( 1, 1 );
> //was .33
>
>
> is it right??
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101201/5400f43d/attachment.htm>
More information about the Insight-users
mailing list