[Insight-developers] itkRelabelComponentImageFilter

Miller, James V (Research) millerjv at crd.ge.com
Wed Aug 3 14:20:08 EDT 2005


This is probably a bug in the RelabelComponentImageFilter.

The intention was to put the structure in the anonymous namespace
so that it would only be visible to the RelabelComponentImageFilter.

But the anoymous namespace if visible to everything in the translation
unit and since we use implicit instantiation of templates, we end up
(implicitly) including the txx files in our programs and the 
anonymous namespace is in the program's translation unit.

(I'm not really sure what C++ consideres a translation "unit" but
I expect is what ever is sees while building a .o)

Possible solutions:

1. Throw ObjectType into a RelabelComponent namespace.
2. Throw ObjectType to be an inner class to RelabelComponent
3. Change name of ObjectType to RelabelComponentObjectType

Any of these solutions is fine with me.

The SizeInPixelComparator class should also be hidden.

Jim

-----Original Message-----
From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
Of Julien Jomier
Sent: Tuesday, August 02, 2005 4:36 PM
To: Insight-developers (E-mail)
Subject: [Insight-developers] itkRelabelComponentImageFilter


Hello,

I'm having an issue with the itkRelabelComponentImageFilter.
Basically if I compile that class with another ITK class that defines 
ObjectType then I got compiler errors (as expected...)

The problem comes from the following lines:

// anonymous namespace to hold a helper object
namespace
{
struct ObjectType
{
   unsigned long m_ObjectNumber;
   unsigned long m_SizeInPixels;
   float m_SizeInPhysicalUnits;
};

Does anyone see a problem in changing either the name of the structure 
or the name of the namespace? since this structure is used only by the 
class internally.

Thanks,

Julien
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list