Skip to content

PseudoColorSoftcopyPresentationState raises TypeError for any voi_lut_transformations #534

Done

Description

@CedricConday

PseudoColorSoftcopyPresentationState.__init__ validates the items of voi_lut_transformations against the argument itself rather than the class:

for v in voi_lut_transformations:
    if not isinstance(v, voi_lut_transformations):

(src/highdicom/pr/sop.py, in the "Softcopy VOI LUT" block). isinstance with a list as its second argument raises, so the constructor fails for any non-empty voi_lut_transformations, valid or not:

TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

GrayscaleSoftcopyPresentationState has the same block with SoftcopyVOILUTTransformation there, and its tests cover the argument; the pseudo-color tests never pass it, which is probably why this went unnoticed since #139.

Reproduction: take the arguments of test_construction_palette_color_lut_transformation in tests/test_pr.py and add

voi_lut_transformations=[
    SoftcopyVOILUTTransformation(window_center=40.0, window_width=400.0)
]

A PR with the one-line fix and a test follows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions