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" <[email protected]> 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" ><[email protected]> 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 [email protected] >> >> >> >> >> >> >> ________________________________ >> 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
