Skip to content

Commit

Permalink
BUG: Updated VTK to fix histogram computation for volumes containing NaN
Browse files Browse the repository at this point in the history
Fixes #4907.

Contains:

Revision: dd7e051af68cfbf3675e411494af7169fc7d5618
Author: Andras Lasso <lasso@queensu.ca>
Date: 2020-05-01 1:36:14 AM
Message:
* [backport MR-6846] BUG: Fix crash in vtkImageHistogram if input contains NaN

vtkImageHistogram caused application crash when input image contained NaN value
using Intel TBB backend, Visual Studio 2017, x64.

The problem was that when the image contained a NaN value then the computed scalar range was set to (Nan, Nan),
which later got converted to invalid bin min/max indexes. The safety check that should have forced
the indices to the valid range did not work, as it relied on comparison with a NaN value.

Fixed computation of scalar range (similar to how it is done here:
https://gitlab.kitware.com/vtk/vtk/-/commit/06d553fb232ac3992b99df47613506f106d2f46d), by changing
the order of operands in the ternary operator.

To make sure that similar error do not cause crash in the future, added a NaN-value check in the bin range computation, too.

Added test case to verify that the results are correct and the application does not crash anymore if input image contains NaN.
  • Loading branch information
lassoan committed May 6, 2020
1 parent 7006590 commit 272f751
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SuperBuild/External_VTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if((NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) AND NOT Slicer_USE_SYSTEM

set(_git_tag)
if("${Slicer_VTK_VERSION_MAJOR}" STREQUAL "8")
set(_git_tag "8b29c955d8b73cc26f6616ee734d8c501ff79dcd") # slicer-v8.2.0-2018-10-02-74d9488523
set(_git_tag "dd7e051af68cfbf3675e411494af7169fc7d5618") # slicer-v9.0.0-2020-05-05-987ae267
else()
message(FATAL_ERROR "error: Unsupported Slicer_VTK_VERSION_MAJOR: ${Slicer_VTK_VERSION_MAJOR}")
endif()
Expand Down

0 comments on commit 272f751

Please sign in to comment.