[Insight-developers] Wrapping QuadEdgeMesh - build problems

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Sat May 16 06:30:55 EDT 2009


Hi,

Alex was in my lab last wednesday, and we began to wrap the  
QuadEdgeMesh stuff in WrapITK. This is a quite complex set of classes,  
which is highlighting some problems both in WrapITK and ITK. I'm  
taking the WrapITK's problem — here are the other ones:

* I get an error in the method void  
itk::MapContainer::Reserve(ElementIdentifier):

   /Users/glehmann/src/Insight/Code/Common/itkMapContainer.txx: In  
member function ‘void itk::MapContainer<TElementIdentifier,  
TElement>::Reserve(TElementIdentifier) [with TElementIdentifier =  
itk::Mesh<double, 3u, itk::QuadEdgeMeshTraits<double, 3u, bool, bool,  
float, float> >::BoundaryAssignmentIdentifier, TElement = long  
unsigned int]’:
   /Users/glehmann/src/contrib-itk/quadmesh/build/Wrapping/ 
wrap_itkBinaryMask3DMeshSourcePython.cpp:22596:   instantiated from here
   /Users/glehmann/src/Insight/Code/Common/itkMapContainer.txx:248:  
error: conversion from ‘long unsigned int’ to non-scalar type  
‘itk::Mesh<double, 3u, itk::QuadEdgeMeshTraits<double, 3u, bool, bool,  
float, float> >::BoundaryAssignmentIdentifier’ requested

The problematic code is:

   template <typename TElementIdentifier, typename TElement>
   void
   MapContainer< TElementIdentifier , TElement >
   ::Reserve(ElementIdentifier sz)
   {
     ElementIdentifier curSize = this->Size();
     while ( curSize < sz )
       {
       this->CreateIndex(curSize);
       curSize = this->Size();
       }
   }

Either that code, which tries to convert a number to a class, or the  
type used for TElementIdentifier (itk::Mesh<double, 3u,  
itk::QuadEdgeMeshTraits<double, 3u, bool, bool, float, float>  
 >::BoundaryAssignmentIdentifier), is wrong here.
Any idea about how to fix that?



* The macro itkCellCommonTypedefs( celltype ) in itkCellInterface.h  
provides some common typedefs for the cell types, but also a New()  
method, which makes swig generate invalid code.

          SelfAutoPointer   New(void) {                 \
                 SelfAutoPointer ptr( new celltype );   \
                 ptr.TakeOwnership();                   \
                 return ptr;                            \
                 }                                      \

This New() method looks quite strange to me, because it is not static,  
and thus already require an object to be used. Also, I tried to simply  
comment that method in the macro (and in itkQuadEdgeMeshLineCell.h/ 
txx), and it works - no code seems to use it.
So, is it a good fix to simply drop that method?



* The method itk::AutoPointer::Print produce an error when built

   /usr/local/include/InsightToolkit/Common/itkAutoPointer.h: In  
member function ‘TObjectType*  
itk::AutoPointer<TObjectType>::Print(std::ostream&) const [with  
TObjectType = itk::CellInterface<double,  
itk::QuadEdgeMeshCellTraitsInfo<3, float, float, long unsigned int,  
long unsigned int, unsigned char, itk::QuadEdgeMeshPoint<float, 3u,  
itk::GeometricalQuadEdge<long unsigned int, long unsigned int, bool,  
bool, true> >, itk::MapContainer<long unsigned int,  
itk::QuadEdgeMeshPoint<float, 3u, itk::GeometricalQuadEdge<long  
unsigned int, long unsigned int, bool, bool, true> > >, std::set<long  
unsigned int, std::less<long unsigned int>,  
std::allocator<std::_Bit_type> >, itk::GeometricalQuadEdge<long  
unsigned int, long unsigned int, bool, bool, true> > >]’:
   /usr/local/include/InsightToolkit/Common/itkAutoPointer.h:189:  
error: ‘class itk::CellInterface<double,  
itk::QuadEdgeMeshCellTraitsInfo<3, float, float, long unsigned int,  
long unsigned int, unsigned char, itk::QuadEdgeMeshPoint<float, 3u,  
itk::GeometricalQuadEdge<long unsigned int, long unsigned int, bool,  
bool, true> >, itk::MapContainer<long unsigned int,  
itk::QuadEdgeMeshPoint<float, 3u, itk::GeometricalQuadEdge<long  
unsigned int, long unsigned int, bool, bool, true> > >, std::set<long  
unsigned int, std::less<long unsigned int>,  
std::allocator<std::_Bit_type> >, itk::GeometricalQuadEdge<long  
unsigned int, long unsigned int, bool, bool, true> > >’ has no member  
named ‘Print’

   ObjectType *Print (std::ostream& os) const
     {
     // This prints the object pointed to by the pointer
     (*m_Pointer).Print(os);
     os << "Owner: " << m_IsOwner << std::endl;
     return m_Pointer;
     }

the itk::CellInterface class doesn't define a Print method, so the  
Print method in AutoPointer seems to be wrong. What is the better fix  
- drop the Print method in itk::AutoPointer, or adding a Print method  
in all the cell classes?

* The template are very complex to instantiate. There is a lot of  
template parameters to give. It would be great to simplify the  
instantiation by providing good enough default values.

Thanks again Alex for your presentation. My colleagues were very  
impressed by your project and your work :-)

Gaëtan


-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090516/d7385df1/attachment.pgp>


More information about the Insight-developers mailing list