Skip to content

[ts-registry] Add JPEG-LS pixel data encoder#573

Merged
Enet4 merged 4 commits intomasterfrom
imp/ts-registry/jpeg-ls-encode
Oct 23, 2024
Merged

[ts-registry] Add JPEG-LS pixel data encoder#573
Enet4 merged 4 commits intomasterfrom
imp/ts-registry/jpeg-ls-encode

Conversation

@Enet4
Copy link
Copy Markdown
Owner

@Enet4 Enet4 commented Oct 19, 2024

With decoding provided in #534, this PR now adds encoding, also through CharLS.

Summary

  • rename JpegLSAdapter to JpegLsAdapter
  • impl PixelDataWriter for JpegLsAdapter
    • uses charls-rs all the same, uses a transformation function to turn quality and sample bit depth into the NEAR parameter.
  • add JpegLsLosslessEncoder, which uses the same encoder implementation but overrides quality to 100 (lossless)
  • update entries module and crate root documentation accordingly
  • add tests for JPEG-LS encoding and decoding
  • [toimage] infer JPEG-LS image unwrapping to extension .jls

@Enet4 Enet4 added A-lib Area: library C-transfer-syntax Crate: dicom-transfer-syntax-registry C-toimage Crate: dicom-toimage labels Oct 19, 2024
Enet4 added 4 commits October 23, 2024 16:21
- rename JpegLSAdapter to JpegLsAdapter
- impl PixelDataWriter for JpegLsAdapter
   - uses charls-rs all the same,
     transforms quality and sample bit depth into the NEAR parameter
- add JpegLsLosslessEncoder,
  which overrides quality to lossless
- update entries accordingly
- add tests for JPEG-LS encoding and decoding
- JPEG-LS encoding is supported
- retain photometric interpretation in that case
  and force lossless encoding
@Enet4 Enet4 force-pushed the imp/ts-registry/jpeg-ls-encode branch from 545462c to fd44db9 Compare October 23, 2024 15:29
@Enet4
Copy link
Copy Markdown
Owner Author

Enet4 commented Oct 23, 2024

Just made these changes:

  • if samples per pixel is 1, photometric interpretation is set to MONOCHROME2 only if it is not one of MONOCHROME1, MONOCHROME2, or PALETTE COLOR
  • force lossless encoding if the source pixel data photometric interpretation is PALETTE COLOR
  • rebase

@dougyau
Copy link
Copy Markdown
Contributor

dougyau commented Oct 23, 2024

Just made these changes:

* if samples per pixel is 1, photometric interpretation is set to `MONOCHROME2` only if it is not one of `MONOCHROME1`, `MONOCHROME2`, or `PALETTE COLOR`

* force lossless encoding if the source pixel data photometric interpretation is `PALETTE COLOR`

* rebase

This should work great

@Enet4
Copy link
Copy Markdown
Owner Author

Enet4 commented Oct 23, 2024

Thanks for the review!

@Enet4 Enet4 merged commit a3e6a52 into master Oct 23, 2024
@Enet4 Enet4 deleted the imp/ts-registry/jpeg-ls-encode branch October 23, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lib Area: library C-toimage Crate: dicom-toimage C-transfer-syntax Crate: dicom-transfer-syntax-registry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants