<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span>I was able to solve this problem. So, the example </span><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/VRML" style="font-size: 12pt; ">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/VRML</a> is quite wrong, because it shrinks the volume.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I attached here the code, but it has some lights options, also, because I need them.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div><div>#include <vtkVersion.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkRenderWindowInteractor.h></div><div>#include
<vtkVRMLImporter.h></div><div>#include <vtkDataSet.h></div><div>#include <vtkActorCollection.h></div><div>#include <vtkPolyData.h></div><div>#include <vtkPolyDataMapper.h></div><div>#include <vtkPolyDataNormals.h></div><div>#include <vtkActor.h></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkRendererCollection.h></div><div>#include <vtkLight.h></div><div> </div><div>int main ( int argc, char *argv[])</div><div>{</div><div> if(argc != 2)</div><div> {</div><div> std::cout << "Required arguments: Filename" << std::endl;</div><div> return EXIT_FAILURE;</div><div> }</div><div> </div><div> std::string filename = argv[1];</div><div> std::cout << "Reading " << filename << std::endl;</div><div> </div><div> vtkSmartPointer<vtkRenderer> ren1=
vtkSmartPointer<vtkRenderer>::New();</div><div> vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();</div><div> renderWindow->AddRenderer(ren1);</div><div><br></div><div> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div> renderWindowInteractor->SetRenderWindow(renderWindow);</div><div> // VRML Import</div><div> vtkSmartPointer<vtkVRMLImporter> importer = vtkSmartPointer<vtkVRMLImporter>::New();</div><div> importer->SetFileName ( filename.c_str() );</div><div> importer->Read();</div><div> importer->SetRenderWindow(renderWindow);</div><div> importer->Update();</div><div> </div><div>ren1=importer->GetRenderer();</div><div>vtkRendererCollection *renCollection=vtkRendererCollection::New();</div><div>renCollection =
renderWindow->GetRenderers();</div><div>renCollection->InitTraversal();</div><div>vtkRenderer *ren= vtkRenderer::New();</div><div>ren = renCollection->GetNextItem();</div><div><br></div><div>ren->ResetCamera();</div><div>vtkLight *light1=vtkLight::New();</div><div>light1->SetLightTypeToCameraLight ();</div><div>ren->AddLight(light1);</div><div><br></div><div>vtkActorCollection *actorcol=vtkActorCollection::New();</div><div>actorcol=ren->GetActors();</div><div><br></div><div>vtkActor *actor=vtkActor::New();</div><div>actor=actorcol->GetLastActor();</div><div><br></div><div>vtkMapper *map=actor->GetMapper();</div><div>vtkDataSet *PolyData=map->GetInput();</div><div><br></div><div>ren->AddActor(actor);</div><div>renderWindow->Render();</div><div>renderWindowInteractor->Start();</div><div> </div><div> return EXIT_SUCCESS;</div><div>}</div></div> <div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt; "> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Dora Szasz <dora.szasz@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> "insight-users@itk.org" <insight-users@itk.org> <br><b><span style="font-weight: bold;">Cc:</span></b> "vtkusers@vtk.org" <vtkusers@vtk.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, August 17, 2012 1:19 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> VRML Importer Example Problem<br> </font> </div> <br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv818114951"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><div>Hello all,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; ">I have tried to load a .wrl volume using vtkVRMLImporter.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; ">Everything works fine, but the volume is shrinked. Can you tell me why? The other problem is that the color of the volume is not loaded.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color:
transparent; font-style: normal; ">I have attached here 2 pictures: one with the volume loaded with a WRLViewer and the other with the volume loaded with VTK.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; ">Thank you,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times, serif; background-color: transparent; font-style: normal; ">Dora</div></div></div></div><meta http-equiv="x-dns-prefetch-control" content="on"><br><br> </div> </div> </div></body></html>