Skip to content

Fix LUT length decoding and dataset copy isolation - #489

Merged
CPBridge merged 2 commits into
ImagingDataCommons:masterfrom
jdotc1:fix/jdotc1-pr-02-highdicom-lut-correctness-20261023
Oct 27, 2026
Merged

CPBridge merged 2 commits into
ImagingDataCommons:masterfrom
jdotc1:fix/jdotc1-pr-02-highdicom-lut-correctness-20261023

Conversation

@jdotc1

@jdotc1 jdotc1 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Problem

A LUT constructed with 65,536 entries currently rejects its own data because its encoded count is zero. Separately, the default copying constructor aliases and changes the caller's Dataset.

Change

Use the existing number_of_entries property for the decoded expected length, and delete the assignment that overwrites the selected deepcopy.

Seventeen synthetic cases cover uint8 and uint16 LUTs of lengths 1, 3, 256, 65,535 and 65,536; exact getter values and dtypes; endpoint application; from_dataset decoding of both maximum-length forms; truncated payload rejection; and omitted/True/False copy behavior with mutable descriptor and data isolation.

Validation

  • Baseline with the added regression tests: 6 failed, 11 passed.
  • Patched regression tests: 17 passed.
  • python -m pytest -q tests/test_content.py: 116 passed.
  • Changed-file flake8, syntax and whitespace checks passed.
  • Clean application verified against the exact files from ab8843cb49545b88a1b0c811310222dbcbdce6d4.

Validation used Python 3.12.14 and NumPy 2.3.5 with current upstream source. The full pytest --flake8 suite has not been run in this constrained environment.

@CPBridge CPBridge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, one comment about the tests

Comment thread tests/test_content.py Outdated
assert lut.LUTExplanation == self._explanation


class TestLUTDecoding:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am gradually trying to move away from grouping tests into classes like this (a vestige of using unittest instead of pytest)

Therefore, could we please get rid of this class and have the tests at the scope of the module

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks—updated in c9fc19c. I removed TestLUTDecoding and moved its four parametrized methods to module-level pytest functions, preserving the assertions. The full suite passed locally: 2,082 passed and 153 skipped (optional dependencies).

@CPBridge CPBridge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@CPBridge
CPBridge merged commit 60744d4 into ImagingDataCommons:master Oct 27, 2026
13 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