Skip to main content


class EnsLib.DICOM.Adapter.TCP extends EnsLib.TCP.DuplexAdapter

This adapter is the principal means for DICOM peers to communicate with Ensemble

Property Inventory

Method Inventory


parameter DOMAIN = EnsDICOM;
Domain for $$$Text()
parameter SERVICEINPUTCLASS = EnsLib.DICOM.Document;
parameter SERVICEOUTPUTCLASS = EnsLib.DICOM.Document;
parameter SETTINGS = LocalAET,RemoteAET,TraceVerbosity,ARTIM,TXTIM;
Configurable settings


property AssociationId as %String;
This holds the association identifier. Each established association has its own unique value.
Property methods: AssociationIdDisplayToLogical(), AssociationIdGet(), AssociationIdIsValid(), AssociationIdLogicalToDisplay(), AssociationIdLogicalToOdbc(), AssociationIdNormalize(), AssociationIdSet()
property ContextId as %Integer;
This holds the context id. For each message exchanged within an association the context id indicates the index of the Presentation Context that should be used.
Property methods: ContextIdDisplayToLogical(), ContextIdGet(), ContextIdIsValid(), ContextIdLogicalToDisplay(), ContextIdNormalize(), ContextIdSet()
property InboundDocument as EnsLib.DICOM.Document;
This holds the incoming Document
Property methods: InboundDocumentGet(), InboundDocumentGetObject(), InboundDocumentGetObjectId(), InboundDocumentGetSwizzled(), InboundDocumentIsValid(), InboundDocumentNewObject(), InboundDocumentSet(), InboundDocumentSetObject(), InboundDocumentSetObjectId(), InboundDocumentUnSwizzle()
property LocalAET as %String (MAXLEN = 16);
This holds the Called Application Entity Title (AET) that remote DICOM peers should use to communicate with US. When the adapter is in the role of Service Class Provider (SCP, server), it may contain the special wild card value '*'. Wildcard values for both LocalAET and RemoteAET force the adapter to accept any combination of Local and Remote AET provided a predefined AssociationContext exists which matches these values.
Property methods: LocalAETDisplayToLogical(), LocalAETGet(), LocalAETIsValid(), LocalAETLogicalToDisplay(), LocalAETLogicalToOdbc(), LocalAETNormalize(), LocalAETSet()
property MessageId as %Integer;
This holds the outgoing message id counter.
Property methods: MessageIdDisplayToLogical(), MessageIdGet(), MessageIdIsValid(), MessageIdLogicalToDisplay(), MessageIdNormalize(), MessageIdSet()
property NextState as %String [ InitialExpression = $$$NOSTATE ];
This holds the next state to switch to
Property methods: NextStateDisplayToLogical(), NextStateGet(), NextStateIsValid(), NextStateLogicalToDisplay(), NextStateLogicalToOdbc(), NextStateNormalize(), NextStateSet()
property RemoteAET as %String);
This holds the Calling Application Entity Title(s) of remote DICOM peers. When the adapter is in the role of Service Class Provider (SCP, server) it should contain either a wildcard '*' or a comma delimited list of 'names' of the DICOM peers which are allowed to connect. A name can either be a literal string or a pattern/substitution specification of the form ?Pattern/Substitution. For the pattern/substitution form a calling AET is matches against the pattern,If there is a match then the substitution is used for the purposes of association validation. Example ?1"B".E/JD-SCU would match any calling AET that starts with 'B' and substitutes JD-SCU. To accept ANY AET use ?.E for a pattern When the adapter is in the role of Service Class User (SCU, client) it MUST contain the AET of the DICOM peer to which WE are connecting.
Property methods: RemoteAETDisplayToLogical(), RemoteAETGet(), RemoteAETIsValid(), RemoteAETLogicalToDisplay(), RemoteAETLogicalToOdbc(), RemoteAETNormalize(), RemoteAETSet()
property Role as %Integer;
This holds the Role. If this adapter is associatied with a DuplexService then the role is ServiceClassProvider (SCP, server) otherwise the role is ServiceClassUser (SCU, client)
Property methods: RoleDisplayToLogical(), RoleGet(), RoleIsValid(), RoleLogicalToDisplay(), RoleNormalize(), RoleSet()
property TraceVerbosity as %Integer [ InitialExpression = 0 ];
This holds the debug flag, set to 1 for terse debug information, 2 for verbose, 0 for none.
Property methods: TraceVerbosityDisplayToLogical(), TraceVerbosityGet(), TraceVerbosityIsValid(), TraceVerbosityLogicalToDisplay(), TraceVerbosityNormalize(), TraceVerbositySet()
property TransferSyntax as %String);
This holds the (overriden) transfer syntax
Property methods: TransferSyntaxDisplayToLogical(), TransferSyntaxGet(), TransferSyntaxIsValid(), TransferSyntaxLogicalToDisplay(), TransferSyntaxLogicalToOdbc(), TransferSyntaxNormalize(), TransferSyntaxSet()


method AbortAssociation(pSource As %Integer, pReason As %Integer) as %Status
Use this method to abort an Association
method AbortReasonGet() as %Integer
Accessor for AbortReason
method AbortSourceGet() as %Integer
Accessor for AbortSource
method AssociationIsEstablishedGet() as %Boolean
Accessor for AssociationIsEstablished
method ComposeAssociationContext(pAssociationType As %Integer, ByRef pDataToInsert As %String, Output pBytes As %String)
Compose an AssocationContext
method EstablishAssociation(pRequest As EnsLib.DICOM.Command.Establish) as %Status
Use this method to Establish an Association (when role is SCU)
method FindContextForOutboundTransfer(pAbstractSyntax As %String, pTransferSyntax As %String, Output pContextId As %Integer) as %Status
Given an abstract syntax, find the context id for the accepted presentation context. The alogrithm employed is VERY important. Ideally we want an EXACT match between negotiated transfer syntax and the transfer syntax which the document is encoded in as this involves as expensive conversion process. Additionally some conversions may NOT be possible, for example, converting a compressed/encapsulated transfer syntax to one of the basic syntaxes would or vice versa would require a compression/decompresssion step which is currently NOT supported. If an exact match cannot be found then the next best thing is to find a match where a supported conversion IS possible.
method GetAssociationDetail(pDirection As %Integer, pContextId, Output pAbstractSyntax As %String, Output pTransferSyntax As %String) as %Status
method GetCurrentAbstractSyntax(pPCId) as %String
Given a presentation context id, return the negotiated syntax
method GetCurrentTransferSyntax(pPCId) as %String
Given a presentation context id, return the negotiated syntax
method GetNextMessageId() as %Integer
Increment the message id. This is done when sending out a new message
method LoadAssociationData(pCallingAET As %String, pCalledAET As %String, ByRef pREQUEST As %String) as %Status
Load the Association Data to Send. This loads the stored AssociationContext instance for the Called/CallingAET tuple and makes a list of the presentation contexts to be presented to the DICOM peer, as well as (crucially ), the maximum PDU length
method OnCloseConnection() as %Status
method OnDeviceDisconnected() as %Status
method OnDeviceTimeout(pShouldQuit As %Boolean) as %Status
This method is called when the timeout expires
method OnInit() as %Status
Inherited description: This user callback method is called just after %OnNew()
method OnOpenConnection() as %Status
This method is called by the business host when a connection is opened For a service this will be called when the external AE connects in a TCP sense For an operation when the adapter is instructed to open the Association.
method OnTearDown() as %Status
This user callback method is called just before %OnClose()
method PDU2EYE(pType As %Integer)
This method expands a PDU type into eye-readable format
method PrepareForIncomingDocument() as %Status
This method prepares for an incoming message
method RecordAbortDetails(pSource As %Integer, pReason As %Integer)
This method records details regarding an error situation so the correct abort information can be sent to the peer.
method ReleaseAssociation() as %Status
Use this method to close an Association
method RoleGet() as %Integer
Accessor for Role
method SendDocument(pDocument As EnsLib.DICOM.Document) as %Status
This method sends the specified document to the connected peer
method TraceMessage(pVerbosity As %Integer, pMessage As %String)
Write a message to the console

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab