Skip to content

feat(transcode): support transcoding#44

Merged
nickamzol merged 4 commits into
UMEssen:mainfrom
mbits-imaging:transcoding
May 7, 2026
Merged

feat(transcode): support transcoding#44
nickamzol merged 4 commits into
UMEssen:mainfrom
mbits-imaging:transcoding

Conversation

@feliwir
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Contributor Author

feliwir commented Feb 3, 2026

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

Comment thread src/backend/dimse/wado.rs Outdated
writeln!(buffer, "Content-Type: {}\r", "application/dicom")?;
writeln!(
buffer,
"Content-Type: {}; transfer-syntax=\"{}\"\r",
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor Author

feliwir commented Feb 23, 2026

I rebased this to work after the latest changeset

Comment thread src/api/wado/service.rs Fixed
Comment thread src/api/wado/service.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
Comment thread src/backend/dimse/wado.rs Fixed
@feliwir
Copy link
Copy Markdown
Contributor Author

feliwir commented May 5, 2026

@nickamzol did you have a chance to look at this? Is this what you had in mind for #10 ?

@nickamzol
Copy link
Copy Markdown
Member

Sorry for holding this back. I finally got the chance to test this thoroughly and this is exactly what I had in mind for #10.
Thank you for this contribution!

@nickamzol nickamzol merged commit cff2fb4 into UMEssen:main May 7, 2026
2 checks passed
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.

4 participants