[Insight-users] itkVTKPolyDataWriter doesn't write edges?
David Doria
daviddoria+itk at gmail.com
Thu Sep 17 19:02:19 EDT 2009
It seems as though edges are not converted to lines or whatever it is
necessary to do in a vtk file to view a "wireframe" in Paraview.
An example would be something like this:
#include "itkQuadEdgeMesh.h"
#include "itkLineCell.h"
#include "/home/doriad/src/Insight/Code/Review/itkVTKPolyDataWriter.h"
#include <string>
const unsigned int Dimension = 3;
typedef itk::QuadEdgeMesh< float, Dimension > MeshType;
int main(int argc, char * argv[])
{
if(argc != 2)
{
std::cout << "Required arguments: Filename" << std::endl;
exit(-1);
}
std::string Filename = argv[1];
MeshType::Pointer mesh = MeshType::New();
//create points
MeshType::PointType p0,p1,p2,p3;
p0[0] = -1.0; p0[1]= -1.0; p0[2]= 0.0; // first point ( -1, -1, 0 )
p1[0] = 1.0; p1[1]= -1.0; p1[2]= 0.0; // second point ( 1, -1, 0 )
p2[0] = 1.0; p2[1]= 1.0; p2[2]= 0.0; // third point ( 1, 1, 0 )
p3[0] = 1.0; p3[1]= 1.0; p3[2]= 1.0; // third point ( 1, 1, 1 )
mesh->SetPoint( 0, p0 );
mesh->SetPoint( 1, p1 );
mesh->SetPoint( 2, p2 );
mesh->SetPoint( 3, p3 );
std::cout << "NumPoints = " << mesh->GetNumberOfPoints() << std::endl;
//create 2 edges
mesh->AddEdge(0, 1);
mesh->AddEdge(1, 2);
std::cout << "NumEdges = " << mesh->GetNumberOfEdges() << std::endl;
typedef itk::VTKPolyDataWriter< MeshType > WriterType;
WriterType::Pointer SubmeshWriter = WriterType::New();
SubmeshWriter->SetFileName(Filename);
SubmeshWriter->SetInput(mesh);
SubmeshWriter->Update();
SubmeshWriter->Write();
return 0;
}
I would expect to be able to see these two edges in Paraview. Anyone
agree/disagree?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090917/ab3ea5df/attachment.htm>
More information about the Insight-users
mailing list