<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><span>To conclude with this thread, I have been able to use the find_package directive successfuly.</span></div><div><br><span></span></div><div><span>As Bill said, I had to set the ITK_DIR </span><span>to the directory where to find the cmake files I want </span><span>(don't forget to clear CMake cache before :))</span><span></span><span>.</span></div><div><span>And as I moved all the installed files to specific directories, I only had to verify and change all CMake files in order to fit with my directories structure.</span></div><div><br><span></span></div><div><span>Thank you</span></div><div><span>Best<br></span></div><div><br></div>  <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size:
 12pt;"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">De&nbsp;:</span></b> Bill Lorensen &lt;bill.lorensen@gmail.com&gt;<br> <b><span style="font-weight: bold;">À&nbsp;:</span></b> Malsoaz James &lt;jmalsoaz@yahoo.fr&gt; <br><b><span style="font-weight: bold;">Cc&nbsp;:</span></b> Matt McCormick &lt;matt.mccormick@kitware.com&gt;; Quang Tran &lt;quangt.itbk@gmail.com&gt;; "insight-users@itk.org" &lt;insight-users@itk.org&gt; <br> <b><span style="font-weight: bold;">Envoyé le :</span></b> Mercredi 14 Décembre 2011 21h58<br> <b><span style="font-weight: bold;">Objet&nbsp;:</span></b> Re: Re : [Insight-users] Re : Re : Re : Re : ITK v4 + IO factory classes : runtime error<br> </font> <br>The cmake help for ITK_DIR says:<br><br>//The directory containing ITKConfig.cmake.&nbsp; This is either the<br>// root of the build tree, or PREFIX/lib/InsightToolkit for an<br>// installation.<br><br><br>On Wed, Dec 14, 2011 at 3:21
 PM, Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt; wrote:<br>&gt;<br>&gt; Ok I understand.<br>&gt;<br>&gt; Nevertheless, is there a way to avoid the use of the binary dir, for example<br>&gt; use install dir instead?<br>&gt; I would like to keep only the installed libs/includes on my computer and not<br>&gt; the entire binaries directory (I'm out of space). Note that after the<br>&gt; installation, I moved the libs/includes to specific directories (not the<br>&gt; same as the default dirs), so I'm not sure that using the cmakes in install<br>&gt; dir will work.<br>&gt;<br>&gt; My structure is as follow<br>&gt; ITK &gt; 4.0.0 &gt; bin &gt; compiler name &gt; Debug or Release<br>&gt; ITK &gt; 4.0.0 &gt; include &gt; compiler name<br>&gt; ITK &gt; 4.0.0 &gt; lib &gt; compiler name &gt; Debug or Release<br>&gt;<br>&gt; Best.<br>&gt;<br>&gt; ________________________________<br>&gt; De&nbsp;:
 Bill Lorensen &lt;<a ymailto="mailto:bill.lorensen@gmail.com" href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>&gt; À&nbsp;: Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt; Cc&nbsp;: Matt McCormick &lt;<a ymailto="mailto:matt.mccormick@kitware.com" href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>&gt;; Quang Tran<br>&gt; &lt;<a ymailto="mailto:quangt.itbk@gmail.com" href="mailto:quangt.itbk@gmail.com">quangt.itbk@gmail.com</a>&gt;; "<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>" &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt; Envoyé le : Mercredi 14 Décembre 2011 19h57<br>&gt; Objet&nbsp;: Re: [Insight-users] Re : Re : Re : Re : ITK v4 + IO factory classes<br>&gt; : runtime error<br>&gt;<br>&gt; You
 should use the<br>&gt; find_package(ITK REQUIRED)<br>&gt; include(${ITK_USE_FILE})<br>&gt;<br>&gt; If you set ITK_DIR to the proper binary tree, the find will use it.<br>&gt; Don't be concerned about where the use file exists. The find_package<br>&gt; should do the correct thing.<br>&gt;<br>&gt; If you bypass the include(${ITK_USE_FILE}) you are asking for trouble<br>&gt; in the future.<br>&gt;<br>&gt; On Wed, Dec 14, 2011 at 12:33 PM, Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt; wrote:<br>&gt;&gt; Finally, my last proposed solution works. I should have clean my cmake.<br>&gt;&gt;<br>&gt;&gt; Thank you.<br>&gt;&gt;<br>&gt;&gt; ________________________________<br>&gt;&gt; De&nbsp;: Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt;&gt; À&nbsp;: Matt McCormick &lt;<a ymailto="mailto:matt.mccormick@kitware.com"
 href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>&gt;<br>&gt;&gt; Cc&nbsp;: Quang Tran &lt;<a ymailto="mailto:quangt.itbk@gmail.com" href="mailto:quangt.itbk@gmail.com">quangt.itbk@gmail.com</a>&gt;; "<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>"<br>&gt;&gt; &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt;&gt; Envoyé le : Mercredi 14 Décembre 2011 18h18<br>&gt;&gt; Objet&nbsp;: [Insight-users] Re : Re : Re : ITK v4 + IO factory classes :<br>&gt;&gt; runtime<br>&gt;&gt; error<br>&gt;&gt;<br>&gt;&gt; Thank you for your answer.<br>&gt;&gt;<br>&gt;&gt; Setting the ITK_DIR changes nothing. It stays to the src dir.<br>&gt;&gt;<br>&gt;&gt; I found in ITKConfig.cmake the way to register the ImageIO by creating the<br>&gt;&gt; "ITKIOFactoryRegistration" folder. I copy it in my CMakeList and it
 works.<br>&gt;&gt; Nevertheless, I still have the same error (it can't find any IO factory<br>&gt;&gt; classes). Obviously something is still missing. Has someone any idea?<br>&gt;&gt;<br>&gt;&gt; Best<br>&gt;&gt;<br>&gt;&gt; ________________________________<br>&gt;&gt; De&nbsp;: Matt McCormick &lt;<a ymailto="mailto:matt.mccormick@kitware.com" href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>&gt;<br>&gt;&gt; À&nbsp;: Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt;&gt; Cc&nbsp;: Quang Tran &lt;<a ymailto="mailto:quangt.itbk@gmail.com" href="mailto:quangt.itbk@gmail.com">quangt.itbk@gmail.com</a>&gt;; "<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>"<br>&gt;&gt; &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt;&gt; Envoyé le :
 Mercredi 14 Décembre 2011 17h46<br>&gt;&gt; Objet&nbsp;: Re: [Insight-users] Re : Re : ITK v4 + IO factory classes :<br>&gt;&gt; runtime<br>&gt;&gt; error<br>&gt;&gt;<br>&gt;&gt; Hi James,<br>&gt;&gt;<br>&gt;&gt; You want to have<br>&gt;&gt;<br>&gt;&gt; &nbsp; find_package(ITK REQUIRED)<br>&gt;&gt; &nbsp; include(${ITK_USE_FILE})<br>&gt;&gt;<br>&gt;&gt; In your CMakeLists.txt.&nbsp; Then, set ITK_DIR in your cmake build<br>&gt;&gt; configuration.&nbsp; The ITK_DIR will allow you to point to different ITK<br>&gt;&gt; builds.<br>&gt;&gt;<br>&gt;&gt; Hope this helps,<br>&gt;&gt; Matt<br>&gt;&gt;<br>&gt;&gt; On Wed, Dec 14, 2011 at 11:33 AM, Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt; wrote:<br>&gt;&gt;&gt; How can I configure/register manually the IO classes from an install<br>&gt;&gt;&gt; directory (bin/include/lib/share)?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I will have several
 installation of ITK (for several compilers) and I<br>&gt;&gt;&gt; would<br>&gt;&gt;&gt; like to avoid the use of find_package(ITK) and set manually the path to<br>&gt;&gt;&gt; the<br>&gt;&gt;&gt; libs/includes. Indeed, the ITK find package will not necessarely load the<br>&gt;&gt;&gt; version I want.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Thank you<br>&gt;&gt;&gt; Best<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; ________________________________<br>&gt;&gt;&gt; De&nbsp;: Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt;&gt;&gt; À&nbsp;: Quang Tran &lt;<a ymailto="mailto:quangt.itbk@gmail.com" href="mailto:quangt.itbk@gmail.com">quangt.itbk@gmail.com</a>&gt;<br>&gt;&gt;&gt; Cc&nbsp;: "<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>" &lt;<a ymailto="mailto:insight-users@itk.org"
 href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt;&gt;&gt; Envoyé le : Mercredi 14 Décembre 2011 11h21<br>&gt;&gt;&gt; Objet&nbsp;: [Insight-users] Re : ITK v4 + IO factory classes : runtime error<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Thank you for the proposition.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Nevertheless, my goal is to use the power of ITK IO classes to avoid to<br>&gt;&gt;&gt; set<br>&gt;&gt;&gt; a IO object. A default one should be set depending on the input file.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Best.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; ________________________________<br>&gt;&gt;&gt; De&nbsp;: Quang Tran &lt;<a ymailto="mailto:quangt.itbk@gmail.com" href="mailto:quangt.itbk@gmail.com">quangt.itbk@gmail.com</a>&gt;<br>&gt;&gt;&gt; À&nbsp;: Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt;&gt;&gt; Cc&nbsp;: "<a ymailto="mailto:insight-users@itk.org"
 href="mailto:insight-users@itk.org">insight-users@itk.org</a>" &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt;&gt;&gt; Envoyé le : Mercredi 14 Décembre 2011 4h27<br>&gt;&gt;&gt; Objet&nbsp;: Re: [Insight-users] ITK v4 + IO factory classes : runtime error<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Hi,<br>&gt;&gt;&gt; I also had the same problem like you. In this case you should explicit<br>&gt;&gt;&gt; specify the IO flag for the reader, i.e:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; #include "itkPNGImageIO.h"<br>&gt;&gt;&gt; ...<br>&gt;&gt;&gt; const unsigned int ImageDimension = 2;<br>&gt;&gt;&gt; typedef short PixelType;<br>&gt;&gt;&gt; typedef itk::Image&lt;PixelType, ImageDimension&gt; ImageType;<br>&gt;&gt;&gt; typedef itk::ImageFileReader&lt;ImageType &gt; ImageReaderType;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; ImageReaderType::Pointer &nbsp;pReader &nbsp;= ImageReaderType::New();<br>&gt;&gt;&gt;
 pReader-&gt;SetFileName("C:\\test.png");<br>&gt;&gt;&gt; pReader-&gt;SetImageIO(itk::PNGImageIO::New());<br>&gt;&gt;&gt; pReader-&gt;Update();<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; /QuangT<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 2011/12/13 Malsoaz James &lt;<a ymailto="mailto:jmalsoaz@yahoo.fr" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Hi,<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I'm trying to use ITK v4. I have been able to install it successfully<br>&gt;&gt;&gt; (note<br>&gt;&gt;&gt; that the option ITK_USE_SYSTEM_GDCM doesn't work, it produce a link error<br>&gt;&gt;&gt; to<br>&gt;&gt;&gt; gdcmMSFF).<br>&gt;&gt;&gt; Anyway, I built it with the internal version of GDCM.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Unfortunately, when I try a reader class such as itkImageFileReader, I<br>&gt;&gt;&gt; got<br>&gt;&gt;&gt; an error regarding the IO factory classes :<br>&gt;&gt;&gt; " Could not create IO object for file
 "C:/test.png"<br>&gt;&gt;&gt; &nbsp; Tried to create one of the following:<br>&gt;&gt;&gt; &nbsp; You probably failed to set a file suffix, or set the suffix to an<br>&gt;&gt;&gt; unsupported type."<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; As you can see, the list of IO object is empty. It seems ITK can't find<br>&gt;&gt;&gt; them. I checked in the include dir and several IO files are available<br>&gt;&gt;&gt; such<br>&gt;&gt;&gt; as itkGDCMImageIO<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Can someone tell me what's wrong ?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Regarding the CMakeLists, I created and used two variables<br>&gt;&gt;&gt; - a ITK_INCLUDE_DIR (path to the include dir) to find the include files<br>&gt;&gt;&gt; - a ITK_LIBRARIES list (list of path to the libs). Since the libs are not<br>&gt;&gt;&gt; the same compared to ITKv3, I'm not sure which libraries to include in<br>&gt;&gt;&gt; this<br>&gt;&gt;&gt; list and in which order (if it matters), thus I listed all of
 them in<br>&gt;&gt;&gt; alphabetical order.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I have no warning/error at compilation time.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I hope someone will be able to help me.<br>&gt;&gt;&gt; Best<br>&gt;&gt;&gt; James.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; _____________________________________<br>&gt;&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt;&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt;&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ"
 target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; _____________________________________<br>&gt;&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt;&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Please keep messages
 on-topic and check the ITK FAQ at:<br>&gt;&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; _____________________________________<br>&gt;&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt;&gt; <a href="http://www.kitware.com/products/protraining.html"
 target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt;&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _____________________________________<br>&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;<br>&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;<br>&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt; <a
 href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;<br>&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;<br>&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _____________________________________<br>&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;<br>&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;<br>&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt; <a
 href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;<br>&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;<br>&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Unpaid intern in BillsBasement at noware dot com<br>&gt;<br>&gt;<br><br><br><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br><br> </div> </div>  </div></body></html>