[vtkusers] Problem : vtkStructuredPointsReader
gku
gku at ornl.gov
Mon Jan 13 15:19:58 EST 2003
Hi, Can any one tell me where am I going wrong. I am a newbie in vtk and
trying to run a sample program using vtkStructuredPointsReader, but I am not
able to run it. I have VTK 4.0 with me. And I tried this program form nightly
version too with no success.
Here is my Program.
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkStructuredPointsReader.h>
#include <vtkPiecewiseFunction.h>
#include <vtkVolumeProperty.h>
#include <vtkVolumeRayCastCompositeFunction.h>
#include <vtkVolumeRayCastMapper.h>
#include <vtkVolume.h>
#include <vtkColorTransferFunction.h>
#include <vtkCamera.h>
#include <vtkImageSource.h>
#include <iostream>
using namespace std;
int main( int argc, char *argv[] )
{
vtkRenderer *renderer = vtkRenderer::New();
vtkRenderWindow *renWindow = vtkRenderWindow::New();
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();
vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
vtkPiecewiseFunction *opacity = vtkPiecewiseFunction::New();
vtkColorTransferFunction *color = vtkColorTransferFunction::New();
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
vtkVolume *volume = vtkVolume::New();
renWindow->SetSize(400,400);
reader->SetFileName("/packages/VTK4.1/VTKData/Data/ironProt.vtk");
reader->Update();
opacity->AddSegment(0, 0.0, 255, 0.5);
color->AddRGBPoint(64, 1.0, 0.0, 0.0);
color->AddRGBPoint(128, 1.0, 1.0, 0.0);
color->AddRGBPoint(196, 0.0, 1.0, 1.0);
volumeProperty->SetColor(color);
volumeProperty->SetScalarOpacity(opacity);
volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->ShadeOn();
volumeMapper->SetInput((vtkImageData*) (reader->GetOutput()));
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
renderer->SetBackground(0.2, 0.2, 0.8);
renderer->AddVolume(volume);
renderer->GetActiveCamera()->Azimuth(20.0);
renderer->GetActiveCamera()->Dolly(1.60);
renderer->ResetCameraClippingRange();
interactor->SetRenderWindow(renWindow);
renWindow->AddRenderer(renderer);
renWindow->Render();
interactor->Start();
renderer->Delete();
renWindow->Delete();
interactor->Delete();
reader->Delete();
opacity->Delete();
color->Delete();
volumeProperty->Delete();
compositeFunction->Delete();
volumeMapper->Delete();
volume->Delete();
return 0;
}
The Program compiles properly, But when I run I get the following message
along with a blue screen.
ERROR: In /packages/ParaViewComplete06/VTK/IO/vtkDataReader.cxx, line 370
vtkStructuredPointsReader (0x805a990): No file specified!
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 544
vtkStructuredPoints (0x805aa88): Update extent does not lie within whole
extent
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 551
vtkStructuredPoints (0x805aa88): Update extent is: -1, -1, -1, -1, -1, -1
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 558
vtkStructuredPoints (0x805aa88): Whole extent is: 0, -1, 0, -1, 0, -1
ERROR: In /packages/ParaViewComplete06/VTK/IO/vtkDataReader.cxx, line 370
vtkStructuredPointsReader (0x805a990): No file specified!
ERROR: In /packages/ParaViewComplete06/VTK/IO/vtkDataReader.cxx, line 370
vtkStructuredPointsReader (0x805a990): No file specified!
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 544
vtkStructuredPoints (0x805aa88): Update extent does not lie within whole
extent
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 551
vtkStructuredPoints (0x805aa88): Update extent is: -1, -1, -1, -1, -1, -1
ERROR: In /packages/ParaViewComplete06/VTK/Common/vtkDataObject.cxx, line 558
vtkStructuredPoints (0x805aa88): Whole extent is: 0, -1, 0, -1, 0, -1
ERROR: In /packages/ParaViewComplete06/VTK/IO/vtkDataReader.cxx, line 370
vtkStructuredPointsReader (0x805a990): No file specified!
I have the file name, the file name is proper, and I have tried giving
filename in different ways like (./ironProt.vtk,
$VTK_DATA_ROOT/Data/ironProt.vtk ..etc.).
Answer will be greatly appreciated.
Thanks,
Guru.
More information about the vtkusers
mailing list