[Insight-users] Writing mesh to Metafile

Dominique Zosso zosso at tele.ucl.ac.be
Thu Dec 8 11:57:33 EST 2005


Hello,

I'm trying to save an itkIndexedTriangleMesh (author : Tobias Heimann.
Division Medical and Biological Informatics,  German Cancer Research Center,
Heidelberg, Germany ) in some meta-file.

itkIndexedTriangleMesh is a class derived from itkMesh offering additional
CellLink-functionalities.

According to the SoftwareGuide, I put the mesh into a MeshSpatialObject and
try to write this latter into a meta-file. The source code doing this is
given below.

The evolveMesh-Output is already calculated when it is assigned to the
meshSpatialObject. No need to update. (see Meta-Output)

The program crashes as soon as I try to update the SpatialObjectWriter, with
a segmentation fault. There is not even an itkException being catched by the
block. Does anybody have an idea what could be wrong? Or is there another
way to save a mesh?

Thank you for every piece of advice!!

For your information, I'm using ITK 2.2.0, and c++ (GCC) 4.0.2 20050808
(prerelease)  on Ubuntu 4.0.1-4ubuntu9.


Thanks a lot, Dominique


Piece of code producing the crash:
**************************

  MeshSpatialObjectType::Pointer meshSpatialObject =
MeshSpatialObjectType::New();
  meshSpatialObject->SetMesh( evolveMesh->GetOutput() );

  MeshWriterType::Pointer meshWriter = MeshWriterType::New();
  meshWriter->SetInput( meshSpatialObject );
  meshWriter->SetFileName( "mesh.meta" );

  std::cout << std::endl << " meshSpatialObject : " << std::endl <<
meshSpatialObject << std::endl;
  std::cout << std::endl << " meshWriter : " << std::endl << meshWriter <<
std::endl;

  try
  {
    meshWriter->Update();
  }
  catch ( itk::ExceptionObject & err )
  {
    std::cerr << " Could not write mesh meta file. Going down *tilt* " <<
std::endl;
    std::cerr << err << std::endl;
    return EXIT_FAILURE;
  }



And the console output produced before crashing:
**************************************

meshSpatialObject :
MeshSpatialObject (0x82e0a60)
  RTTI typeinfo:   itk::MeshSpatialObject<itk::IndexedTriangleMesh<short,
unsigned int, double> >
  Reference Count: 3
  Modified Time: 26050
  Debug: Off
  Observers:
    none
  Source: (none)
  Source output index:  0
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 0
Bounding Box:
  Object (0x82e08f0)
  RTTI typeinfo:   itk::BoundingBox<unsigned long, 3, double,
itk::VectorContainer<unsigned long, itk::Point<double, 3u> > >
  Reference Count: 2
  Modified Time: 26004
  Debug: Off
  Observers:
    none
  Bounding Box: ( 60.3259,140.075 60.3259,140.072 60.2,140.6  )

Geometric properties:
  Object to World Transform: ScalableAffineTransform (0x8412150)
  RTTI typeinfo:   itk::ScalableAffineTransform<double, 3u>
  Reference Count: 2
  Modified Time: 26009
  Debug: Off
  Observers:
    none
  Matrix:
    1 0 0
    0 1 0
    0 0 1
  Offset: [0, 0, 0]
  Center: [0, 0, 0]
  Translation: [0, 0, 0]
  Inverse:
    1 0 0
    0 1 0
    0 0 1
  Singular: 0
  Scale : 1 1 1
  MatrixScale : 1 1 1

  Index to World Transform: ScalableAffineTransform (0x83e6930)
  RTTI typeinfo:   itk::ScalableAffineTransform<double, 3u>
  Reference Count: 3
  Modified Time: 26017
  Debug: Off
  Observers:
    none
  Matrix:
    1 0 0
    0 1 0
    0 0 1
  Offset: [0, 0, 0]
  Center: [0, 0, 0]
  Translation: [0, 0, 0]
  Inverse:
    1 0 0
    0 1 0
    0 0 1
  Singular: 0
  Scale : 1 1 1
  MatrixScale : 1 1 1



  Bounding Box Children Depth: 9999999
  Bounding Box Children Name:
Object properties:
SpatialObjectProperty (0x82e0960)
  RTTI typeinfo:   itk::SpatialObjectProperty<float>
  Reference Count: 2
  Name:
  RGBA: 1 1 1

Mesh:
m_IsInsidePrecision: 1
  IndexedTriangleMesh (0x82e0b80)
  RTTI typeinfo:   itk::IndexedTriangleMesh<short, unsigned int, double>
  Reference Count: 3
  Modified Time: 26050
  Debug: Off
  Observers:
    none
  Source: (0x83151e0)
  Source output index: 0
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 22445
  UpdateMTime: 25842
  Number Of Points: 402
  Requested Number Of Regions: 1
  Requested Region: 0
  Buffered Region: 0
  Maximum Number Of Regions: 1
  Number Of Points: 402
  Number Of Cell Links: 402
  Number Of Cells: 800
  Size of Cell Data Container: 800
  Number of explicit cell boundary assignments: 2
  CellsAllocationMethod: 3
  Number Of Edges: 1200
  Number Of Faces: 800



 meshWriter :
SpatialObjectWriter (0x8432e38)
  RTTI typeinfo:   itk::SpatialObjectWriter<3u, short,
itk::DefaultStaticMeshTraits<short, 3u, 2u, double, double, short> >
  Reference Count: 2
  Modified Time: 26056
  Debug: Off
  Observers:
    none

Erreur de segmentation


---
Dominique Zosso
cand. ing. el. EPFL




More information about the Insight-users mailing list