Thomas Boettger | 18 Feb 2004 11:13
Picon

MeshToMeshFilter

Hello everybody,

I tried to define the MeshToMeshFilter subclasses with different 
MeshTypes for input and output meshes. The only difference between the 
meshtraits is the pixel type, which i want to change from input to 
output. I need this because I have different PixelTypes defined to store 
data in the new classes I am writing.

The following code example does not compile:

#include "itkMesh.h"
#include "itkIdentityTransform.h"
#include "itkTransformMeshFilter.h"
#include "itkDefaultStaticMeshTraits.h"

int itkDifferentMeshTypesTest(int, char* [] )
{
   typedef itk::DefaultStaticMeshTraits<float, 3, 3, float, float, 
float> FloatTraits;
   typedef itk::DefaultStaticMeshTraits<double, 3, 3, float,float,float> 
DoubleTraits;

   typedef itk::Mesh<float, 3, FloatTraits> FloatMeshType;
   typedef itk::Mesh<double, 3, DoubleTraits> DoubleMeshType;
   typedef itk::IdentityTransform<float,3>  TransformType;
   typedef itk::TransformMeshFilter<FloatMeshType, DoubleMeshType, 
TransformType> MeshFilterType;
   MeshFilterType::Pointer meshTransformer = MeshFilterType::New();
   return 0;
}

It is not clear what the pixel type is really used for. There should be 
no influence because it is described as the PointData type in the 
documetation.

I attached the code and Visual Studio error output. Where is the mistake?

Regards,

Thomas

-- 
Dipl.-Inform. Thomas Boettger
Deutsches Krebsforschungszentrum         (German Cancer Research Center)
Div. Medical and Biological Informatics B010    Tel: (+49) 6221-42 2328
Im Neuenheimer Feld 280                          Fax: (+49) 6221-42 2345
D-69120 Heidelberg                            e-mail: t.boettger@...
Germany                      http://www.dkfz.de/mbi/people/thomasb.shtml

f:\itk-1.4.0\Code\BasicFilters\itkTransformMeshFilter.txx(105) : error C2664: 'void
itk::PointSet<TPixelType,VDimension,TMeshTraits>::SetPointData(itk::PointSet<TPixelType,VDimension,TMeshTraits>::PointDataContainer
*)' : cannot convert parameter 1 from
'itk::PointSet<TPixelType,VDimension,TMeshTraits>::PointDataContainer *' to
'itk::PointSet<TPixelType,VDimension,TMeshTraits>::PointDataContainer *'
        with
        [
            TPixelType=float,
            VDimension=3,
            TMeshTraits=DoubleTraits
        ]
        and
        [
            TPixelType=float,
            VDimension=3,
            TMeshTraits=itk::DefaultStaticMeshTraits<float,3,3,float,float,float>
        ]
        and
        [
            TPixelType=float,
            VDimension=3,
            TMeshTraits=DoubleTraits
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
        C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(261) : while compiling
class-template member function 'void itk::TransformMeshFilter<TInputMesh,TOutputMesh,TTransform>::GenerateData(void)'
        with
        [
            TInputMesh=FloatMeshType,
            TOutputMesh=DoubleMeshType,
            TTransform=TransformType
        ]
        itkRegularSphereMeshSourceTest.cpp(65) : see reference to class template instantiation
'itk::TransformMeshFilter<TInputMesh,TOutputMesh,TTransform>' being compiled
        with
        [
            TInputMesh=FloatMeshType,
            TOutputMesh=DoubleMeshType,
            TTransform=TransformType
        ]
f:\itk-1.4.0\Code\BasicFilters\itkTransformMeshFilter.txx(118) : error C2664:
'itk::Mesh<float,3,class itk::DefaultStaticMeshTraits<double,3,3,float,float,float>
>::SetBoundaryAssignments' : cannot convert parameter 2 from
'itk::Mesh<TPixelType,VDimension,TMeshTraits>::BoundaryAssignmentsContainerPointer' to
'itk::Mesh<TPixelType,VDimension,TMeshTraits>::BoundaryAssignmentsContainer *'
        with
        [
            TPixelType=float,
            VDimension=3,
            TMeshTraits=itk::DefaultStaticMeshTraits<float,3,3,float,float,float>
        ]
        and
        [
            TPixelType=float,
            VDimension=3,
            TMeshTraits=DoubleTraits
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot
be called

#include "itkMesh.h"
#include "itkIdentityTransform.h"
#include "itkTransformMeshFilter.h"
#include "itkDefaultStaticMeshTraits.h"

int itkDifferentMeshTypesTest(int, char* [] )
{
  typedef itk::DefaultStaticMeshTraits<float, 3, 3, float, float, float> FloatTraits;
  typedef itk::DefaultStaticMeshTraits<double, 3, 3, float, float, float> DoubleTraits;

  typedef itk::Mesh<float, 3, FloatTraits> FloatMeshType;
  typedef itk::Mesh<double, 3, DoubleTraits> DoubleMeshType;
  typedef itk::IdentityTransform<float,3>  TransformType;
  typedef itk::TransformMeshFilter<FloatMeshType, DoubleMeshType, TransformType> MeshFilterType;
  MeshFilterType::Pointer meshTransformer = MeshFilterType::New();
  return 0;
}

Gmane