[Insight-developers] itkMesh error

Brad King brad.king@kitware.com
Mon, 7 May 2001 16:25:20 -0400 (EDT)


>    itk::Mesh<itk::Scalar<unsigned char>,3>::Pointer mesh =
>       itk::Mesh<itk::Scalar<unsigned char>,3>::New();
> 
> This causes a compile error in the itkMesh PrintSelf function:
> 
> f:\insight\insight\code\common\itkmesh.txx(57) : error C2662: 'PrintSelf' : cannot convert 'this' pointer from 'const class itk::Mesh<class itk::Scalar<unsigned char>,3,class itk::DefaultStaticMeshTraits<class itk::Scalar<unsigned char>,3,3,float,fl
> oat> >' to 'class itk::PointSet<class itk::Scalar<unsigned char>,3,class itk::DefaultStaticMeshTraits<class itk::Scalar<unsigned char>,3,3,float,float> > &'
>         Conversion loses qualifiers
>         c:\program files\microsoft visual studio\vc98\include\xstring(583) : while compiling class-template member function 'void __thiscall itk::Mesh<class itk::Scalar<unsigned char>,3,class itk::DefaultStaticMeshTraits<class itk::Scalar<unsigned c
> har>,3,3,float,float> >::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class itk::Indent) const'
> Error executing cl.exe.

The standard itk object's "PrintSelf" method has changed to be a
"const" method recently.  The Mesh::PrintSelf method has been updated, but
it looks like the PointSet::PrintSelf method has not.  Look at
itkPointSet.h, and change the line
  void PrintSelf(std::ostream& os, Indent indent);
to
  virtual void PrintSelf(std::ostream& os, Indent indent) const;

That should fix the problem.  If so, go ahead and check in that
change.  If not, let me know and I will look into this in more detail.

-Brad