[Insight-users] Compilation error for TCoordRep=float in MeshTraits
Dan Mueller
dan.muel at gmail.com
Thu Oct 9 04:52:25 EDT 2008
Hi Insight Users,
I am trying to use itk::DeformableSimplexMesh3DFilter with a specific
mesh trait. However I am encountering compilation errors. Can someone
point out what I am doing wrong?
Changing TCoordRep (below) from float to double makes the error go
away. However, I would like the pixel type and coord rep type to be
the same (ie. float). Why is this not allowed?
=== Source code ===
#include "itkDefaultDynamicMeshTraits.h"
#include "itkSimplexMesh.h"
#include "itkDeformableSimplexMesh3DFilter.h"
int main(int argc, char* argv[]) {
const unsigned int Dimension = 3;
typedef float PixelType;
//typedef double CoordRepType; // This one works!
typedef float CoordRepType; // This one doesn't work :(
typedef itk::DefaultDynamicMeshTraits<
PixelType,Dimension,Dimension,CoordRepType > MeshTraits;
typedef itk::SimplexMesh< PixelType,Dimension,MeshTraits > MeshType;
typedef itk::DeformableSimplexMesh3DFilter < MeshType,MeshType > DeformType;
DeformType::Pointer deform = DeformType::New();
}
=== CMake ===
PROJECT(MeshFloatTest)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
INCLUDE_DIRECTORIES(
BEFORE
${MeshFloatTest_SOURCE_DIR}
)
ADD_EXECUTABLE(MeshFloatTest main.cxx)
TARGET_LINK_LIBRARIES(MeshFloatTest ITKCommon)
=== Compilation error(s) ===
1>------ Build started: Project: MeshFloatTest, Configuration: Debug
Win32 ------
1>Compiling...
1>main.cxx
1>d:\insighttoolkit-3.8.0\code\algorithms\itkDeformableSimplexMesh3DFilter.txx(164)
: error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'itk::Point<TCoordRep,NPointDimension>' (or there is
no acceptable conversion)
1> with
1> [
1> TCoordRep=float,
1> NPointDimension=3
1> ]
1> d:\insighttoolkit-3.8.0\code\common\itkPoint.h(82): could be
'itk::Point<TCoordRep,NPointDimension>
&itk::Point<TCoordRep,NPointDimension>::operator =(const
itk::Point<TCoordRep,NPointDimension> &)'
1> with
1> [
1> TCoordRep=double,
1> NPointDimension=3
1> ]
1> d:\insighttoolkit-3.8.0\code\common\itkPoint.h(83): or
'itk::Point<TCoordRep,NPointDimension>
&itk::Point<TCoordRep,NPointDimension>::operator =(const double [])'
1> with
1> [
1> TCoordRep=double,
1> NPointDimension=3
1> ]
1> while trying to match the argument list
'(itk::SimplexMeshGeometry::PointType,
itk::Point<TCoordRep,NPointDimension>)'
1> with
1> [
1> TCoordRep=float,
1> NPointDimension=3
1> ]
1> d:\insighttoolkit-3.8.0\code\algorithms\itkDeformableSimplexMesh3DFilter.txx(134)
: while compiling class template member function 'void
itk::DeformableSimplexMesh3DFilter<TInputMesh,TOutputMesh>::Initialize(void)'
1> with
1> [
1> TInputMesh=MeshType,
1> TOutputMesh=MeshType
1> ]
1> ..\main.cxx(13) : see reference to class template
instantiation 'itk::DeformableSimplexMesh3DFilter<TInputMesh,TOutputMesh>'
being compiled
1> with
1> [
1> TInputMesh=MeshType,
1> TOutputMesh=MeshType
1> ]
=== Platform ===
ITK 3.8
CMake 2.6.0
Windows XP (64-bit)
Visual Studio 2005 (8.0.50727.762)
Thanks for any help regarding this matter.
Cheers, Dan
More information about the Insight-users
mailing list