[vtkusers] vtkStructuredPointsReader Question
Lukasz Czopyk
Lukasz.Czopyk at ifj.edu.pl
Wed Feb 22 03:20:20 EST 2006
Hallo All,
I am very new user of VTK package and unfortunately not advanced c++
programist (I use Builder c++ 6.0). I want to use vtkStructuredPointsReader
and trying to get used to this I tryed to run following program. Procedure
compiles ok. but after getting run it hangs up and the Exeption
"classEAccesViolation at address...." is thrown.I was playing around it about
two days but have no idea what to do.
Can anyone help me? I would be very grateful for any help?
Lukasz
P.S. the path to ironProt.vtk should be changed I think.
//---------------------------------------------------------------------------
#pragma hdrstop
#include "conio.h"
#include "vtkBMPReader.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkPolyDataNormals.h"
#include "vtkContourFilter.h"
#include "vtkCommon.h"
#include "vtkGraphics.h"
#include "vtkImaging.h"
#include "vtkTextProperty.h"
#include "vtkProperty2D.h"
#include "vtkPlaneWidget.h"
#include "vtkImplicitPlaneWidget.h"
#include "vtkCellData.h"
#include "vtkRectilinearGrid.h"
#include "vtkWindowToImageFilter.h"
#include "vtkStructuredPointsReader.h"
#include "vtkStructuredPoints.h"
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
reader->SetFileName("c:/volren/images/headsq/ironProt.vtk");
reader->Update();
cout<<(reader->GetHeader())<<endl;
vtkContourFilter *iso = vtkContourFilter::New();
iso->SetInput(reader-> GetOutput());
iso->SetValue(0,128);
vtkCleanPolyData *clean = vtkCleanPolyData::New();
clean->SetInput(iso->GetOutput());
vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
normals->SetInput(clean->GetOutput());
normals->SetFeatureAngle(45);
vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();
isoMapper->SetInput(normals->GetOutput());
vtkActor *isoActor = vtkActor::New();
isoActor->SetMapper(isoMapper);
isoActor->GetProperty()->SetColor(0,0,1);
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
ren1->AddActor(isoActor);
ren1->SetBackground(1,1,1); // Background color white
getch();
return 0;
}
//---------------------------------------------------------------------------
****************************************
Lukasz Czopyk
Health Physics Laboratory,
Institute of Nuclear Physics
Radzikowskiego 152 31-342 Krakow Poland
tel +48 660 672 724
****************************************
More information about the vtkusers
mailing list