[vtkusers] Image reader problem
Audi
audi2006 at singnet.com.sg
Wed Jan 31 10:03:38 EST 2001
Hi!
I tried to run the sample code that is inside the user guide
but I cannot get the output window and it always give error
when I use the file prefix like the one inside the sample code.
this is the program that i try to run it, can anybody help me to find what
is the problem?
regards,
Audi
#include "vtkImageViewer.h"
#include "vtkImageReader.h"
#include "vtkImageMagnify.h"
#include "vtkImageShrink3D.h"
#include "vtkImageGradient.h"
#include "vtkImageDataStreamer.h"
void main( int argc, char *argv[] )
{
int i, j;
vtkImageReader *reader = vtkImageReader::New();
reader->SetFilePrefix("c:/vtkdata/fullHead/headsq"); /*it prompts me error
when I use "../../../vtkdata/fullHead/headsq"*/
reader->SetDataByteOrderToBigEndian();
reader->SetDataExtent(0,255,0,255,1,93);
reader->SetDataMask(0x7fff);
vtkImageMagnify *mag = vtkImageMagnify::New();
mag->SetInput(reader->GetOutput());
mag->SetMagnificationFactors(3,3,1);
vtkImageGradient *grad = vtkImageGradient::New();
grad->SetInput(mag->GetOutput());
grad->SetDimensionality(3);
vtkImageShrink3D *shrink = vtkImageShrink3D::New();
shrink->SetInput(grad->GetOutput());
shrink->SetShrinkFactors(3,3,1);
vtkImageDataStreamer *ids = vtkImageDataStreamer::New();
ids->SetInput(shrink->GetOutput());
ids->SetMemoryLimit(40000);
ids->UpdateWholeExtent();
vtkImageViewer *viewer = vtkImageViewer::New();
viewer->SetInput(ids->GetOutput());
viewer->SetColorLevel(0);
viewer->SetColorWindow(200);
//interact with data
for (j=0;j<10;j++)
{
for (i=0; i<93; i++)
{
viewer->SetZSlice(i);
viewer->Render();
}
}
//Clean Up
viewer->Delete();
reader->Delete();
grad->Delete();
shrink->Delete();
mag->Delete();
}
More information about the vtkusers
mailing list