[ITK Community] [Insight-developers] What triggers instantiation of all ImageIO libraries?
Johnson, Hans J
hans-johnson at uiowa.edu
Thu Nov 21 15:16:11 EST 2013
Kent,
For this case, explicitly registering only the handful of classes should
be just fine.
There is really no need to use the "Magic" to register them automatically.
Hans
-----Original Message-----
From: <Williams>, Kent Williams <norman-k-williams at uiowa.edu>
Date: Thursday, November 21, 2013 2:09 PM
To: Bradley Lowekamp <blowekamp at mail.nih.gov>
Cc: ITK <insight-developers at itk.org>
Subject: Re: [Insight-developers] What triggers instantiation of all
ImageIO libraries?
If I understand what you're saying in that first sentence, if I define
ITK_NO_IO_FACTOR_REGISTER_MANAGER before including ${ITK_USE_FILE} then
the factories don't get registered.
I do not do that.
It seems my ImageIO factories aren't being registered. I suspect it is
because I'm building a shared library (i.e. MEX64 file). If you build an
executable, the C++ runtime instantiates static objects before calling
main(). The MEX64 file gets loaded as a shared object and then Matlab
calls mexFunction.
Congratulations on the cascade of clauses in that sentence. Positively
Heideggerian.
I tried including itkImageFactoryRegisterManager.h and ran into a whole
lot of undefined externals caused by referencing GDCMImageIO. The gdcm
libraries aren't included in ITK_LIBRARIES, which is a problem for me,
since MEX is doing the linking for me, not CMake.
On 11/21/13 1:30 PM, "Bradley Lowekamp" <blowekamp at mail.nih.gov> wrote:
>Kent,
>
>If you explicitly don't use the implicit ITK auto registration by
>defining ITK_NO_IO_FACTORY_REGISTER_MANAGER to true[1], before including
>"ITK_USE_FILE" in cmake, your factories don't get registered.
>
>Look for a files called itkImageIOFactoryRegisterManager.h and
>itkTransformIOFactoryRegisterManager.h in a directory called
>ITKIOFactoryRegistration in build trees that use ITK.
>
>These file are automatically generated based on the ITK IO modules turned
>on. Some times you can just copy that file and use it. Otherwise there is
>some funny cmake stuff will need to be done.
>
>It also may be easiest to just call
>YourImageIOFactor::RegisterOnFactory(), if you just need a couple know
>one registered.
>
>
>[1]
>https://github.com/SimpleITK/SimpleITK/blob/master/Code/BasicFilters/src/C
>MakeLists.txt#L11
>
>On Nov 21, 2013, at 1:56 PM, "Williams, Norman K"
><norman-k-williams at uiowa.edu> wrote:
>
>> I'm in the process of using ITK in a C++ MEX Matlab extension.
>>
>> I solved the linking issues, but I ran into an interesting problem:
>>When
>> the MEX extension gets called, the ImageIOFactory instances have not yet
>> been registered. Is there a function I need to call before I use
>>ImageIO?
>>
>> --
>> Kent Williams norman-k-williams at uiowa.edu
>>
>>
>>
>>
>>
>>
>> ________________________________
>> Notice: This UI Health Care e-mail (including attachments) is covered
>>by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
>>confidential and may be legally privileged. If you are not the intended
>>recipient, you are hereby notified that any retention, dissemination,
>>distribution, or copying of this communication is strictly prohibited.
>>Please reply to the sender that you have received the message in error,
>>then delete it. Thank you.
>> ________________________________
>> _______________________________________________
>> 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://kitware.com/products/protraining.php
>>
>> 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-developers
>
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by
the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
confidential and may be legally privileged. If you are not the intended
recipient, you are hereby notified that any retention, dissemination,
distribution, or copying of this communication is strictly prohibited.
Please reply to the sender that you have received the message in error,
then delete it. Thank you.
________________________________
_______________________________________________
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://kitware.com/products/protraining.php
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-developers
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________
_______________________________________________
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://kitware.com/products/protraining.php
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-developers
More information about the Community
mailing list