[vtkusers] large datasets cause segmentation faults
Tim Peeters
timp at stack.nl
Thu Sep 26 07:02:39 EDT 2002
Hi,
I have a problem. I am creating a library (DLL) with MS Visual C++ .NET
that I will use in another (medical) application. With that library I read
medical
data (MRI/CT scans) and then use VTK 3.2.0 to visualise it. Currently I am
trying
to visualise it by extracting ISO-surfaces using vtkMarchingCubes.
But the datasets are too large to interactively change the threshold for
marching
cubes, so I used vtkImageShrink3D to reduce the size of the dataset.
But when I run vtkImageShrink3D's Update() it causes a segmentation error.
If I generate image data myself using vtkScalars with vtkScalars and the
dataset
is not too large (eg. 100*100*100) then there is no problem.. but with large
datasets (eg. 450*450*450) I also get these errors.
I some times even get a segmentation fault when I just run this
(with a large dim).
int i, j, k, kOffset, jOffset, offset;
float x, y, z, s, sp;
int dim=500;
_volumedata = vtkStructuredPoints::New();
_volumedata->SetDimensions(dim,dim,dim);
_volumedata->SetOrigin(-0.5,-0.5,-0.5);
sp = 1.0/25.0;
_volumedata->SetSpacing(sp, sp, sp);
vtkScalars *scalars = vtkScalars::New();
for (k=0; k<dim; k++) {
z = -0.5 + k*sp;
kOffset = k * dim * dim;
for (j=0; j<dim; j++) {
y = -0.5 + j*sp;
jOffset = j * dim;
for (i=0; i<dim; i++) {
/*
segmentation error occurs in this loop when
k, j and i become large.
*/
x = -0.5 + i*sp;
s = x*x + y*y + z*z - (0.4*0.4);
offset = i + jOffset + kOffset;
scalars->InsertScalar(offset,s);
}
}
}
_volumedata->GetPointData()->SetScalars(scalars);
scalars->Delete();
Is this a known problem? And do you have the same problem (maybe with
a dim that is larger than 500?) I haven't tried in vtk 4 if there is the
same problem.
I can't use that for my library anyway because there is an interface that
links
vtk 3.2.0 to the medical application (easyscil) that I am using and there's
no
link with vtk 4.
Tim.
More information about the vtkusers
mailing list