[Insight-developers] Having mysterious problem with ObjectFactories -- HELP!!

Williams, Norman K norman-k-williams at uiowa.edu
Tue Mar 22 17:53:23 EDT 2011


OK. So I changed ObjectFactoryBase::InitializeFactoryList() thusly:


void
ObjectFactoryBase
::InitializeFactoryList()
{
  CleanUpObjectFactoryGlobal.Use();
  /**
   * Don't do anything if we are already initialized
   */
  if ( ObjectFactoryBase::m_RegisteredFactories == 0)
    {
    ObjectFactoryBase::m_RegisteredFactories =
      new std::list< ObjectFactoryBase * >;
    }
  std::cerr << "&m_RegisteredFactories = " << &m_RegisteredFactories
            << " m_RegisteredFactories = " << m_RegisteredFactories
            << " m_RegisteredFactories.size() = " <<
m_RegisteredFactories->size()
            << std::endl;
}

So it is printing out the address and size of the One True
m_RegisteredFactories every time
ObjectFactoryBase::InitializeFactoryList() gets called.

The output is below. Let me summarize: First, the ImageIO factories get
added. Then the TransformIO factories get added and the address changes,
and the count goes back to zero!

Now I'm perhaps alone in running with ITK_BUILD_SHARED, but it appears
that you get a different instance of
ObjectFactoryBase::m_RegisteredFactories depending on which shared library
you're in.  In other words the ObjectFactory implementation in ITK is 100%
broken with respect to shared libraries.


&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =0
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =1
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =2
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =3
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =4
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =5
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =6
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =7
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =8
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =9
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =10
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =11
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =12
&m_RegisteredFactories = 0x101fb7c30 m_RegisteredFactories = 0x1061d6330
m_RegisteredFactories.size() =13
&m_RegisteredFactories = 0x104d7d5e0 m_RegisteredFactories = 0x1061e0a70
m_RegisteredFactories.size() =0




On 3/22/11 3:53 PM, "Kent WIlliams" <norman-k-williams at uiowa.edu> wrote:

>Yes I'd be available.
>
>
>Since at this point the TransformFactory only works by accident, any
>improvement would be welcome.
>
>On 3/22/11 3:35 PM, "Luis Ibanez" <luis.ibanez at kitware.com> wrote:
>
>>Hi Kent,
>>
>>Coincidentally we have a great tcon yesterday with Vince
>>looking at the status of factories in ITK.
>>
>>We identified a set of improvements that can be applied
>>to the Transform Factories.
>>
>>Could you be available for a phone or Skype tcon at
>>some time tomorrow Wednesday ?
>>
>>We can go over the details there.
>>
>>
>>    Please let me know,
>>
>>
>>        Thanks
>>
>>
>>            Luis
>>
>>
>>---------------
>>On Tue, Mar 22, 2011 at 3:53 PM, Williams, Norman K
>><norman-k-williams at uiowa.edu> wrote:
>>> I'm trying to add a new transform file reader/writer in
>>> ITK/Modules/Transform.
>>>
>>>
>>> Aside from the challenge of writing the class itself, I'm having
>>>trouble
>>> with the ObjectFactories.
>>>
>>> In ITK/Modules/Transform/itkTransformIOFactory.cxx, I register an
>>>instance
>>> of a new factory and all of a sudden the ObjectFactory can no longer
>>> create any of the registered transform classes.
>>>
>>> When I try to debug the problem I run into mysterious problems with the
>>> ObjectFactory not being able to create instances of any transform type,
>>> even though I can see them getting registered in
>>> ITK/Modules/Transform/src/itkTransformFactoryBase.cxx.
>>>
>>> What is the trick here? How does registering one additional factory
>>>screw
>>> up everything?
>>>
>>>
>>>
>>> ________________________________
>>> 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.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-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.
________________________________


More information about the Insight-developers mailing list