[vtkusers] Can VTK render huge data? How?

Hao Li haoli2001 at hotmail.com
Sat Jun 18 06:34:58 EDT 2005


Hi Tom and All in mailing list,

Many thanks to tom for his suggestion and good advice although he is mainly
working with Unix.

I am sure I have the latest video driver.  It is realy weird because
Paraview can render honolulu.vtk with Windows OS on my computer without any
problem. But I am getting problem with running following simple code. There
is no any problem with rendering small data file, but trying to view large
data file would lead to no response of the program as told by Windows Task
Manager.

Would anybody like to try following code on  Windows OS (please set up a
project of Win32 console application with Visual C++.net ).

#include "stdafx.h"
#include "vtkDataSetReader.h"
#include "vtkDataSetMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"

//#include <unistd.h>

int _tmain(int argc, _TCHAR* argv[])
{

   vtkDataSetReader *reader = vtkDataSetReader::New();
   vtkDataSetMapper *mapper = vtkDataSetMapper::New();
   vtkActor *actor = vtkActor::New();
   vtkRenderer *ren = vtkRenderer::New();
   vtkRenderWindow *rw  = vtkRenderWindow::New();

   reader->SetFileName("C:\honolulu.vtk");
   mapper->SetInput(reader->GetOutput());
   actor->SetMapper(mapper);

   ren->AddActor(actor);
   rw->AddRenderer(ren);

   rw->Render();
   return 0;
}

You have to find data file of honolulu.vtk from CD attached to VTK user
guide or download from kitware, or You can make a vtk data file with huge
data (over 20 M).  You'd better try to change different data file for this
code to see if it works well.   If you can render  honolulu.vtk or larger
vtk data file, please let me know. Or maybe you have some ideas on my code
of rendering large data file on Windows OS, please give me suggestion.

Thanks for any help!

Regards/Henry

----- Original Message ----- 
From: "tom fogal" <tfogal at apollo.sr.unh.edu>
To: "Hao Li" <haoli2001 at hotmail.com>
Sent: Friday, June 17, 2005 6:21 PM
Subject: Re: [vtkusers] Can VTK render huge data? How?


> <BAY107-DAV7BD0F827A943328C80EF6AFF40 at phx.gbl>"Hao Li" writes:
> >Are you using Unix system?  You can make it. But I tried it on Windows
>
> Yes, I am on Linux. I ccmake'd it and it built Makefiles, given some
> warnings. The code wouldn't compile because the case of #includes
> differed from the case of filenames; I didn't want to go through the
> hassle of trying to fix that. Plus the "MFC" in the name led me to
> believe that even if I fixed the headers, it would choke because I (of
> course) don't have the MFC.
>
> >system, but failed.  With small data file, there is no problem. But with
> >large data file such as honolulu.vtk, this application would stop
running.
>
> this is really weird.
>
> >If checking Window Task Manager, you would find no response with this
> >application.  Actually I have debugged my code.  There is no problem with
> >read, map, and add to actor. It seems that the program got a trouble with
> >windows rendering.  Do you have any idea of solving this problem? or do
you
> >know someone who is playing around VTK with Windows System and could help
me
> >out with this problem?
>
> unfortunately i'm at a loss here; I haven't used a windows box in many
> years now. Try ensuring you have the latest DX / video drivers / etc,
> thats what windows users always seem to recommend to each other...
>
> If you didn't compile VTK from source, I would recommend trying that.
> Sometimes a bad library issue is much easier to recognize during link
> time than load time.
>
> >I am trying to set up a program to visualize huge data related to mining
> >engineering, but stucked here. Hopefully I can get around it.  Thank you
> >very much for your quick response and help.
>
> Sorry I couldn't be of more help.
>
> BTW, you sent this just to me; you might have meant to CC the vtk list.
> Feel free to include my replies here on the mailing list, if you decide
> to follow up there.
>
> >Good weekend!
>
> You too!
>
> -tom
>
> >Following is the C++ Code I tried with Visual C++ .net (same as yours,
but
> >is win32 console application),
> >
> >#include "stdafx.h"
> >#include "vtkDataSetReader.h"
> >#include "vtkDataSetMapper.h"
> >#include "vtkActor.h"
> >#include "vtkRenderer.h"
> >#include "vtkRenderWindow.h"
> >
> >//#include <unistd.h>
> >
> >int _tmain(int argc, _TCHAR* argv[])
> >{
> >
> >   vtkDataSetReader *reader = vtkDataSetReader::New();
> >   vtkDataSetMapper *mapper = vtkDataSetMapper::New();
> >   vtkActor *actor = vtkActor::New();
> >   vtkRenderer *ren = vtkRenderer::New();
> >   vtkRenderWindow *rw  = vtkRenderWindow::New();
> >
> >   reader->SetFileName("C:\honolulu.vtk");
> >   mapper->SetInput(reader->GetOutput());
> >   actor->SetMapper(mapper);
> >
> >   ren->AddActor(actor);
> >   rw->AddRenderer(ren);
> >
> >   rw->Render();
> >   return 0;
> >}
> >
> >
> >
> >----- Original Message ----- 
> >From: "tom fogal" <tfogal at apollo.sr.unh.edu>
> >To: "Hao Li" <haoli2001 at hotmail.com>
> >Cc: <vtkusers at vtk.org>
> >Sent: Friday, June 17, 2005 2:54 PM
> >Subject: Re: [vtkusers] Can VTK render huge data? How?
> >
> >
> >> <BAY107-DAV109886E9A8126763E8DC80AFF40 at phx.gbl>"Hao Li" writes:
> >> <snip>
> >> >come from VTK user guide and textbook. I just made a little
modification
> >for
> >> >trial run.  Having compiled sampleMFC, I tried to use it to open some
> >data
> >> >files of *.vtk.  There is no problem to open and view small data
files,
> >but
> >> >if trying to read honolulu.vtk, it failed.  I got the same problem
with
> >> >deciHama.tcl.  Actually there is no any problem with honolulu.vtk
because
> >> >paraview can open it without any problem.   I really don't know what
is
> >> >going on there.  Can you give me a hint ?
> >>
> >> I didn't really look at SampleMFC as I don't have windows; also I don't
> >> have vtk wrapping setup for tcl either. But I wrote a simple C++ app to
> >> check for myself:
> >>
> >> #include "vtkPolyDataReader.h"
> >> #include "vtkPolyDataMapper.h"
> >> #include "vtkActor.h"
> >> #include "vtkRenderer.h"
> >> #include "vtkRenderWindow.h"
> >>
> >> #include <unistd.h>
> >>
> >> int main() {
> >>    vtkPolyDataReader *reader = vtkPolyDataReader::New();
> >>    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
> >>    vtkActor *actor = vtkActor::New();
> >>    vtkRenderer *ren = vtkRenderer::New();
> >>    vtkRenderWindow *rw  = vtkRenderWindow::New();
> >>
> >>    reader->SetFileName("tarballs/vtkdata/honolulu.vtk");
> >>    mapper->SetInput(reader->GetOutput());
> >>    actor->SetMapper(mapper);
> >>
> >>    ren->AddActor(actor);
> >>    rw->AddRenderer(ren);
> >>
> >>    rw->Render();
> >>    sleep(5);
> >> }
> >>
> >> The app displays what appears to be a beach. The only thing that I can
> >> imagine you might have done wrong is telling VTK to render a wireframe
> >> of the Actor instead of the actor -- is there any reason for that?
> >> Sometimes a wireframe doesn't really make sense and you can end up with
> >> thin lines that are hard to see or too small to be rendered.
> >>
> >> Also I usually call RenderWindow->Render() because initializing a
> >> RW-Interactor. I'm not sure if this is because its required or if I
> >> just acquired that habit... (it doesn't \emph{seem} like it should be
> >> required)
> >>
> >> HTH,
> >>
> >> -tom
> >>
> >> >From: "tom fogal" <tfogal at apollo.sr.unh.edu>
> >> >To: "Hao Li" <haoli2001 at hotmail.com>
> >> >Cc: <vtkusers at vtk.org>
> >> >Sent: Thursday, June 16, 2005 6:44 PM
> >> >Subject: Re: [vtkusers] Can VTK render huge data? How?
> >> >
> >> >
> >> >> <BAY107-DAV6108BF0601705C197E82DAFF50 at phx.gbl>"Hao Li" writes:
> >> >> >Hi Guys,
> >> >> >
> >> >> >vtkPolyDataReader reader
> >> >> >reader SetFileName "$env(VTK_TEXTBOOK_DATA)/honolulu.vtk"
> >> >> >
> >> >> >vtkPolyDataMapper hawaiiMapper
> >> >> >
> >> >> >hawaiiMapper SetInput [reader GetOutput]
> >> >>
> >> >> ... is that the whole script or was there a copy-paste error here?
> >> >>
> >> >> >I ended up with no any ploygon showing on my screen.   Data file of
> >> >> >honolulu.vtk is 15 M. I tried other large data. It seems that VTK
has
> >> >some
> >> >> >problem with handling huge data. Can anybody tell me how to deal
with
> >> >huge
> >> >> >data such as over 60M?
> >> >>
> >> >> unless you're missing part of your script above, this isn't because
of
> >> >> the size of the data file (actually, I'd say 60 meg is quite small).
> >> >> VTK shouldn't have any problems with datasets of this size (it
doesn't
> >> >> for me, at least).
> >> >>
> >> >> The problem with the above script is that you never actually do any
> >> >> rendering. After mapping a dataset into polydata, you'll want to
> >> >> encapsulate that mapping in a vtkActor, and then setup a vtkRenderer
to
> >> >> render that (and maybe other) actors. Finally you'll probably want
some
> >> >> sort of vtkRenderWindow to display the rendered image, so that you
can
> >> >> see it.
> >> >>
> >> >> -tom
> >>
>



More information about the vtkusers mailing list