[vtkusers] [Insight-users] VRML Importer Example Problem

Dora Szasz dora.szasz at yahoo.com
Fri Aug 17 09:10:57 EDT 2012


Yes, I have tried to mantain the perspective. Yes, it is "squished" in only one direction.

Yes, if I add  importer->SetRenderWindow(renderWindow); in that place works fine.
I don't have the rights to correct it.

Basically, remains this codes that works perfect:

#include <vtkVersion.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkVRMLImporter.h>
#include <vtkDataSet.h>
#include <vtkActorCollection.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkActor.h>
#include <vtkSmartPointer.h>
 
int main ( int argc, char *argv[])
{
  if(argc != 2)
    {
    std::cout << "Required arguments: Filename" << std::endl;
    return EXIT_FAILURE;
    }
 
  std::string filename = argv[1];
  std::cout << "Reading " << filename << std::endl;

  vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
  vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
  renderWindow->AddRenderer(renderer);
 
  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
  renderWindowInteractor->SetRenderWindow(renderWindow);
 
  // VRML Import
  vtkSmartPointer<vtkVRMLImporter> importer = 
    vtkSmartPointer<vtkVRMLImporter>::New();
  importer->SetFileName ( filename.c_str() );
  importer->Read();
  importer->SetRenderWindow(renderWindow);
  importer->Update();
 
  renderWindow->Render();
  renderWindowInteractor->Start();
 
  return EXIT_SUCCESS;
}


________________________________
 From: David Doria <daviddoria at gmail.com>
To: Dora Szasz <dora.szasz at yahoo.com> 
Cc: "vtkusers at vtk.org" <vtkusers at vtk.org> 
Sent: Friday, August 17, 2012 2:59 PM
Subject: Re: [Insight-users] VRML Importer Example Problem
 
On Fri, Aug 17, 2012 at 8:53 AM, Dora Szasz <dora.szasz at yahoo.com> wrote:
> Yes, I sent another email previously to that who solves the problem, in
> which I have attached two images, for demonstration.
> There is one picture with the volume loaded with a ordinary wrl viewer and
> the other one obtained by loading the volume using the example from:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/VRML.
>
> I attached them again, to be able to see the differences, even if in vtk
> list will appear later due to moderator acceptance.
>
> I attached also a picture after the correction I made: correct_with_VTK.tif
>
> I hope that it is clear now.
>
> Dora

Weird - I'm assuming those screenshots are all from the same
perspective? I.e. it seems to be "squished" in only one dimension?

I see now the addition of

  importer->SetRenderWindow(renderWindow);

between the Read() and Update() calls - was that the change that fixed
it? If so, can you please correct it on the wiki?

Thanks!

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120817/770ee32d/attachment.htm>


More information about the vtkusers mailing list