Skip to content

Conversation

Devu-trenser
Copy link
Contributor

@Devu-trenser Devu-trenser commented Oct 10, 2025

Context

We need to extend BasicStatsCalculator to customize it for annotation use cases. Currently state is declared as private, which prevents extension and reuse of its internal state in the derived annotation-specific stats calculator.

This change updates state from private to protected to allow subclasses to directly access and build on top of it.

Changes & Results

  • Change the visibility of the state field in BasicStatsCalculator from private to protected.
  1. Before: the state property is inaccessible when extending the class for annotation custom stats calculators.
  2. After: subclasses for annotation use can access and extend state directly.

Testing

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

@Devu-trenser Devu-trenser changed the title Make BasicStatsCalculator.state protected Allow Shadowed Class Methods to Modify State Properties Oct 10, 2025
@sedghi sedghi changed the title Allow Shadowed Class Methods to Modify State Properties fix: Allow Shadowed Class Methods to Modify State Properties Oct 10, 2025
@sedghi sedghi merged commit 89a8db5 into cornerstonejs:main Oct 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants