Skip to content

Comments

feat(transcode): support transcoding#44

Open
feliwir wants to merge 4 commits intoUMEssen:mainfrom
mbits-imaging:transcoding
Open

feat(transcode): support transcoding#44
feliwir wants to merge 4 commits intoUMEssen:mainfrom
mbits-imaging:transcoding

Conversation

@feliwir
Copy link
Contributor

@feliwir feliwir commented Feb 3, 2026

Implements #10

Without transcoding:
image

With transcoding:
image

See supported transfer syntaxes here: https://docs.rs/dicom-transfer-syntax-registry/latest/dicom_transfer_syntax_registry/#transfer-syntaxes (thanks @Enet4 for the hint)

@feliwir
Copy link
Contributor Author

feliwir commented Feb 3, 2026

I think it would be nice to write the used / selected transfer-syntax into the "Content-Type" of each multipart item, but not sure if that is standard compliant

@Enet4
Copy link

Enet4 commented Feb 3, 2026

I think it would be nice to write the used / selected transfer-syntax into the "Content-Type" of each multipart item, but not sure if that is standard compliant

My interpretation of PS 3.18 8.7.9 would be that yes, you can add transfer-syntax parameters to the media type of each message part, irrespective of whether the Content-Type header is at the top of the HTTP response or inside a multipart/related part.

8.7.9 Content-Type Header Field

The Content-Type Header Field specifies the Media Type of the payload. It shall only be present when a payload is present, and any Media Type parameters shall specify the encoding of the corresponding message part.

In particular, a DICOM Media Type used as the value of a Content-Type Header Field shall have zero or one Transfer Syntax parameter (see Section 8.7.3.5.2), and zero or one charset parameter (see Section 8.7.3.5.3), which corresponds to the character encoding of the corresponding message part.

Content-Type: dicom-media-type +transfer-syntax-mtp +charset-mtp

Oh, and B.11 shows an example of just that!

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: multipart/related; boundary="5e3c723b-ad24-42f9-88e0-10d29d87115c"
…

22\r\n
--5e3c723b-ad24-42f9-88e0-10d29d87115c\r\n
22A1\r\n
Content-Type: application/dicom; transfer-syntax="1.2.840.10008.1.2.4.50"

<BINARY DICOM DATA in multipart boundaries> 
\r\n

@feliwir
Copy link
Contributor Author

feliwir commented Feb 3, 2026

Added a commit that adds the transfer-syntax-uid to the multipart items. Thanks!

writeln!(buffer, "Content-Type: {}\r", "application/dicom")?;
writeln!(
buffer,
"Content-Type: {}; transfer-syntax=\"{}\"\r",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transfer syntax UIDs might have a trailing null character (\0), which trim does not remove. So it might be worth looking for places where these null characters can emerge by mistake in the output (there was something in the first screenshot).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a commit trimming these trailings null in this place. I think in this PR this is the only relevant place

@feliwir
Copy link
Contributor Author

feliwir commented Feb 23, 2026

I rebased this to work after the latest changeset

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants