[Insight-developers] anybody help me out of this?

Ting Chen chenting@graphics.cis.upenn.edu
Wed, 10 Jan 2001 13:10:30 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C07B06.B545E1D0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_000D_01C07B06.B545E1D0"


------=_NextPart_001_000D_01C07B06.B545E1D0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I post it again since there is no reponse:

I am trying to build a Filter class derive from the class =
itkFilterMeshToMesh.
(To make things more clear, I attached my header file.)
but when I complie the code, I got the following error message:
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(32) : error =
C2995:
'FilterMeshToMesh<TInputMesh,TOutputMesh>::FilterMeshToMesh<TInputMesh,TO=
utp
utMesh>' : template function has already been defined
        d:\insight\insight\code\common\itkfiltermeshtomesh.h(78) : see
declaration of
'FilterMeshToMesh<TInputMesh,TOutputMesh>::FilterMeshToMesh<TInputMesh,TO=
utp
utMesh>'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(44) : error =
C2995:
'SetInput' : template function has already been defined
        d:\insight\insight\code\common\itkfiltermeshtomesh.h(69) : see
declaration of 'SetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(62) : error =
C2995:
'GetInput' : template function has already been defined
        d:\insight\insight\code\common\itkfiltermeshtomesh.h(74) : see
declaration of 'GetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(75) : error =
C2995:
'GetInput' : template function has already been defined
        d:\insight\insight\code\common\itkfiltermeshtomesh.h(75) : see
declaration of 'GetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(87) : error =
C2995:
'PrintSelf' : template function has already been defined
        d:\insight\insight\code\common\itkfiltermeshtomesh.h(82) : see
declaration of 'PrintSelf'

The code in itkFilterMeshToMesh.h (use SetInput as example):
  typedef TInputMesh InputMeshType;
  typedef typename InputMeshType::Pointer InputMeshPointer;

  /**
   * Set the mesh input of this process object.
   */
  void SetInput(InputMeshType *input);


itkFilterMeshToMesh.txx :
template <class TInputMesh, class TOutputMesh>
void
FilterMeshToMesh<TInputMesh,TOutputMesh>
::SetInput(TInputMesh *input)
{
  this->ProcessObject::SetNthInput(0, input);
}

It seems the complier think InputMeshType and TInputMesh are different.
So how to solve the problem?

Another question is: did any anybody try to include vnl_matrix object in
their class? I always got error messages when I tried to do so.


------=_NextPart_001_000D_01C07B06.B545E1D0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">






I post it again since there is no=20 reponse:
 
I am trying to build a Filter class = derive from=20 the class itkFilterMeshToMesh.
(To make things more clear, I = attached my header=20 file.)
but when I complie the code, I got the following error=20 message:
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(32) : = error=20 C2995:
'FilterMeshToMesh<TInputMesh,TOutputMesh>::FilterMeshToMe= sh<TInputMesh,TOutp
utMesh>'=20 : template function has already been=20 defined
       =20 d:\insight\insight\code\common\itkfiltermeshtomesh.h(78) : = see
declaration=20 of
'FilterMeshToMesh<TInputMesh,TOutputMesh>::FilterMeshToMesh&l= t;TInputMesh,TOutp
utMesh>'
d:\insight\insight\code\common\itkfi= ltermeshtomesh.txx(44)=20 : error C2995:
'SetInput' : template function has already been=20 defined
       =20 d:\insight\insight\code\common\itkfiltermeshtomesh.h(69) : = see
declaration of=20 'SetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(62) = : error=20 C2995:
'GetInput' : template function has already been=20 defined
       =20 d:\insight\insight\code\common\itkfiltermeshtomesh.h(74) : = see
declaration of=20 'GetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(75) = : error=20 C2995:
'GetInput' : template function has already been=20 defined
       =20 d:\insight\insight\code\common\itkfiltermeshtomesh.h(75) : = see
declaration of=20 'GetInput'
d:\insight\insight\code\common\itkfiltermeshtomesh.txx(87) = : error=20 C2995:
'PrintSelf' : template function has already been=20 defined
       =20 d:\insight\insight\code\common\itkfiltermeshtomesh.h(82) : = see
declaration of=20 'PrintSelf'

The code in itkFilterMeshToMesh.h (use SetInput as=20 example):
  typedef TInputMesh InputMeshType;
  typedef = typename=20 InputMeshType::Pointer InputMeshPointer;

  = /**
   * Set=20 the mesh input of this process object.
   */
  void = SetInput(InputMeshType *input);


itkFilterMeshToMesh.txx = :
template=20 <class TInputMesh, class=20 TOutputMesh>
void
FilterMeshToMesh<TInputMesh,TOutputMesh>=
::SetInput(TInputMesh=20 *input)
{
  this->ProcessObject::SetNthInput(0,=20 input);
}

It seems the complier think InputMeshType and = TInputMesh are=20 different.
So how to solve the problem?

Another question is: = did any=20 anybody try to include vnl_matrix object in
their class? I always got = error=20 messages when I tried to do so.
------=_NextPart_001_000D_01C07B06.B545E1D0-- ------=_NextPart_000_000C_01C07B06.B545E1D0 Content-Type: application/octet-stream; name="itkFilterBalloonForceTest.h" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="itkFilterBalloonForceTest.h" /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Program: Insight Segmentation & Registration Toolkit Copyright (c) 2000 National Library of Medicine All rights reserved. See COPYRIGHT.txt for copyright details. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ #ifndef __itkFilterBalloonForceTest_h #define __itkFilterBalloonForceTest_h #include "itkFilterMeshToMesh.h" namespace itk { /** \class FilterMeshToMesh * \brief=20 * * FilterMeshToMesh is the base class for all process objects that = output * mesh data, and require mesh data as input. Specifically, this class * defines the SetInput() method for defining the input to a filter. */ template class ITK_EXPORT FilterBalloonForceTest : public = FilterMeshToMesh { public: /** * Standard "Self" typedef. */ typedef FilterBalloonForceTest Self; /** * Standard "Superclass" typedef. */ typedef FilterMeshToMesh Superclass; /**=20 * Smart pointer typedef support=20 */ typedef SmartPointer Pointer; /** * Method for creation through the object factory. */ itkNewMacro(Self); =20 /**=20 * Run-time type information (and related methods). */ itkTypeMacro(FilterBalloonForceTest,FilterMeshToMesh); /**=20 * Some typedefs. */ typedef TInputMesh InputMeshType; typedef typename InputMeshType::Pointer InputMeshPointer; /**=20 * Set the mesh input of this process object.=20 */ // void SetInput(InputMeshType *input); /**=20 * Get the mesh input of this process object.=20 */ // InputMeshPointer GetInput(); // InputMeshPointer GetInput(unsigned int idx); void ComputeForce(); void Initialize(); void SetStiffnessMatrix(); void Advance(); protected: FilterBalloonForceTest(); ~FilterBalloonForceTest() {}; FilterBalloonForceTest(const FilterBalloonForceTest&) {}; void operator=3D(const FilterBalloonForceTest&) {}; void PrintSelf(std::ostream& os, Indent indent); InputMeshPointer Forces;=20 InputMeshPointer Normals; InputMeshPointer Displacements; double NStiffness[4][4]; double SStiffness[4][4]; double CStiffness[4][4]; =20 double Stiffness[2]; double Timestep; // itk::image Potential; double*** K; =20 }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkFilterMeshToMesh.txx" #endif #endif ------=_NextPart_000_000C_01C07B06.B545E1D0--