MantisBT - VTK
View Issue Details
0012993VTK(No Category)public2012-03-13 12:202013-07-22 16:14
Bernd Hentschel 
Dave DeMarle 
highminorhave not tried
closedfixed 
5.6.1 
 
TBD
incorrect functionality
0012993: vtkImageData::FindCell returns valid cellId for outside points
vtkImageData::FindCell will return a valid cellId (>=0) for points that lie outside the data set bounds. This should never happen for cartesian grids. More specifically, I noticed that only points that lie outside the domain but within one spacing in either dimension are handled in this fashion. Please find attached a short test program illustrating the issue.

Looking at the code of FindCell(...) and vtkImageData::ComputeStructuredCoordinates(...) it looks like this is a combination of a truncation error when moving from physical to grid coordinates combined with an issue in the subsequent computation of the corresponding cellId.

As a short term fix, I might suggest testing the input coords against the bounds in the first place (early exit). However, I wondered why the mapping to a grid point is made in the first place, because it's pretty straightforward to compute the correct cellId from the input coords right away without referring to grid points altogether.
No tags attached.
cpp BugReportVtkImageData.cpp (2,999) 2012-03-13 12:20
https://www.vtk.org/Bug/file/9131/BugReportVtkImageData.cpp
Issue History
2012-03-13 12:20Bernd HentschelNew Issue
2012-03-13 12:20Bernd HentschelFile Added: BugReportVtkImageData.cpp
2012-03-29 14:30Leo LiuNote Added: 0028403
2012-03-29 14:30Leo LiuResolutionopen => unable to reproduce
2012-03-30 05:25Bernd HentschelNote Added: 0028410
2012-04-02 14:02Leo LiuNote Added: 0028421
2013-07-22 16:11Dave DeMarleNote Added: 0031169
2013-07-22 16:11Dave DeMarleStatusbacklog => expired
2013-07-22 16:11Dave DeMarleAssigned To => Dave DeMarle
2013-07-22 16:13Dave DeMarleStatusexpired => backlog
2013-07-22 16:13Dave DeMarleResolutionunable to reproduce => reopened
2013-07-22 16:14Dave DeMarleNote Added: 0031170
2013-07-22 16:14Dave DeMarleStatusbacklog => todo
2013-07-22 16:14Dave DeMarleStatustodo => active development
2013-07-22 16:14Dave DeMarleStatusactive development => closed
2013-07-22 16:14Dave DeMarleResolutionreopened => fixed

Notes
(0028403)
Leo Liu   
2012-03-29 14:30   
I ran your attached code with the latest VTK. I got "Cell search worked correctly" for all the points. Perhaps this has been fixed?
(0028410)
Bernd Hentschel   
2012-03-30 05:25   
I specifically reported this bug for 5.6.1 and not for the latest version. It's entirely possible that this has been fixed. However, I did not find a bug report on this. Since "bugs don't just go away" would you mind diffing the code mentioned in the report between 5.6.1 and trunk?
(0028421)
Leo Liu   
2012-04-02 14:02   
This was indeed a bug fix. In commit 35c074345, bounding box was introduced to reject anything out of bound---pretty much as you suggested.
(0031169)
Dave DeMarle   
2013-07-22 16:11   
reported fixed in 5.10
(0031170)
Dave DeMarle   
2013-07-22 16:14   
meant to close, not expire last time as Leo found this fixed and pointed out patch responsible