[Insight-developers] ITK ObjectFactory mysterious, frustrating. (was TransformIO problem)

Williams, Norman K norman-k-williams at uiowa.edu
Wed Nov 2 17:14:40 EDT 2011


I noticed that in the TransformBase tests

itkTransformFactoryBaseTest.cxx calls
itk::TransformFactoryBase::RegisterDefaultTransforms();

The other tests (for Reader & Writer) do not.

Some of the tests in BRAINSResample were failing, claiming that the
ObjectFactory couldn't create an instance of AffineTransformDouble_3_3.

If I add itk::TransformFactoryBase::RegisterDefaultTransforms(); to the
main function, the BRAINSResample tests succeed.

Without it, RegisterDefaultTransform gets called from
itk::TransformFactoryBase::GetFactory(), but only after trying to call
ObjectFactoryBase::CreateInstance -- down in the exception code!

I'm trying out a patch, but it depends on the call toe
TransformFactoryBase::GetFactory() having the side effect of registering
all the transform types. This is disturbing to me because it depends on
side effects!

So it seems like there's a few problems with the Transform Factory: The
initialization isn't thread safe, and it isn't getting done before it's
needed.

Isn't there a better way to make sure that RegisterDefaultTransforms gets
called?
--
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.
________________________________


More information about the Insight-developers mailing list