[Insight-users] Re : Re : Re : Re : Re : Re : ITK v4 + IO factory classes : runtime error

Malsoaz James jmalsoaz at yahoo.fr
Sun Dec 18 06:47:47 EST 2011


To conclude with this thread, I have been able to use the find_package directive successfuly.

As Bill said, I had to set the ITK_DIR to the directory where to find the cmake files I want (don't forget to clear CMake cache before :)).
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.

Thank you
Best



________________________________
 De : Bill Lorensen <bill.lorensen at gmail.com>
À : Malsoaz James <jmalsoaz at yahoo.fr> 
Cc : Matt McCormick <matt.mccormick at kitware.com>; Quang Tran <quangt.itbk at gmail.com>; "insight-users at itk.org" <insight-users at itk.org> 
Envoyé le : Mercredi 14 Décembre 2011 21h58
Objet : Re: Re : [Insight-users] Re : Re : Re : Re : ITK v4 + IO factory classes : runtime error
 
The cmake help for ITK_DIR says:

//The directory containing ITKConfig.cmake.  This is either the
// root of the build tree, or PREFIX/lib/InsightToolkit for an
// installation.


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



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111218/bc0ee391/attachment.htm>


More information about the Insight-users mailing list