cornerstonejs / cornerstoneTools

[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/
MIT License
579 stars 456 forks source link

fix(ellipticalROI): give default values for cachedStats values to avoid undefined error #1537

Closed md-prog closed 1 year ago

md-prog commented 1 year ago

Bug Fix: _createTextBoxContent() function call during rendering sometimes causes undefined error.

Ideal flow would have been, first calculate all values of cachedStats and then call the _createTextBoxContent() function. But in reality, particularly for the initial load, the _createTextBoxContent() function is called before the cachedStats values are calculated.

Gave default value: 0, for the cachedStats values that are being used by _createTextBoxContent(). This will prevent undefined error until they are correctly caculcated.

No

codecov[bot] commented 1 year ago

Codecov Report

Merging #1537 (0ada1b7) into master (925a3dd) will increase coverage by 1.22%. The diff coverage is 58.82%.

:exclamation: Current head 0ada1b7 differs from pull request most recent head d675825. Consider uploading reports for the commit d675825 to get more accurate results

@@            Coverage Diff             @@
##           master    #1537      +/-   ##
==========================================
+ Coverage   21.70%   22.92%   +1.22%     
==========================================
  Files         287      288       +1     
  Lines       10137    10070      -67     
  Branches     2081     2053      -28     
==========================================
+ Hits         2200     2309     +109     
+ Misses       6750     6611     -139     
+ Partials     1187     1150      -37     
Impacted Files Coverage Δ
src/tools/annotation/_utils.js 48.14% <48.14%> (ø)
src/tools/annotation/CircleRoiTool.js 88.79% <100.00%> (+10.94%) :arrow_up:
src/tools/annotation/EllipticalRoiTool.js 75.92% <100.00%> (+42.59%) :arrow_up:
src/tools/annotation/RectangleRoiTool.js 84.00% <100.00%> (+40.60%) :arrow_up:

... and 6 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

sedghi commented 1 year ago

:tada: This PR is included in version 6.0.9 :tada:

The release is available on:

Your semantic-release bot :package::rocket: