MantisBT - VTK
View Issue Details
0001559VTK(No Category)public2005-02-01 08:582016-08-12 09:54
Hideaki Hiraki 
Will Schroeder 
normalmajoralways
closedmoved 
 
 
0001559: MaximumDistance is left in vtkImageEuclideanDistance when ConsiderAnisotropy is On
The following script should show a concentric distance map, but a very high value is shown spuriously on it.

 vtkSphere sphere
 vtkSampleFunction sample
 sample SetImplicitFunction sphere
 vtkImageThreshold thresh
 thresh SetInput [sample GetOutput]
 thresh ThresholdByUpper 0
 thresh SetInValue 1
 thresh SetOutValue 0
 vtkImageEuclideanDistance distan
 distan SetInput [thresh GetOutput]
 vtkImageViewer viewer
 viewer SetInput [distan GetOutput]
 viewer SetColorWindow 2
 viewer SetColorLevel 1
 viewer Render


In vtkImageEuclideanDistance, the default MaximumDistance is VTK_INT_MAX. The spurious parts keep the value unprocessed. Though I couldn't understand the algorithm, I found suspect lines in vtkImageEuclideanDistance.cxx :
        b=(int)(floor)((((buff[idx0]-buffer)/spacing)-1)/2);

The variables buff[idx0] and buffer seem to be set squared distances. It's strange to divide only once by spacing. Moreover, if one of these variables was VTK_INT_MAX and spacing<<1, the result would overflow.
No tags attached.
patch distfix.patch (1,809) 1969-12-31 19:00
https://www.vtk.org/Bug/file/5296/distfix.patch
Issue History
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036764
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved

Notes
(0002465)
Hideaki Hiraki   
2005-06-06 03:04   
I found spacing here was squared in several lines above:
  spacing*=spacing;
So it's not strange to divide once by this.

Anyway, I could fix the spurious parts by checking the range before casting to integer. Please see the attachment.
(0036764)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.