A green echo tells you two systems can open an association. The association log tells you what they actually agreed to once they did: which SOP classes, in which transfer syntaxes, in which roles, with what limits, and how the conversation ended. When a conformance statement says one thing and the images say another, the log is where you find out who was right.
Every product logs this differently. DCMTK, pynetdicom, the archive’s own trace, a modality’s service log: the formatting varies and so does the default verbosity. What doesn’t vary is the protocol underneath: whatever a product prints is drawn from the same seven protocol data units defined in PS3.8. Learn to read the PDUs and you can read any vendor’s version of them. This post goes through them in the order they happen, then works through an example and ends with the order I read a log in.
Seven PDUs#
| PDU | Type | What it means |
|---|---|---|
| A-ASSOCIATE-RQ | 01H | The requester proposes an association |
| A-ASSOCIATE-AC | 02H | The acceptor accepts it, and says on what terms |
| A-ASSOCIATE-RJ | 03H | The acceptor refuses it, with a result, source and reason |
| P-DATA-TF | 04H | Commands and data sets, once the association is up |
| A-RELEASE-RQ | 05H | One side asks to end the association cleanly |
| A-RELEASE-RP | 06H | The other side agrees |
| A-ABORT | 07H | Either side, or the protocol layer itself, ends it now |
A normal association is a request, an accept, a run of data, and a release:
sequenceDiagram
participant R as Requester (e.g. modality)
participant A as Acceptor (e.g. archive)
R->>A: A-ASSOCIATE-RQ (AE titles, presentation contexts, user info)
A->>R: A-ASSOCIATE-AC (result per context, max length, implementation ID)
R->>A: P-DATA-TF (C-STORE-RQ command, then data set fragments)
A->>R: P-DATA-TF (C-STORE-RSP with Status)
R->>A: A-RELEASE-RQ
A->>R: A-RELEASE-RP
Most of what goes wrong shows up as a departure from that shape: an RJ where the AC should be, a context rejected inside an AC, a status other than success in a response, or an ending that isn’t a release. The rest is in the details of an AC that looks normal.
The request#
The A-ASSOCIATE-RQ carries three things worth reading (PS3.8, Section 9.3.2).
The AE titles. Called AE title first, then calling, each 16 characters with leading and trailing spaces not significant. The application context name is the one DICOM registers, 1.2.840.10008.3.1.1.1 (PS3.7, Section A.2.1). The standard allows privately defined ones, but I’ve yet to see one in a production log; anything else is worth a question.
The presentation contexts. Each one has an ID, an odd number from 1 to 255, one abstract syntax (the SOP class), and one or more transfer syntaxes the requester can send it in (PS3.8, Section 9.3.2.2). The list is the requester’s whole offer: if a SOP class isn’t proposed here, nothing that follows can use it. Check two things. Is the SOP class you expect there at all? Some modalities configured for Enhanced CT propose only Enhanced CT; if the archive doesn’t support it, nothing is sent. And does every SOP class include Implicit VR Little Endian in at least one context? PS3.5, Section 10.1 requires the requester to offer it. The exceptions are pixel data the sender has only in lossy-compressed form, and lossless or encapsulated pixel data too large for the default transfer syntax when no pixel-data-reference syntax is offered. A request that offers an ordinary CT only as JPEG 2000 Lossless, with no Implicit VR Little Endian context for it, is out of conformance, and the acceptor is no longer bound by 10.1’s rule against rejecting every context for that SOP class.
The user information. These sub-items carry the negotiated limits and identities (PS3.8, Annex D; PS3.7, Section D.3.3):
- Maximum length, required. The largest P-DATA-TF variable field this side is prepared to receive. Each direction sets its own; zero means no limit is specified.
- Implementation Class UID, required, and Implementation Version Name, optional, up to 16 characters. Together they identify the software on the other end. They’re the closest thing the protocol has to a version stamp, and they’re what to match against the conformance statement for that release.
- Asynchronous operations window, optional. If it’s absent, the default is one outstanding operation at a time.
- SCP/SCU role selection, optional, at most one item per SOP class. If it’s absent, the requester is the SCU and the acceptor is the SCP. You’ll see it when the requester wants to act as the SCP on the association it opened: a storage commitment result sent on a new association, or C-GET, where the requester receives the C-STOREs.
The answer#
The acceptor answers with an A-ASSOCIATE-AC or an A-ASSOCIATE-RJ.
A reject#
An RJ has three numbers (PS3.8, Section 9.3.4). The result is 1, rejected-permanent, or 2, rejected-transient. The source says who refused, and the reason means something only together with the source:
| Source | Reason | Reads as |
|---|---|---|
| 1 service-user | 1 | No reason given |
| 1 service-user | 2 | Application context name not supported |
| 1 service-user | 3 | Calling AE title not recognized |
| 1 service-user | 7 | Called AE title not recognized |
| 2 service-provider (ACSE) | 1 | No reason given |
| 2 service-provider (ACSE) | 2 | Protocol version not supported |
| 3 service-provider (presentation) | 1 | Temporary congestion |
| 3 service-provider (presentation) | 2 | Local limit exceeded |
Source 3 is the provider’s own limits, temporary congestion or a local limit exceeded. In my experience it’s the association cap, the reject that comes and goes at shift change. The AE-title reasons are configuration. In my experience the reject you see most is source 1, reason 1, because many products answer every refusal, AE titles included, with “no reason given”, and the real reason is only in the acceptor’s own log.
An accept, and what it really accepted#
An AC doesn’t mean everything was accepted. It returns one result per proposed context (PS3.8, Section 9.3.3.2):
| Result | Meaning |
|---|---|
| 0 | Acceptance |
| 1 | User rejection |
| 2 | No reason (provider rejection) |
| 3 | Abstract syntax not supported |
| 4 | Transfer syntaxes not supported |
For an accepted context, the AC carries exactly one transfer syntax: the one the acceptor picked from the requester’s list. That is the encoding every data set on that context will use. For a rejected context, the transfer syntax field is there but means nothing; the standard says not to test it. An AC in which every context is rejected is still an AC. The association opens, and nothing useful can travel on it.
This is where most of what a conformance statement promised gets confirmed or contradicted. Line up each proposed context with its result. A 3 means the acceptor doesn’t support that SOP class on this AE title. A 4 means none of the transfer syntaxes in that context was acceptable; another context for the same SOP class may still be accepted. A 0 with a transfer syntax you didn’t expect, Explicit VR Little Endian where you expected JPEG 2000, means the images travel uncompressed on this association. Whether the archive stores them that way depends on its own ingest settings, so check those before assuming the storage estimate is wrong.
Read the acceptor’s user information too. Its maximum length is what the requester must fragment to. Its Implementation Class UID and Version Name identify the acceptor’s software. And if the requester proposed role selection, check the reply. An acceptor that leaves out the role selection item has refused it, and the default roles apply; the item carries a separate value for each role, and a 0 in the reply refuses that role alone. Role selection is per SOP class: a C-GET requester stays the SCU for the C-GET itself, but needs the SCP role for each storage SOP class it expects to receive. If the reply refuses that role, or leaves the item out, those C-STOREs can’t come back to it (PS3.7, Section D.3.3.4).
The data#
Once the association is up, everything travels in P-DATA-TF PDUs (PS3.8, Section 9.3.5). Each carries one or more presentation data values, and each of those names the presentation context it belongs to and starts with a one-byte message control header (PS3.8, Annex E.2). Bit 0 says whether the fragment is command (1) or data set (0); bit 1 says whether it’s the last fragment of that command or data set. The command set is always encoded as implicit VR little endian; the data set uses the transfer syntax accepted for its context (PS3.7, Section 6.3).
A large object doesn’t arrive in one PDU. It arrives as a long run of data set fragments, each within the receiver’s maximum length, the last one flagged. A log that shows the command and then a few hundred fragments and then nothing, no last-fragment flag and no response, means the transfer didn’t complete normally, or that the trace itself is incomplete. Check how the association ended, and the TCP connection, before deciding whether the sender, the receiver or the network stopped it.
The command itself is a small set of group 0000 elements (PS3.7, Annex E). The ones to read:
- Command Field (0000,0100). Which operation: 0001H C-STORE-RQ and 8001H its response, 0020H/8020H C-FIND, 0021H/8021H C-MOVE, 0010H/8010H C-GET, 0030H/8030H C-ECHO, 0FFFH C-CANCEL-RQ, and the N- requests 0100H to 0150H with responses 8100H to 8150H.
- Message ID (0000,0110) and Message ID Being Responded To (0000,0120). These pair each response with its request. When the async window allows more than one outstanding operation, responses can come back out of order, and this pair is the protocol-defined way to match them.
- Affected SOP Instance UID (0000,1000). The object, by UID. This is how you find one image in a log of thousands.
- Status (0000,0900), in every response.
- Offending Element (0000,0901) and Error Comment (0000,0902), when present. For C-STORE warnings and failures they’re the standard’s place for which elements, and why.
Statuses fall into classes (PS3.7, Annex C): 0000 success; 0001, Bxxx, 0107 and 0116 warning; Axxx, Cxxx, 01xx other than 0107 and 0116, and 02xx failure; FE00 cancel; FF00 and FF01 pending. For C-STORE, a warning still means the SCP reports the object stored, with a caveat: B000 means the SCP coerced data elements, B006 that it discarded some, B007 that the data set doesn’t match the SOP class (PS3.4, Section B.2.3). In my experience warnings are the statuses most often lost, because the sending side logs them as success.
The ending#
A clean ending is an A-RELEASE-RQ answered by an A-RELEASE-RP. Anything else is worth a second look.
An A-ABORT has a source and a reason (PS3.8, Section 9.3.8). Source 0 is the service user, usually the application deciding to stop (the state machine also sends it for a malformed PDU that arrives before the association request); the reason field is then not significant. Source 2 is the protocol layer itself, with a reason: unrecognized PDU, unexpected PDU, unrecognized or unexpected PDU parameter, invalid parameter value, or reason not specified. Reasons 1, 2, 4, 5 and 6 name a protocol fault: one side sent something the other couldn’t parse or didn’t expect in that state. Reason 3 is reserved, and reason 0 means none was specified. When a specific fault is named, in my experience it points at an implementation or interoperability defect rather than at configuration.
Then there’s the ending that isn’t in the log at all: the TCP connection simply closes, with no release and no abort. PS3.8 lists the cases where a connection is closed, including a network failure and the remote side disconnecting (PS3.8, Section 9.1.4). The ARTIM timer, whose value must be configurable (PS3.8, Section 9.1.5), bounds the wait for an association request after a TCP connect, and the wait for the connection to close after a reject, a release response or an abort. One silent close is in the standard itself: an acceptor whose ARTIM expires before any request arrives closes the connection without sending a PDU. Waiting for an AC or a release response isn’t ARTIM’s job; the standard leaves that to the application (the Note in 9.1.4). In my experience a silent close during a stalled large transfer is most often a firewall, load balancer or application timeout, and a silent close right after the request is an acceptor that crashed, or a port that something other than DICOM is listening on. Either way the DICOM log can only tell you it happened; the packet capture tells you who closed it.
A worked example#
The log below is illustrative, written for this post in a neutral notation, not copied from any product or site. A CT scanner sends to an archive.
A-ASSOCIATE-RQ calling=CT_SCAN_3 called=ARCHIVE
application context 1.2.840.10008.3.1.1.1
pc 1 CT Image Storage 1.2.840.10008.5.1.4.1.1.2
TS JPEG 2000 Lossless Only 1.2.840.10008.1.2.4.90
pc 3 CT Image Storage 1.2.840.10008.5.1.4.1.1.2
TS Explicit VR Little Endian 1.2.840.10008.1.2.1
TS Implicit VR Little Endian 1.2.840.10008.1.2
pc 5 Verification 1.2.840.10008.1.1
TS Implicit VR Little Endian 1.2.840.10008.1.2
max length 16384 impl class <scanner UID> impl version CT_5.2.1
A-ASSOCIATE-AC
pc 1 result 4 (transfer syntaxes not supported)
pc 3 result 0 (acceptance) TS 1.2.840.10008.1.2.1
pc 5 result 0 (acceptance) TS 1.2.840.10008.1.2
max length 65536 impl class <archive UID> impl version ARC_8.1
P-DATA-TF pc 3 command, last C-STORE-RQ msg id 7 SOP inst 1.2.3...0017
P-DATA-TF pc 3 data set (fragments 1..7)
P-DATA-TF pc 3 data set, last
P-DATA-TF pc 3 command, last C-STORE-RSP responding to 7 status B000
A-RELEASE-RQ
A-RELEASE-RPRead in order, it says:
- The request is conformant. CT Image Storage is offered with Implicit VR Little Endian in context 3, so PS3.5 10.1 is satisfied even though context 1 offers JPEG 2000 alone.
- The archive won’t take JPEG 2000 for CT on this AE title. Context 1 comes back 4. If the scanner was configured to send compressed to save archive space, it isn’t: on this association the images travel uncompressed. Whether the archive stores them that way is its own ingest setting, worth checking.
- It chose Explicit VR Little Endian from context 3, so the images arrive uncompressed, explicit VR.
- The limits differ by direction. The scanner sends to the archive in P-DATA-TF variable fields of up to 65,536 bytes, the archive’s figure; the archive’s responses come back in up to 16,384, the scanner’s own.
- The image was stored, but changed. B000 is a warning: the archive coerced one or more data elements. The status code doesn’t say which. Look in the response for Offending Element (0000,0901) and Error Comment (0000,0902); if the archive didn’t send them, its own log or a comparison of the header before and after will. If the scanner logs this as plain success, nobody finds out.
- The association ended cleanly.
Two findings for a ticket, and neither one would have shown up as an error.
What the log can’t tell you#
The association log records the conversation between two application entities. It doesn’t record what the receiving application did afterwards. A C-STORE that returns success can still be followed by an indexing failure, a routing rule that never fires, or a reconciliation that files the study under the wrong patient, and none of that appears in the association trace. When the DIMSE conversation looks right and the workflow still fails, follow the object into the receiving system’s own application logs, and query for it the way a downstream system would.
How I read one#
The order that’s worked for me:
- Find the association. Calling and called AE titles, and the time. On a busy archive, the Affected SOP Instance UID of one known image is the fastest way in.
- AC or RJ? If RJ, read result, source and reason, then read the acceptor’s own log; in my experience “no reason given” is common.
- Line up the contexts. Every proposed context against its result, and the transfer syntax chosen for each accepted one. Compare against both conformance statements.
- Note the identities and limits. Implementation Class UID and Version Name on both sides, and the maximum length each side will receive.
- Follow each operation. Request to response by Message ID, and the status class of every response. Warnings first; they’re the ones nobody else reads.
- Check the ending. Release, abort (which source, which reason), or a connection that just closed. If it just closed, go to the packet capture.
Most of the problems I’m called in for are visible by step 3.
Sources#
- DICOM PS3.8, Network Communication Support for Message Exchange: https://dicom.nema.org/medical/dicom/current/output/chtml/part08/PS3.8.html. Section 9.1.4 (closing a TCP connection) and 9.1.5 (ARTIM timer); Section 9.3 for the PDU structures: 9.3.2 A-ASSOCIATE-RQ, 9.3.2.2 presentation contexts, 9.3.3.2 presentation context results, 9.3.4 A-ASSOCIATE-RJ, 9.3.5 P-DATA-TF, 9.3.6 to 9.3.8 release and abort; Annex D for maximum length; Annex E.2 for the message control header.
- DICOM PS3.7, Message Exchange: https://dicom.nema.org/medical/dicom/current/output/chtml/part07/PS3.7.html. Section 6.3 for command encoding; Annex A.2.1 for the application context name; Annex C for status classes; Section D.3.3 for implementation identification, the asynchronous operations window and role selection; Annex E for the command fields.
- DICOM PS3.5, Section 10.1, for the default transfer syntax: https://dicom.nema.org/medical/dicom/current/output/chtml/part05/chapter_10.html.
- DICOM PS3.4, Section B.2.3, for C-STORE status codes: https://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.2.3.html.
- DICOM PS3.6, Annex A, for the UIDs in the example.
- What products log by default, how often each reject reason appears, and what silent closes usually turn out to be are from my own work and stated as experience.
