[vtkusers] Bug in vtkImageStencil
Michael Knopke
Michael.Knopke at gmx.de
Wed Nov 26 06:32:05 EST 2008
Hi Kevin,
Thanks for the example, but still no luck. If the stencil should cover both
the image_data and the poly_data (that is used for stenciling) shouldn't it
calculated like this?:
double max_bounds[6];
int sign =1;
for(int i=0;i<6;i++)
{
sign = sign*(-1);
if(sign<0)
{
if(poly_bounds[i]<image_bounds[i])max_bounds[i]=poly_bounds[i];
else max_bounds[i]=image_bounds[i];
}
else
{
if(poly_bounds[i]>image_bounds[i])max_bounds[i]=poly_bounds[i];
else max_bounds[i]=image_bounds[i];
}
}
int max_extent[6];
for ( int i = 0; i < 3; ++i )
{
max_extent[ i * 2 + 0 ] = 0;
max_extent[ i * 2 + 1 ] = (int)(
( max_bounds[ i * 2 + 1 ] - max_bounds[ i * 2 + 0 ] )
/image_spacing[i]);
}
However both approaches result in crashes, whenever my polydata leaves the
image bounds.
Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081126/e29ad99b/attachment.htm>
More information about the vtkusers
mailing list