[vtkusers] Patch to make gaussian_splatter spalt single voxels if r=0
lynx.abraxas at freenet.de
lynx.abraxas at freenet.de
Mon Feb 8 11:52:47 EST 2010
Hello!
I also tried to change gaussian_splatter in such a way, that it splats only a
single voxel if the radius is set to 0. Sadly this does not work in most cases
and only if the radius is set to around 1/sampleDim. I can't see why it does
not splat at all for radius= 0.
Any ideas?
What is the correct integer function in this case: round, int, floor or ceil?
Lynx
-------------- next part --------------
diff -aur orig//vtkGaussianSplatter.cxx single_points//vtkGaussianSplatter.cxx
--- orig//vtkGaussianSplatter.cxx 2010-02-08 13:16:35.938535000 +0100
+++ single_points//vtkGaussianSplatter.cxx 2010-02-08 15:56:39.054141000 +0100
@@ -222,8 +222,8 @@
// Determine splat footprint
for (i=0; i<3; i++)
{
- min[i] = static_cast<int>(floor(static_cast<double>(loc[i])-this->SplatDistance[i]));
- max[i] = static_cast<int>(ceil(static_cast<double>(loc[i])+this->SplatDistance[i]));
+ min[i] = static_cast<int>(round(loc[i] - this->SplatDistance[i]));
+ max[i] = static_cast<int>(round(loc[i] + this->SplatDistance[i]));
if ( min[i] < 0 )
{
min[i] = 0;
@@ -236,13 +236,13 @@
// Loop over all sample points in volume within footprint and
// evaluate the splat
- for (k=min[2]; k<=max[2]; k++)
+ for (k=min[2]; k<max[2]; k++)
{
cx[2] = this->Origin[2] + this->Spacing[2]*k;
- for (j=min[1]; j<=max[1]; j++)
+ for (j=min[1]; j<max[1]; j++)
{
cx[1] = this->Origin[1] + this->Spacing[1]*j;
- for (i=min[0]; i<=max[0]; i++)
+ for (i=min[0]; i<max[0]; i++)
{
cx[0] = this->Origin[0] + this->Spacing[0]*i;
if ( (dist2=(this->*Sample)(cx)) <= this->Radius2 )
More information about the vtkusers
mailing list