DIMSE classes

The DIMSE classes (DICOM Service) take care of transmitting and receiving DICOM commands through a DICOM association (a imebra::AssociationBase derived class).

The main DIMSE class is imebra::DimseService, through which all the DICOM commands and responses are sent and received.

DimseService

class DimseService

Sends and receives DICOM commands and responses through a AssociationSCU or an AssociationSCP.

The DimseService supplies getNextCommandID() in order to obtain the ID for the commands sent through the DimseService object.

Parameters
  • association: the AssociationBase derived class through which the DICOM commands and responses are sent and received

Public Functions

DimseService(AssociationBase &association)

Constructor.

Parameters
  • association: the AssociationBase derived class through which the DICOM commands and responses are sent and received

std::string getTransferSyntax(const std::string &abstractSyntax) const

Returns the negotiated transfer syntax for a specific abstract syntax.

This method is multithread safe.

Return
the negotiated transfer syntax for the specified abstract syntax
Parameters
  • abstractSyntax: the abstract syntax for which the transfer syntax is needed

std::uint16_t getNextCommandID()

Retrieves an ID that can be used on the next command sent through this DimseService object.

This method is multithread safe.

Return
an ID that can be used as command ID on a command sent through this DimseService object

DimseCommand *getCommand()

Retrieves the next incoming DICOM command.

The command blocks until the command is available or until the association is closed, either by the connected peer or by other means (e.g because of the DIMSE timeout), in which case the exception StreamEOFError is thrown.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

This method can be called by several threads at once: each thread will receive a DIMSE command and can reply to the command via sendCommandOrResponse().

The underlying AssociationBase object will take care of limiting the number of incoming command according to the maximum number of performed operation negotiated for the association.

Throws StreamEOFError if the association is closed while the method is waiting for an incoming command.

Return
the next incoming DICOM command

void sendCommandOrResponse(const DimseCommandBase &command)

Sends a DICOM command or response through the association.

This method is multithread safe.

Parameters
  • command: the command or response to send

CStoreResponse *getCStoreResponse(const CStoreCommand &command)

Wait for the response for the specified C-STORE command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent C-CSTORE command for which to wait for a response

CGetResponse *getCGetResponse(const CGetCommand &command)

Wait for the response for the specified C-GET command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent C-GET command for which to wait for a response

CFindResponse *getCFindResponse(const CFindCommand &command)

Wait for the response for the specified C-FIND command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent C-FIND command for which to wait for a response

CMoveResponse *getCMoveResponse(const CMoveCommand &command)

Wait for the response for the specified C-MOVE command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent C-MOVE command for which to wait for a response

CEchoResponse *getCEchoResponse(const CEchoCommand &command)

Wait for the response for the specified C-ECHO command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent C-ECHO command for which to wait for a response

NEventReportResponse *getNEventReportResponse(const NEventReportCommand &command)

Wait for the response for the specified N-EVENT-REPORT command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-EVENT-REPORT command for which to wait for a response

NGetResponse *getNGetResponse(const NGetCommand &command)

Wait for the response for the specified N-GET command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-GET command for which to wait for a response

NSetResponse *getNSetResponse(const NSetCommand &command)

Wait for the response for the specified N-SET command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-SET command for which to wait for a response

NActionResponse *getNActionResponse(const NActionCommand &command)

Wait for the response for the specified N-ACTION command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-ACTION command for which to wait for a response

NCreateResponse *getNCreateResponse(const NCreateCommand &command)

Wait for the response for the specified N-CREATE command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-CREATE command for which to wait for a response

NDeleteResponse *getNDeleteResponse(const NDeleteCommand &command)

Wait for the response for the specified N-DELETE command and returns it.

Other threads can wait for other commands or responses from the same DIMSE service. All the commands and responses are received by a secondary thread and distributed to all the listener waiting for a command or a response.

Return
the response for the specified command
Parameters
  • command: the sent N-DELETE command for which to wait for a response

DimseCommandBase

class DimseCommandBase

Base class for the DICOM commands and responses.

Subclassed by imebra::DimseCommand, imebra::DimseResponse

Public Functions

std::string getAffectedSopInstanceUid() const

Returns the affected SOP instance UID.

Return
the affected SOP instance UID

std::string getAffectedSopClassUid() const

Returns the affected SOP Class UID.

Return
the affected SOP Class UID

std::string getRequestedSopInstanceUid() const

Returns the requested SOP instance UID.

Return
requested SOP instance UID

std::string getRequestedSopClassUid() const

Returns the requested SOP class UID.

Return
requested SOP class UID

DimseCommand

class DimseCommand : public imebra::DimseCommandBase

Base class for the DICOM commands.

Subclassed by imebra::CCancelCommand, imebra::CEchoCommand, imebra::CFindCommand, imebra::CGetCommand, imebra::CMoveCommand, imebra::CStoreCommand, imebra::NActionCommand, imebra::NCreateCommand, imebra::NDeleteCommand, imebra::NEventReportCommand, imebra::NGetCommand, imebra::NSetCommand

Public Functions

std::uint16_t getID() const

Returns the command ID.

Return
the command ID

dimseCommandType_t getCommandType() const

Returns the command type.

Return
the command type

CPartialResponse

class CPartialResponse : public imebra::DimseResponse

Base class for all the partial responses (responses to C-GET, C-MOVE and C-FIND).

Subclassed by imebra::CGetResponse, imebra::CMoveResponse

Public Functions

std::uint32_t getRemainingSubOperations() const

Returns the number of remaining C-STORE sub operations.

Return
number of remaining C-STORE sub operations

std::uint32_t getCompletedSubOperations() const

Returns the number of completed C-STORE sub operations.

Return
number of completed C-STORE sub operations

std::uint32_t getFailedSubOperations() const

Returns the number of failed C-STORE sub operations.

Return
number of failed C-STORE sub operations

std::uint32_t getWarningSubOperations() const

Returns the number of C-STORE sub operations completed with warnings.

Return
number of C-STORE sub operations completed with warnings

CStoreCommand

class CStoreCommand : public imebra::DimseCommand

Represents a C-STORE request.

Public Functions

CStoreCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid, const std::string &affectedSopInstanceUid, const std::string &originatorAET, std::uint16_t originatorMessageID, const DataSet &payload)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • priority: message priority
  • affectedSopClassUid: affected SOP instance UID
  • affectedSopInstanceUid: affected SOP instance UID
  • originatorAET: originator AET (issuer of the C-MOVE or C-GET command)
  • originatorMessageID: message ID of the C-MOVE or C-GET that triggered the C-STORE
  • payload: C-STORE payload

std::string getOriginatorAET() const

Returns the AET of the entity that triggered this C-STORE request either via a C-MOVE or a C-GET request.

Return
the AET for the entity that triggered this C-STORE request via a C-MOVE or a C-GET request. Can be empty.

std::uint16_t getOriginatorMessageID() const

Returns the message ID of the C-MOVE or C-GET request that triggered this C-STORE request.

Return
the message ID of the C-MOVE or C-GET request that triggered this C-STORE request. It is zero if it wasn’t set

CStoreResponse

class CStoreResponse : public imebra::DimseResponse

Represents a C-STORE response.

Public Functions

CStoreResponse(const CStoreCommand &command, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • command: the C-STORE command for which this response is being constructed
  • responseCode: the response code.

CGetCommand

class CGetCommand : public imebra::DimseCommand

Represents a C-GET command.

C-GET triggers a C-STORE command that is issued through the same association used for the C-GET, therefore the SCU must have negotiated the SCP role for the abstract syntax (see PresentationContexts and AssociationSCU).

Public Functions

CGetCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid, const DataSet &identifier)

Constructor.

Parameters

CGetResponse

class CGetResponse : public imebra::CPartialResponse

Represents a C-GET response.

Public Functions

CGetResponse(const CGetCommand &receivedCommand, dimseStatusCode_t responseCode, std::uint32_t remainingSubOperations, std::uint32_t completedSubOperations, std::uint32_t failedSubOperations, std::uint32_t warningSubOperations, const DataSet &identifier)

Constructor to use when failed C-STORE operations are present.

This constructor should be used when the response code identifies a canceled operation, a failure, a refused operation or a warning.

Parameters
  • receivedCommand: the C-GET command for which this response is being constructed
  • responseCode: the response code.
  • remainingSubOperations: number of remaining C-STORE operations
  • completedSubOperations: number of completed C-STORE operations
  • failedSubOperations: number of failed C-STORE operations
  • warningSubOperations: number of C-STORE operations completed with warnings
  • identifier: DataSet with the list of failed instance UIDs in the tag FailedSOPInstanceUIDList (0008,0058)

CGetResponse(const CGetCommand &receivedCommand, dimseStatusCode_t responseCode, std::uint32_t remainingSubOperations, std::uint32_t completedSubOperations, std::uint32_t failedSubOperations, std::uint32_t warningSubOperations)

Constructor to use when all the C-STORE operations succeeded.

Parameters
  • receivedCommand: the C-GET command for which this response is being constructed
  • responseCode: the response code.
  • remainingSubOperations: number of remaining C-STORE operations
  • completedSubOperations: number of completed C-STORE operations
  • failedSubOperations: number of failed C-STORE operations
  • warningSubOperations: number of C-STORE operations completed with warnings

CFindCommand

class CFindCommand : public imebra::DimseCommand

Represents a C-FIND command.

Public Functions

CFindCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid, const DataSet &identifier)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • priority: the message priority
  • affectedSopClassUid: the affected SOP class UID
  • identifier: the dataset with the identifier (list of tags to match and their requested values)

CFindResponse

class CFindResponse : public imebra::DimseResponse

Represents a C-FIND response.

Public Functions

CFindResponse(const CFindCommand &receivedCommand, const DataSet &identifier)

Constructor for responses with pending status.

Responses with pending status carry a DataSet with a single item from the C-FIND query results.

Parameters
  • receivedCommand: command for which the reponse is being constructed
  • identifier: one item from the C-FIND query results

CFindResponse(const CFindCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor for final C-FIND response (success or failure).

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: response code

CMoveCommand

class CMoveCommand : public imebra::DimseCommand

Represents a C-MOVE command.

Public Functions

CMoveCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid, const DataSet &identifier)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • priority: the message priority
  • affectedSopClassUid: affected SOP class UID
  • identifier: the dataset with the identifier (list of tags to match and their requested values)

CMoveResponse

class CMoveCommand : public imebra::DimseCommand

Represents a C-MOVE command.

Public Functions

CMoveCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid, const DataSet &identifier)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • priority: the message priority
  • affectedSopClassUid: affected SOP class UID
  • identifier: the dataset with the identifier (list of tags to match and their requested values)

CEchoCommand

class CEchoCommand : public imebra::DimseCommand

Represents a C-ECHO command.

Public Functions

CEchoCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, const std::string &affectedSopClassUid)

Constructor.

Parameters

CEchoResponse

class CEchoResponse : public imebra::DimseResponse

Represents a C-ECHO response.

Public Functions

CEchoResponse(const CEchoCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: the response code

CCancelCommand

class CCancelCommand : public imebra::DimseCommand

Represents the C-CANCEL command.

Public Functions

CCancelCommand(const std::string &abstractSyntax, std::uint16_t messageID, dimseCommandPriority_t priority, std::uint16_t cancelMessageID)

Constructor.

Parameters

std::uint16_t getCancelMessageID() const

Returns the ID of the message to cancel.

Return
the ID of the message to cancel

NEventReportCommand

class NEventReportCommand : public imebra::DimseCommand

Represents a N-EVENT-REPORT command.

Public Functions

NEventReportCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &affectedSopClassUid, const std::string &affectedSopInstanceUid, std::uint16_t eventID)

Constructor.

Parameters

NEventReportCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &affectedSopClassUid, const std::string &affectedSopInstanceUid, std::uint16_t eventID, const DataSet &eventInformation)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • affectedSopClassUid: the affected SOP class UID
  • affectedSopInstanceUid: the affected SOP instance UID
  • eventID: the event ID
  • pEventInformation: the dataset with event information

std::uint16_t getEventID() const

Returns the event ID.

Return
the event ID

NEventReportResponse

class NEventReportResponse : public imebra::DimseResponse

N-EVENT-REPORT response.

Public Functions

NEventReportResponse(const NEventReportCommand &receivedCommand, const DataSet &eventReply)

Constructor which includes a payload. This implies a successful operation.

Parameters
  • receivedCommand: the N-EVENT request command for which the response is being constructed
  • eventReply: the response payload

NEventReportResponse(const NEventReportCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: the N-EVENT request command for which the response is being constructed
  • responseCode: the response code

std::uint16_t getEventID() const

Get the event ID. The response may omit this information.

Return
the event ID

NSetCommand

class NSetCommand : public imebra::DimseCommand

Represents the N-SET command.

Public Functions

NSetCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &requestedSopClassUid, const std::string &requestedSopInstanceUid, const DataSet &modificationList)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • requestedSopClassUid: the requested SOP class UID
  • requestedSopInstanceUid: the requested SOP instance UID
  • modificationList: dataset containing the new attributes values

NSetResponse

class NSetResponse : public imebra::DimseResponse

Represents the N-SET response.

Public Functions

NSetResponse(const NSetCommand &receivedCommand, attributeIdentifierList_t modifiedAttributes)

Constructor of a successful response.

Parameters
  • receivedCommand: the command for which this response is being constructed
  • modifiedAttributes: list of modified attributes

NSetResponse(const NSetCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: the command for which this response is being constructed
  • responseCode: response code

attributeIdentifierList_t getModifiedAttributes() const

Returns the list of modified attributes.

Return
list of modified attributes

NGetCommand

class NGetCommand : public imebra::DimseCommand

Represents a N-GET command.

Public Functions

NGetCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &requestedSopClassUid, const std::string &requestedSopInstanceUid, const attributeIdentifierList_t &attributeIdentifierList)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • requestedSopClassUid: the requested SOP class UID
  • requestedSopInstanceUid: the requested SOP instance UID
  • attributeIdentifierList:

    the list of identifier tags. An empty list means “all the

    tags”

attributeIdentifierList_t getAttributeList() const

Return the list of attributes to retrieve. an empty list means all.

Return
the list of attributes to retrieve. An empty list means “all the attributes”

NGetResponse

class NGetResponse : public imebra::DimseResponse

Represents a N-GET response.

Public Functions

NGetResponse(const NGetCommand &receivedCommand, dimseStatusCode_t responseCode, const DataSet &attributeList)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: response code
  • attributeList: dataset containing the list of attribute identifiers

NGetResponse(const NGetCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: response code

NActionCommand

class NActionCommand : public imebra::DimseCommand

Represents the N-ACTION command.

Public Functions

NActionCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &requestedSopClassUid, const std::string &requestedSopInstanceUid, std::uint16_t actionID, const DataSet &actionInformation)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • requestedSopClassUid: the requested SOP class UID
  • requestedSopInstanceUid: the requested SOP instance UID
  • actionID: action ID
  • actionInformation: dataset containing information about the action

NActionCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &requestedSopClassUid, const std::string &requestedSopInstanceUid, std::uint16_t actionID)

Constructor.

Parameters

std::uint16_t getActionID() const

Returns the action’s ID.

Return
the action’s ID

NActionResponse

class NActionResponse : public imebra::DimseResponse

Represents the N-ACTION response.

Public Functions

NActionResponse(const NActionCommand &receivedCommand, const DataSet &actionReply)

Constructor for a successful reply.

Parameters
  • receivedCommand: the command for which this response is being constructed
  • actionReply: dataSet with information about the action reply

NActionResponse(const NActionCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor for a successful reply.

Parameters
  • receivedCommand: the command for which this response is being constructed
  • responseCode: the response code

std::uint16_t getActionID() const

Returns the action’s ID.

Return
the action’s ID

NCreateCommand

class NCreateCommand : public imebra::DimseCommand

The N-CREATE command.

Public Functions

NCreateCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &affectedSopClassUid, const std::string &affectedSopInstanceUid, const DataSet &attributeList)

Constructor.

Parameters
  • abstractSyntax: the message’s abstract syntax (previously negotiated via the PresentationContexts parameter of the AssociationSCP or AssociationSCU constructors)
  • messageID: message ID (can be retrieved with DimseService::getNextCommandID()
  • affectedSopClassUid: the affected SOP class UID
  • affectedSopInstanceUid: the affected SOP instance UID
  • attributeList: the dataset containing the attributes and values

NCreateCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &affectedSopClassUid, const std::string &affectedSopInstanceUid)

Constructor.

Parameters

NCreateResponse

class NCreateResponse : public imebra::DimseResponse

Represents the N-CREATE response.

Public Functions

NCreateResponse(const NCreateCommand &receivedCommand, const DataSet &attributeList)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • attributeList: dataset containing the attributes list

NCreateResponse(const NCreateCommand &receivedCommand, const std::string &affectedSopInstanceUid, const DataSet &attributeList)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • affectedSopInstanceUid: affected SOP instance UID
  • attributeList: dataset containing the attributes list

NCreateResponse(const NCreateCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: the response code

NCreateResponse(const NCreateCommand &receivedCommand, const std::string &affectedSopInstanceUid)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • affectedSopInstanceUid: created SOP instance UID

NDeleteCommand

class NDeleteCommand : public imebra::DimseCommand

The N-DELETE command.

Public Functions

NDeleteCommand(const std::string &abstractSyntax, std::uint16_t messageID, const std::string &requestedSopClassUid, const std::string &requestedSopInstanceUid)

Constructor.

Parameters

NDeleteResponse

class NDeleteResponse : public imebra::DimseResponse

The N-DELETE response.

Public Functions

NDeleteResponse(NDeleteCommand &receivedCommand, dimseStatusCode_t responseCode)

Constructor.

Parameters
  • receivedCommand: command for which the response is being constructed
  • responseCode: response code