[vtkusers] easy example

Dominik Paul dpaul at ira.uka.de
Wed Mar 7 07:30:27 EST 2001


Helle there

does somebody have any very easy examples for dreactin an ImagaData and
showing it?

My example isnt running, that means the window shows nothing, just black

Dom

Example:

#include <vtkImageData.h>
#include <vtkImageViewer.h>
#include <iostream.h>
#include <vtktiffreader.h>
#include <vtkimagereader.h>




main()
{


 //vtkTiffReader* theReader = vtkTiffReader::New();
 vtkImageReader* theReader = vtkImageReader::New();
 theReader ->SetFileName("Testbild");

 void  SetFileName (const char *)
 vtkImageData* volume = vtkImageData::New();



  volume -> Print(cout);
  volume -> UpdateInformation();
  volume -> Update();
  volume -> Print(cout);

     vtkImageViewer* theViewer = vtkImageViewer::New();
  theViewer -> SetInput(volume);
  theViewer -> SetZSlice(2);
  theViewer -> Render();

  while (1)
  {
  theViewer -> SetInput(volume);
  theViewer -> SetZSlice(2);
  theViewer -> Render();

  int hallo;
  cin >> hallo;
  if (hallo == 1) break;
  }
}






More information about the vtkusers mailing list