[vtkusers] Create 3D Volume from 2D DICOM Images
Jothy
jothybasu at gmail.com
Tue Aug 2 08:12:56 EDT 2011
vtkVRMLImporter seems to import only VRML 2.0 files. Check your VRML
version.
Jothy
On Tue, Aug 2, 2011 at 1:01 PM, emreturkoz <emreturkoz at gmail.com> wrote:
> Jothy thank you very much for your help. You made me a great progress.
>
> I also noticed something. With the code I give below, I can visualize
> samples (like fish.wrl), which can be seen so to say in "mesh form". There
> was an example on this
> http://people.sc.fsu.edu/~jburkardt/data/wrl_2/wrl_2.html link called
> red_chair, where a chair to be seen completely. The code below also failed
> to visualize this example.
>
> I get no errors. I only get a blank window as if no actor is loaded. But
> paraView doesn't fail on these samples.
>
> Thank you for your help.
>
> int VRMLReader(){
>
> std::string filename = "fish.wrl";
> std::cout << "Reading " << filename << std::endl;
> // VRML Import
> vtkVRMLImporter *importer=vtkVRMLImporter::New();
> importer->SetFileName(filename.c_str());
> importer->Read();
> importer->Update();
>
> //Convert to vtkDataSet
> vtkDataSet *pDataset;
> vtkActorCollection *actors = importer->GetRenderer()->GetActors();
> actors->InitTraversal();
> pDataset = actors->GetNextActor()->GetMapper()->GetInput(); //Problem
> happened here
>
> //Convert to vtkPolyData
> vtkPolyData *polyData = vtkPolyData::SafeDownCast(pDataset);
> polyData->Update();
>
>
> // Create Normal Vectors to enhance smoothness & illumination
> vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
> normals->SetInput(polyData);
> normals->SetFeatureAngle(60.0);
>
> // Mapper
> vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New();
> SolidMapper->SetInput(normals->GetOutput());
> SolidMapper->ScalarVisibilityOff();
>
> // Actor
> vtkActor *SolidActor = vtkActor::New();
> SolidActor->SetMapper(SolidMapper);
> //SolidActor->GetProperty()->SetOpacity(1);
>
> // Render
> vtkRenderer *ren = vtkRenderer::New();
> ren->AddActor(SolidActor);
> ren->SetBackground(0.1,0.3,0.1);
>
> // RenderWindow
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren);
>
> // RenderWindowInteractor
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> renWin->Start();
> renWin->SetSize(800-5,600-5);
> // interact with data
> iren->Initialize();
> iren->Start();
>
> // delete
>
> actors->Delete();
> normals->Delete();
> SolidMapper->Delete();
> SolidActor->Delete();
> ren->Delete();
> renWin->Delete();
> iren->Delete();
>
> return 0;
>
> }
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658425.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110802/e3db64f5/attachment.htm>
More information about the vtkusers
mailing list