Hello,<br><br>I use visualstudio2010 and cmake.I am trying to read an image with the Command  Prompt window (for example a .png image) and then get the data value of a pixel using the get()  method. Finally, I want to take the value of the pixel on the Command Prompt window. So, I have created an imageReader object and an IndexType object as it is shown in the following code. As structures separately, the two objects seem to be correct, but I don&#39;t know how to connect them together to get my data value. Could someone help me with this problem?<br>
<br>Thanks<br>-----------------------code------------------------------<br>--------------------------------------------------------<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br><br>#include &quot;itkIndex.h&quot;<br>
 <br>int main(int argc, char *argv[])<br>{<br>  if( argc &lt; 2 )<br>    {<br>    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; inputImageFile&quot; &lt;&lt; std::endl;<br>
    return EXIT_FAILURE;<br>    }<br> <br>  typedef itk::Image&lt;  unsigned short, 2 &gt;         ImageType;<br>  typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br> <br>  ReaderType::Pointer reader= ReaderType::New();<br>
  reader-&gt;SetFileName(argv[1]);<br> <br>  <br>  //////////////////<br><br>  //  image object can be created<br>  ImageType::Pointer image = ImageType::New();<br><br><br>  ImageType::IndexType pixelIndex;<br> <br>  pixelIndex[0] = 17;   // x position<br>
  pixelIndex[1] = 19;   // y position<br><br><br>  ImageType::PixelType   pixelValue = image-&gt;GetPixel( pixelIndex );<br><br><br>  std::cout &lt;&lt; image-&gt;GetPixel(pixelIndex);<br><br>///////////////////////<br><br>
  return EXIT_SUCCESS;<br>}<br><br><br>------------------CMakeLists.txt------------------<br>-------------------------------------------------------<br>cmake_minimum_required(VERSION 2.6)<br> <br>PROJECT(ImageFileReader)<br>
 <br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br> <br> <br>ADD_EXECUTABLE(myproject myproject.cxx)<br>TARGET_LINK_LIBRARIES(myproject ITKIO ITKCommon)<br>