Hi H-B,<br><br>You shouldn't access the parameters of the ImageIO class.<br>(the RawImageIO is the only exception to this rule).<br><br><br>You should simply read the PNG image using the<br><br> itk::ImageFileReader<><br>
<br>and let the ImageIO factory figure out what ImageIO<br>class to use to read your png image.<br><br>Then you could use the itk::ChangeImageInformation filter<br>to correct the values of spacing (if you are certain that<br>
they are incorrect in the png files that you have).<br><br>Then, as Jon suggested, you could use the<br> RGBToLuminanceImageFilter to convert the image to<br>grayscale.<br><br>Your initial pipeline will look like:<br><br>
ImageFileReader -> <br>ChangeInformationFilter -><br>RGBToLuminanceImageFilter <br>
<br><br><br> Luis<br><br><br>----------------------------------------<br><div class="gmail_quote">On Tue, Nov 30, 2010 at 4:46 PM, H-B <span dir="ltr"><<a href="mailto:h4cd@yahoo.com">h4cd@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">
<div>Hello Jon,</div>
<div> </div>
<div>thank you for this idea, i saw example VisibleHumanStreamReadWrite</div>
<div> </div>
<div>but its for .raw data not .png </div>
<div>so i am working in <font color="#a31515" size="2"><font color="#a31515" size="2">itkPNGImageIO, </font></font>not in <font color="#a31515" size="2"><font color="#a31515" size="2">itkRawImageIO.</font></font></div>
<div><font color="#a31515" size="2"><font color="#a31515" size="2"> </font></font></div>
<div>in the example with raw format, they create chanel for each color</div><font color="#008000" size="2"><font color="#008000" size="2">
<div>// create a ImageIO for the red channel </div></font></font><font size="2">
<div></div></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">typedef</font></font><font size="2"> itk::RawImageIO<PixelType, 2> ImageIOType;
<div>ImageIOType::Pointer rimageio = ImageIOType::New();</div>
<div>rimageio->SetDimensions( 0, 2048 );</div>
<div>rimageio->SetDimensions( 1, 1216 );</div>
<div>rimageio->SetSpacing( 0, .33 );</div>
<div>rimageio->SetSpacing( 1, .33 );</div>
<div>rimageio->SetHeaderSize(rimageio->GetImageSizeInPixels()*0);</div>
<div></div></font>
<div><font color="#000000">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):</font></div>
<div><font color="#00bf60">// create a ImageIO for the red channel</font></div><font color="#0000ff" size="2"><font color="#0000ff" size="2">
<div>typedef</div></font></font><font size="2"> itk::PNGImageIO ImageIOType;</font><font color="#008000" size="2"><font color="#008000" size="2">//itkPNGImageIO</font></font><font size="2">
<div>ImageIOType::Pointer rimageio = ImageIOType::New();</div>
<div>rimageio->SetDimensions( 0, 2048 );</div>
<div>rimageio->SetDimensions( 1, 1216 );</div>
<div>rimageio->SetSpacing( 0, 1 );</div></font><font color="#008000" size="2"><font color="#008000" size="2">//was .33</font></font><font size="2">
<div>rimageio->SetSpacing( 1, 1 );</div></font><font color="#008000" size="2"><font color="#008000" size="2">//was .33
<div> </div>
<div> </div>
<div><font color="#000000">is it right??</font></div></font></font><br></td></tr></tbody></table><br>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>