Skip to content

Commit

Permalink
Merge pull request #280 from ImagingDataCommons/fix_jpeg2000_compression
Browse files Browse the repository at this point in the history
Remove JP2 wrapper from JPEG 2000 encoding
  • Loading branch information
CPBridge authored Apr 6, 2024
2 parents 445a259 + b1433f0 commit fc1a536
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/highdicom/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def encode_frame(
Number of bits that need to be allocated per pixel sample
bits_stored: int
Number of bits that are required to store a pixel sample
photometric_interpretation: int
photometric_interpretation: Union[PhotometricInterpretationValues, str]
Photometric interpretation
pixel_representation: Union[highdicom.PixelRepresentationValues, int, None], optional
Whether pixel samples are represented as unsigned integers or
Expand Down Expand Up @@ -156,6 +156,7 @@ def encode_frame(
'tile_size': None,
'num_resolutions': 1,
'irreversible': False,
'no_jp2': True,
},
),
JPEGLSLossless: (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_jpeg2000_rgb(self):
pixel_representation=0,
planar_configuration=0
)
assert compressed_frame.startswith(b'\x00\x00\x00\x0C\x6A\x50\x20')
assert compressed_frame.startswith(b"\xFF\x4F\xFF\x51")
assert compressed_frame.endswith(b'\xFF\xD9')
decoded_frame = decode_frame(
value=compressed_frame,
Expand All @@ -198,7 +198,7 @@ def test_jpeg2000_monochrome(self):
photometric_interpretation='MONOCHROME2',
pixel_representation=0,
)
assert compressed_frame.startswith(b'\x00\x00\x00\x0C\x6A\x50\x20')
assert compressed_frame.startswith(b"\xFF\x4F\xFF\x51")
assert compressed_frame.endswith(b'\xFF\xD9')
decoded_frame = decode_frame(
value=compressed_frame,
Expand Down

0 comments on commit fc1a536

Please sign in to comment.