Well, is  <i>image  </i>a pointer  showing in x,y,z dimension? How could I get the value for every dimension separately?<br><br>Thanks for your response<br><br><div class="gmail_quote">2011/5/28 robert tamburo <span dir="ltr">&lt;<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>image-&gt;GetLargestPossibleRegion().GetSize();   which is in your code:</div><div class="im"><div><br></div><div>
  InputImageType::RegionType inputRegion =<br>           reader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>
  InputImageType::SizeType size = inputRegion.GetSize();</div><div><br></div></div><div><br><br><div class="gmail_quote"><div><div></div><div class="h5">On Sat, May 28, 2011 at 10:30 AM, john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com" target="_blank">mkitkinsightuser@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">Hello,<br><br>I am using ITK for my project and I have wrote the following code.Could somebody tell me how can I get the size of my image?<br>

<br>Thanks in advance<br><br> typedef unsigned char        InputPixelType;<br>  typedef unsigned char        OutputPixelType;<br>
<br>  typedef itk::Image&lt; InputPixelType,  3 &gt;    InputImageType;<br>  typedef itk::Image&lt; OutputPixelType, 2 &gt;    OutputImageType;<br><br>   typedef itk::ImageFileReader&lt; InputImageType  &gt;  ReaderType;<br>


  typedef itk::ImageFileWriter&lt; OutputImageType &gt;  WriterType;<br><br>  ReaderType::Pointer reader = ReaderType::New();<br>  WriterType::Pointer writer = WriterType::New();<br><br>  reader-&gt;SetFileName( fileName.toStdString()  );<br>


  writer-&gt;SetFileName( &quot;2D.png&quot; );<br><br>  <br>  typedef itk::ExtractImageFilter&lt; InputImageType, OutputImageType &gt; FilterType;<br>  FilterType::Pointer filter = FilterType::New();<br><br>    reader-&gt;Update();<br>


  InputImageType::RegionType inputRegion =<br>           reader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>  InputImageType::SizeType size = inputRegion.GetSize();<br>  size[2] = 0; <br>  <br>  InputImageType::IndexType start = inputRegion.GetIndex();<br>


  const unsigned int sliceNumber = 89;<br>   start[2] = sliceNumber;<br><br>  InputImageType::RegionType desiredRegion;<br>  desiredRegion.SetSize( size );<br>  desiredRegion.SetIndex( start );<br><br>  filter-&gt;SetExtractionRegion( desiredRegion );<br>


<br>  filter-&gt;SetInput( reader-&gt;GetOutput() );<br>  writer-&gt;SetInput( filter-&gt;GetOutput() );<br><br>      try<br>    {<br>    writer-&gt;Update();    <br>    }<br>    catch( itk::ExceptionObject &amp; err )<br>


    {<br>    std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>    }<br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">


</div>
<br></div></div>_____________________________________<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></div>
</blockquote></div><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>