[vtkusers] R: vtkDICOMImageReader
Zampini Samuele
samuele.zampini at epfl.ch
Wed Jul 29 11:06:58 EDT 2009
In fact this is a good question.
I mean: in the file I created to build a scene with 2 cones (just to learn vtk)
I wrote this code
#include "creating-sphere-and-cube.hpp"
//Creates a scene consisting of some simple figures
/*vtkRenderer *create_scene()
{
vtkConeSource *cone1 = vtkConeSource::New();
cone1->SetHeight(1);
cone1->SetRadius(0.5);
cone1->SetResolution(150);
vtkPolyDataMapper *cone1_map = vtkPolyDataMapper::New();
cone1_map->SetInput(cone1->GetOutput());
vtkActor *cone1_actor = vtkActor::New();
cone1_actor->SetMapper(cone1_map);
cone1_actor->SetPosition(0,3,0);
cone1_actor->GetProperty()->SetColor(1,0,0);
vtkPlane *plane1 = vtkPlane::New();
plane1->SetOrigin(0.0005,0.0,0.0);
plane1->SetNormal(-1.0,0.0,0.0);
cone1_map->AddClippingPlane(plane1);
vtkConeSource *cone2 = vtkConeSource::New();
cone2->SetHeight(1);
cone2->SetRadius(0.5);
cone2->SetResolution(150);
vtkPolyDataMapper *cone2_map = vtkPolyDataMapper::New();
cone2_map->SetInput(cone2->GetOutput());
vtkActor *cone2_actor = vtkActor::New();
cone2_actor->SetMapper(cone2_map);
cone2_actor->SetPosition(0,3,0);
cone2_actor->RotateZ(180);
cone2_actor->GetProperty()->SetColor(0,0,0);
vtkPlane *plane2 = vtkPlane::New();
plane2->SetOrigin(0.0005,0.0,0.0);
plane2->SetNormal(1.0,0.0,0.0);
cone2_map->AddClippingPlane(plane2);
vtkAxes *axes = vtkAxes::New();
axes->SetOrigin(0,0,0);
vtkTubeFilter *axes_tubes = vtkTubeFilter::New();
axes_tubes->SetInputConnection(axes->GetOutputPort());
axes_tubes->SetRadius(axes->GetScaleFactor()/100.0);
axes_tubes->SetNumberOfSides(3);
vtkPolyDataMapper *axes_mapper = vtkPolyDataMapper::New();
axes_mapper->SetInputConnection(axes_tubes->GetOutputPort());
vtkActor *axes_actor = vtkActor::New();
axes_actor->SetMapper(axes_mapper);
vtkRenderer *ren1 = vtkRenderer::New();
ren1->AddActor(cone1_actor);
ren1->AddActor(cone2_actor);
ren1->AddActor(axes_actor);
ren1->SetBackground(1,1,1);
return ren1;
}*/
and so I returned the ren1 to see what I "produced".
Now my question is how I can put the data that I read in the DICOM files into a .vti file and,
above all, how I can make them "visible".
I know I should return something like a Rendering scene, but I can not understand how to do this.
Could you help?
________________________________________
Da: Martijn de Greef [m.d.greef at gmail.com]
Inviato: mercoledì 29 luglio 2009 16.52
A: Zampini Samuele
Cc: vtkusers at vtk.org
Oggetto: Re: [vtkusers] vtkDICOMImageReader
Why are you, according to the function definition, returning a pointer to a vtkRenderer object? There is nothing in the body itself that creates a pointer to a renderer (you are returning 0).
regards,
Martijn
On Wed, Jul 29, 2009 at 4:25 PM, Zampini Samuele <samuele.zampini at epfl.ch<mailto:samuele.zampini at epfl.ch>> wrote:
Dear vtk-friends,
I have a question about vtkDICOMImageReader.
I read carefully older posts about this argument,
but I can not find the solution.
Could you help???
This is my code:
vtkRenderer *create_scene()
{
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
//vtkImageViewer2 *viewer = vtkImageViewer2::New();
reader->SetDirectoryName( "/usr/scratch/zampini/vmtk/dicom/pa1/st1/se1/" );
reader->Update();
vtkStructuredPointsWriter *writer = vtkStructuredPointsWriter::New();
writer->SetInput( reader->GetOutput() );
writer->SetFileName( "test.vtk" );
writer->Write();
return 0;
}
I can compile it (no errors) but when I run it I get a segmentation fault.
Could you help?
Thanks a lot,
samuele.
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list