Hi,
I am facing some problems using mitk::Mesh. When creating a very simple
instance of mitk::Mesh and adding it to the DataTree of my application
(using the SampleApplication with my own Functionality). It compiles
fine and shows the two nodes in the 3D view, but crashes with a
segmentation fault, as soon as the render window is reloaded (for
example when I minimize and enlarge the application window, change a
property with the DataManager, or something like that).
Please have a look at a part of my commented source code below. Is this
the way mitk::Mesh should be used? Or is there a less complex method? Do
you have an idea, where such a segmentation fault could come from?
Thank you very much in advance.
Regards,
Melanie Kleiner
// Get the DataTreeIterator:
mitk::DataTreeIteratorBase *datatreeit = this->GetDataTreeIterator();
// typdefs for itk::Mesh:
typedef itk::Mesh< mitk::PointSet::PointDataType, 3,
itk::DefaultDynamicMeshTraits<mitk::PointSet::PointDataType, 3u, 3u,
float, float,mitk::PointSet::CellDataType> > MeshType;
typedef MeshType::CellType CellType;
typedef itk::VertexCell< CellType > VertexType;
typedef itk::LineCell< CellType > LineType;
typedef CellType::CellAutoPointer CellAutoPointer;
// new itk::Mesh
MeshType::Pointer itkmesh = MeshType::New();
// Add two points to the itk::Mesh:
MeshType::PointType point1, point2;
point1[0] = 0;
point1[1] = 0;
point1[2] = 0;
point2[0] = 5;
point2[1] = 6;
point2[2] = 7;
itkmesh->SetPoint( 0, point1 );
itkmesh->SetPoint( 1, point2 );
// Create two vertex cells from these points:
CellAutoPointer vertex1, vertex2;
vertex1.TakeOwnership(new VertexType);
vertex2.TakeOwnership(new VertexType);
vertex1->SetPointId(0,0);
vertex2->SetPointId(0,1);
// Create a line cell connecting both points:
CellAutoPointer line;
line.TakeOwnership(new LineType);
line->SetPointId(0,0);
line->SetPointId(1,1);
// Add these Cells to the itk::Mesh:
itkmesh->SetCell( 0, vertex1 );
itkmesh->SetCell( 1, vertex2 );
itkmesh->SetCell( 2, line );
// Create mitk::Mesh:
mitk::Mesh::Pointer mesh = mitk::Mesh::New();
// Assing the itk data to the mitk::Mesh
mesh->SetMesh( itkmesh );
// Create a data tree node with mitk::Mesh:
mitk::DataTreeNode::Pointer meshNode = mitk::DataTreeNode::New();
meshNode->SetData(mesh);
meshNode->SetProperty("name",new mitk::StringProperty("Gitter"));
// Add the node to the data tree
datatreeit->Add(meshNode);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users