[vtkusers] Access violation in vtkImageThreshold when using vtk 5.0.0 and MSVC++.Net 7.0

Mark Gooding mark.gooding at gmail.com
Wed Feb 22 06:10:03 EST 2006


Hello,

I am trying to use a vtkImageThreshold to separate different out a
ranges of scalar values within a vtkStructurePoints object. The code
runs all the way through the pipeline, by when vtk comes to display an
image I get and Access Violation from within the vtkImageThreshold.
I've ported this code from an old version I had running under Java
(and vtk 4.something). Since the error is occuring within the
vtkImageThreshold, I'm somewhat as a loss as to where to start trying
to find the error. I'm sure the error will be my problem, and nothing
to do with vtkImageThreshold, but I can't imaging what I've done! I've
checked that the extent objects that the vtkImageThreshold acts on
match up with the NumberOfValues within the float array - but beyound
that I'm not sure where I should start tracking down the error. Any
suggestions?

Cheers,

Mark

Brief overview of pipeline:


blobscalars = vtkFloatArray::New();
blobscalars->SetNumberOfValues(xMax*yMax*zMax);

//some code to fill in the blobscalars values

blobstructuredPoints = vtkStructuredPoints::New();
blobstructuredPoints->GetPointData()->SetScalars(blobscalars);
blobstructuredPoints->SetDimensions(xMax, yMax, zMax);
blobstructuredPoints->SetSpacing(pDoc->GetXResolution(),pDoc->GetYResolution(),pDoc->GetZResolution());
blobstructuredPoints->SetOrigin( 0,0,0 );

blobimageThreshold=vtkImageThreshold::New();
blobimageThreshold->SetInput( blobstructuredPoints );
blobimageThreshold->ThresholdBetween(0.5f,1.5f);
blobimageThreshold->SetInValue(1);
blobimageThreshold->SetOutValue(0);
blobimageThreshold->GetOutput()->ReleaseDataFlagOn();

//do some stuff with the result



More information about the vtkusers mailing list