Please show us your CMakeLists.txt file.<br><br><div class="gmail_quote">On Thu, Jul 5, 2012 at 7:57 AM, 吴鹏飞 <span dir="ltr"><<a href="mailto:wpfnihao@gmail.com" target="_blank">wpfnihao@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="ZH-CN" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">Hello all,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">I am new to itk and tried to write my first program using itk and vtk to show an image, but I encountered a strange problem. It seems that my itk can’t infer from the file extension which ImageIO to use. If I commented the phrase <u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:21.0pt"><span lang="EN-US" style="font-size:10.5pt;font-family:NSimSun;color:green">reader->SetImageIO(itk::JPEGImageIO::New());<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">out, the error <u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-family:"Calibri","sans-serif""> “</span><span lang="EN-US" style="font-size:10.5pt;font-family:NSimSun">Could not create IO object for file E:\1340858885.jpg<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.5pt;font-family:NSimSun"> Tried to create one of the following:<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.5pt;font-family:NSimSun"> You probably failed to set a file suffix, or<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.5pt;font-family:NSimSun"> set the suffix to an unsupported type.”<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">occurred, but the program worked properly with the phrase mentioned above. See my source code attached at the end of this mail.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif""> Is there someone can tell me why this happened?<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">Thanks a lot in advance!<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri","sans-serif"">Wu, Pengfei<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14.0pt;font-family:"Calibri","sans-serif"">Code:<u></u><u></u></span></p><div class="MsoNormal" align="center" style="text-align:center;text-autospace:none">
<span lang="EN-US" style="font-size:14.0pt;font-family:"Calibri","sans-serif""><hr size="2" width="100%" align="center"></span></div><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun;color:blue">int</span><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">main</span>(<span style="color:blue">int</span> <span style="color:#010001">argc</span>, <span style="color:blue">char</span>* <span style="color:#010001">argv</span>[])<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun">{<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">typedef</span> <span style="color:#010001">itk</span>::<span style="color:#010001">RGBPixel</span><<span style="color:blue">unsigned</span> <span style="color:blue">short</span>> <span style="color:#010001">PixelType</span>;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">const</span> <span style="color:blue">unsigned</span> <span style="color:blue">int</span> <span style="color:#010001">Dimension</span> = 2;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">typedef</span> <span style="color:#010001">itk</span>::<span style="color:#010001">Image</span><<span style="color:#010001">PixelType</span>, <span style="color:#010001">Dimension</span>> <span style="color:#010001">ImageType</span>;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">typedef</span> <span style="color:#010001">itk</span>::<span style="color:#010001">ImageFileReader</span><<span style="color:#010001">ImageType</span>> <span style="color:#010001">ReaderType</span>;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">ReaderType</span>::<span style="color:#010001">Pointer</span> <span style="color:#010001">reader</span> = <span style="color:#010001">ReaderType</span>::<span style="color:#010001">New</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">const</span> <span style="color:blue">char</span> *<span style="color:#010001">filename</span> = <span style="color:#a31515">"E:\\1340858885.jpg"</span>;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:green">//reader->SetImageIO(itk::JPEGImageIO::New());</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">reader</span>-><span style="color:#010001">SetFileName</span>(<span style="color:#010001">filename</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">ImageType</span>::<span style="color:#010001">Pointer</span> <span style="color:#010001">image</span> = <span style="color:#010001">reader</span>-><span style="color:#010001">GetOutput</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun;color:green"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">typedef</span> <span style="color:#010001">itk</span>::<span style="color:#010001">ImageToVTKImageFilter</span><<span style="color:#010001">ImageType</span>> <span style="color:#010001">FilterType</span>;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">FilterType</span>::<span style="color:#010001">Pointer</span> <span style="color:#010001">connecter</span> = <span style="color:#010001">FilterType</span>::<span style="color:#010001">New</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">connecter</span>-><span style="color:#010001">SetInput</span>(<span style="color:#010001">image</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">vtkImageViewer</span> *<span style="color:#010001">viewer</span> = <span style="color:#010001">vtkImageViewer</span>::<span style="color:#010001">New</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">vtkRenderWindowInteractor</span> *<span style="color:#010001">renderWindowInteractor</span> = <span style="color:#010001">vtkRenderWindowInteractor</span>::<span style="color:#010001">New</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">viewer</span>-><span style="color:#010001">SetupInteractor</span>(<span style="color:#010001">renderWindowInteractor</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">viewer</span>-><span style="color:#010001">SetInput</span>(<span style="color:#010001">connecter</span>-><span style="color:#010001">GetOutput</span>());<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">viewer</span>-><span style="color:#010001">Render</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">viewer</span>-><span style="color:#010001">SetColorWindow</span>(255);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">viewer</span>-><span style="color:#010001">SetColorLevel</span>(128);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">renderWindowInteractor</span>-><span style="color:#010001">Start</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:#010001">cin</span>.<span style="color:#010001">get</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun"> <span style="color:blue">return</span> 0;<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:11.0pt;font-family:NSimSun">}<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:14.0pt;font-family:"Calibri","sans-serif"">-------------------------------------End of Code-------------------------------------------------------------<u></u><u></u></span></p>
</div></div><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.php" target="_blank">http://www.kitware.com/products/protraining.php</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><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>