Skip to content

Change transfer syntax API for more pixel data codec flexibility#361

Merged
Enet4 merged 21 commits intomasterfrom
change/encoding/transfer-syntax-api-pixeldata
Jul 23, 2023
Merged

Change transfer syntax API for more pixel data codec flexibility#361
Enet4 merged 21 commits intomasterfrom
change/encoding/transfer-syntax-api-pixeldata

Conversation

@Enet4
Copy link
Copy Markdown
Owner

@Enet4 Enet4 commented Jun 10, 2023

This makes some changes to the types TransferSyntax and Codec. The noteworthy changes are:

  • It is now possible to specify that a transfer syntax can only read/write pixel data (no more need for methods returning a NotImplemented error). This was done by splitting PixelRWAdapter and the parameter type P into two independent traits PixelDataReader and PixelDataWriter
  • PixelDataReader has a new method for reading a single frame.
  • PixelDataWriter has been redesigned to return a sequence of attribute operations to perform on an object that will host the encapsulated pixel data produced.

Summary

  • Split PixelRWAdapter into PixelDataReader and PixelDataWriter
  • Change Codec
    • type parameters become <D, R, W>
    • Change variants to None, Dataset, and EncapsulatedPixelData, which can describe different levels and implementations
    • also add a few more helper methods to TransferSyntax
  • Change TransferSyntax type parameters to D, R, W
  • Update RLE and JPEG adapters to conform to the new API
  • change PixelDataObject::fragment to return Cow<[u8]>
    • may save an allocation in case of in-memory DICOM objects
    • [object] update impl accordingly
  • [ts-registry] update registry according to changes
  • Change method names in TransferSyntax
    • [ul][ts-registry][pixeldata] update according to changes

@Enet4 Enet4 added breaking change Hint that this may require a major version bump on release C-object Crate: dicom-object C-encoding Crate: dicom-encoding C-pixeldata Crate: dicom-pixeldata C-transfer-syntax Crate: dicom-transfer-syntax-registry C-ul Crate: dicom-ul labels Jun 10, 2023
@Enet4 Enet4 force-pushed the change/encoding/transfer-syntax-api-pixeldata branch from 5987333 to 152f653 Compare June 18, 2023 16:50
@Enet4 Enet4 marked this pull request as ready for review June 19, 2023 08:07
@Enet4 Enet4 force-pushed the change/encoding/transfer-syntax-api-pixeldata branch from 406e050 to a18315f Compare July 7, 2023 21:37
Enet4 added 18 commits July 22, 2023 12:50
- Split PixelRWAdapter into
  PixelDataReader and PixelDataWriter
- Change Codec
   - type parameters become `<D, R, W>`
   -  Change variants to  None, Dataset, and EncapsulatedPixelData,
   wan describe different levels and implementations
   - also add a few more helper methods to TransferSyntax
- Change TransferSyntax type parameters to `D`, `R`, `W`
- Update RLE and JPEG adapters
- change PixelDataObject::fragment to return Cow<[u8]>
   - may save an allocation in case of in-memory DICOM objects
   - [object] update impl accordingly
- [ts-registry] update registry according to changes
- Change method names in TransferSyntax
   - [ul][ts-registry][pixeldata] update according to changes
- adjust impls everywhere
- If EncapsulatedPixelData(..), we can decode data sets
- Remove reference to outdated trait
- Simplify display of DecodeError::Custom and EncodeError::Custom
- Update error variant documentation
  to be more extensive
- remove unneeded allow(unused_variables) attribute
- tweak documentation of DynPixelDataReader, DynPixelDataWriter,
  and NeverPixelAdapter
- add impl PixelDataReader and PixelDataWriter
  for NeverAdapter
- refer to both submit_transfer_syntax! and submit_ele_transfer_syntax!
- expose "native" as its own feature
- explicitly name "image" as a feature
- return `Option<u32>` instead of `Option<u16>`
- [object] propagate changes
- calls `decode_frame` for each frame
- add transfer_syntax_uid()
- add offset_table()
- [object] add implementations for new methods
- change `encode` to also include offsets
- change `dst` paramter of `encode` to a vec of vecs
- document that pixel data writing
  must be supported by native pixel data,
  but might also be supported from other transfer syntaxes
- calls `encode_frame` for each frame and calculates the offsets for offset_table
@Enet4 Enet4 force-pushed the change/encoding/transfer-syntax-api-pixeldata branch from a18315f to 7587145 Compare July 22, 2023 12:07
- NeverPixelAdapter is unused with "jpeg" feature
Enet4 added 2 commits July 22, 2023 16:27
- .fragment(0) can be used to fetch flat (non-encapsulated) pixel data
- tweak documentation
- add `bits_stored(&self)`
- [object] adjust PixelDataObject implementation accordingly
@Enet4 Enet4 merged commit a92bd53 into master Jul 23, 2023
@Enet4 Enet4 deleted the change/encoding/transfer-syntax-api-pixeldata branch July 23, 2023 09:00
Enet4 added a commit that referenced this pull request Mar 24, 2024
…r_syntax`

- update according to the new type parameters defined in #361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Hint that this may require a major version bump on release C-encoding Crate: dicom-encoding C-object Crate: dicom-object C-pixeldata Crate: dicom-pixeldata C-transfer-syntax Crate: dicom-transfer-syntax-registry C-ul Crate: dicom-ul

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant