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