[vtkusers] vtkThreshold bug

Dean Inglis dean.inglis at sympatico.ca
Sun Nov 16 23:49:36 EST 2008


there is a bug in vtkThreshold

 

scenario:

AllScalars is on

 

      if (this->AllScalars)

        {

        keepCell = 1;

        for ( i=0; keepCell && (i < numCellPts); i++)

          {

          ptId = cellPts->GetId(i);

          keepCell = this->EvaluateComponents( inScalars, ptId );

          }

        }

 

 

If the first and only point of a cell  

fails the inclusion test but the remaining points do not,

the test for AllScalars will fail since local ivar keepCell is initialized

to 1 before the first test occurs.

 

suggested fix:

 

      if (this->AllScalars)

        {

        keepCell = 0;

        for ( i=0; i < numCellPts; i++)

          {

          ptId = cellPts->GetId(i);

          keepCell += this->EvaluateComponents( inScalars, ptId );

          }

        keepCell = (keepCell == 0)?0:1;

        }

 

Are there are any objections to submission of the

above fix.

 

Dean

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dean Inglis, PhD

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~ Center for Appendicular ~~~~~

Magnetic Resonance Imaging Studies

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

610 - 25 Charlton Ave. E.

Hamilton, Ontario, L8N 1Y2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Assistant Professor (Adjunct)

Department of Civil Engineering

McMaster University

Hamilton, Ontario

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Software Demos:

 <http://www.youtube.com/watch?v=_zYNtHC9-0s>
http://www.youtube.com/watch?v=_zYNtHC9-0s

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081116/42902621/attachment.htm>


More information about the vtkusers mailing list