[Insight-users] Name conflict
Luis Ibanez
luis.ibanez at kitware.com
Wed, 28 Jan 2004 16:54:52 -0500
Hi John,
This is the consequence the lack
of use of namespaces in MOTIF :-)
Unfortunately Motif was already old
when namespaces where introduced in C++.
The simply solution is "Encapsulation".
Do not include the Motif and ITK headers
in the same cxx file. Instead, create a
C++ class that performs only the image
processing tasks, add a facade class and
expose this last facade class to the layer
that is using Motif for the GUI.
Let's call the first class "ImageProcessor",
so you create files
ImageProcessor.h ---> includes ITK headers
ImageProcessor.cxx --> implements ITK pipeline
Then you create a facade class
"ImageProcessingModule"
in the header file of this class you forward
declare "ImageProcessor",
e.g. just put:
class ImageProcessor;
and do not include in this header any ITK
header, not the ImageProcessor.h header.
Then, in the file ImageProcessingModule.cxx
you include the header file ImageProcessor.h.
and internally you can use the type freely.
The class ImageProcessingModule is the one that
can be expose to the Motif layer.
Just for the record,..
note that if you update to ITK 1.6, the
itkDiscreteGaussianImageFilter is no longer
using "Dimension" but "ImageDimension".
Regards,
Luis
------------------
Dill, John wrote:
> I am having issues with my application and one of the itk txx files. I am
> integrating some itk code into my application which uses motif. A motif
> header file defines Dimension, which is also used in
> itkDiscreteGaussianImageFilter.txx, is giving a name conflict. I include
> both headers in the same file at the moment, but am looking for a way to get
> around this. I will try to separate the registration algorithm into a
> separate file if possible and see if that fixes it. If anyone has dealt
> with this before and has a solution, let me know.
>
> Thanks,
> John
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>