Skip to content

Commit

Permalink
Merge pull request #485 from Enet4/change/object/409
Browse files Browse the repository at this point in the history
Extend type parameter list in `FileMetaTable.set_transfer_syntax`
  • Loading branch information
Enet4 authored Mar 24, 2024
2 parents 3c1e42b + 3549401 commit 5b03b7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions object/src/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,10 @@ impl FileMetaTable {
/// Set the file meta table's transfer syntax
/// according to the given transfer syntax descriptor.
///
/// Extra padding to even length is trimmed.
///
/// Note that the field `information_group_length` is _not_ updated
/// to consider the length of the new transfer syntax.
/// Should you wish to keep the field up to date,
/// call [`update_information_group_length`][1] afterwards.
///
/// [1]: FileMetaTable::update_information_group_length
pub fn set_transfer_syntax<D, P>(&mut self, ts: &TransferSyntax<D, P>) {
/// This replaces the table's transfer syntax UID
/// to the given transfer syntax, without padding to even length.
/// The information group length field is automatically recalculated.
pub fn set_transfer_syntax<D, R, W>(&mut self, ts: &TransferSyntax<D, R, W>) {
self.transfer_syntax = ts
.uid()
.trim_end_matches(|c: char| c.is_whitespace() || c == '\0')
Expand Down Expand Up @@ -1197,9 +1192,8 @@ mod tests {
156 + dicom_len(IMPLEMENTATION_CLASS_UID) + dicom_len(IMPLEMENTATION_VERSION_NAME)
);

// Note (#409): erased is required due to a missing type parameter in the setter
table.set_transfer_syntax(
&dicom_transfer_syntax_registry::entries::IMPLICIT_VR_LITTLE_ENDIAN.erased(),
&dicom_transfer_syntax_registry::entries::IMPLICIT_VR_LITTLE_ENDIAN,
);
assert_eq!(
table.information_group_length,
Expand Down
2 changes: 1 addition & 1 deletion pixeldata/src/transcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ where

// change transfer syntax to Explicit VR little endian
self.meta_mut()
.set_transfer_syntax(&EXPLICIT_VR_LITTLE_ENDIAN.erased());
.set_transfer_syntax(&EXPLICIT_VR_LITTLE_ENDIAN);

// use RWPixel adapter API
let mut offset_table = Vec::new();
Expand Down

0 comments on commit 5b03b7e

Please sign in to comment.