Class DicomService
Base class for DICOM network services.
Inherited Members
Namespace: Dicom.Network
Assembly: cs.temp.dll.dll
Syntax
public abstract class DicomService : IDicomServiceRunner, IDisposable
Constructors
DicomService(INetworkStream, Encoding, Logger)
Initializes a new instance of the DicomService class.
Declaration
protected DicomService(INetworkStream stream, Encoding fallbackEncoding, Logger log)
Parameters
Type | Name | Description |
---|---|---|
INetworkStream | stream | Network stream. |
Encoding | fallbackEncoding | Fallback encoding. |
Logger | log | Logger |
Fields
_dimseStream
Declaration
protected Stream _dimseStream
Field Value
Type | Description |
---|---|
Stream |
_dimseStreamFile
Declaration
protected IFileReference _dimseStreamFile
Field Value
Type | Description |
---|---|
IFileReference |
_isDisconnectedFlag
Declaration
protected readonly AsyncManualResetEvent _isDisconnectedFlag
Field Value
Type | Description |
---|---|
AsyncManualResetEvent |
Properties
Association
Gets the DICOM association.
Declaration
public DicomAssociation Association { get; }
Property Value
Type | Description |
---|---|
DicomAssociation |
DoHandlePDUBytes
Gets or sets an event handler to handle unsupported PDU bytes.
Declaration
public PDUBytesHandler DoHandlePDUBytes { get; set; }
Property Value
Type | Description |
---|---|
PDUBytesHandler |
IsConnected
Gets whether or not the service is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSendNextMessageRequired
Gets whether or not SendNextMessage is required, i.e. if any requests still have to be sent and there is no send loop currently running.
Declaration
public bool IsSendNextMessageRequired { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSendQueueEmpty
Gets whether or not both the message queue and the pending queue is empty.
Declaration
public bool IsSendQueueEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Logger
Gets or sets the logger.
Declaration
public Logger Logger { get; set; }
Property Value
Type | Description |
---|---|
Logger |
MaximumPDUsInQueue
Gets or sets the maximum number of PDUs in queue.
Declaration
public int MaximumPDUsInQueue { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Options
Gets or sets the DICOM service options.
Declaration
public DicomServiceOptions Options { get; set; }
Property Value
Type | Description |
---|---|
DicomServiceOptions |
UserState
Gets or sets a user state associated with the service.
Declaration
public object UserState { get; set; }
Property Value
Type | Description |
---|---|
Object |
Methods
CreateCStoreReceiveStream(DicomFile)
The purpose of this method is to return the Stream that a SopInstance received via CStoreSCP will be written to. This default implementation creates a temporary file and returns a FileStream on top of it. Child classes can override this to write to another stream and avoid the I/O associated with the temporary file if so desired. Beware that some SopInstances can be very large so using a MemoryStream() could cause out of memory situations.
Declaration
protected virtual void CreateCStoreReceiveStream(DicomFile file)
Parameters
Type | Name | Description |
---|---|---|
DicomFile | file | A DicomFile with FileMetaInfo populated. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
GetCStoreDicomFile()
The purpose of this method is to create a DicomFile for the SopInstance received via CStoreSCP to pass to the IDicomCStoreProvider.OnCStoreRequest method for processing. This default implementation will return a DicomFile if the stream created by CreateCStoreReceiveStream() is seekable or null if it is not. Child classes that override CreateCStoreReceiveStream may also want override this to return a DicomFile for unseekable streams or to do cleanup related to receiving that specific instance.
Declaration
protected virtual DicomFile GetCStoreDicomFile()
Returns
Type | Description |
---|---|
DicomFile | The DicomFile or null if the stream is not seekable. |
OnSendQueueEmptyAsync()
Action to perform when send queue is empty.
Declaration
protected virtual Task OnSendQueueEmptyAsync()
Returns
Type | Description |
---|---|
Task |
RunAsync()
Setup long-running operations that the DICOM service manages.
Declaration
public virtual Task RunAsync()
Returns
Type | Description |
---|---|
Task | Awaitable task maintaining the long-running operation(s). |
SendAbortAsync(DicomAbortSource, DicomAbortReason)
Send abort request.
Declaration
protected Task SendAbortAsync(DicomAbortSource source, DicomAbortReason reason)
Parameters
Type | Name | Description |
---|---|---|
DicomAbortSource | source | Abort source. |
DicomAbortReason | reason | Abort reason. |
Returns
Type | Description |
---|---|
Task |
SendAssociationAcceptAsync(DicomAssociation)
Send association accept response.
Declaration
protected Task SendAssociationAcceptAsync(DicomAssociation association)
Parameters
Type | Name | Description |
---|---|---|
DicomAssociation | association | DICOM association. |
Returns
Type | Description |
---|---|
Task |
SendAssociationRejectAsync(DicomRejectResult, DicomRejectSource, DicomRejectReason)
Send association reject response.
Declaration
protected Task SendAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
Parameters
Type | Name | Description |
---|---|---|
DicomRejectResult | result | Rejection result. |
DicomRejectSource | source | Rejection source. |
DicomRejectReason | reason | Rejection reason. |
Returns
Type | Description |
---|---|
Task |
SendAssociationReleaseRequestAsync()
Send association release request.
Declaration
protected Task SendAssociationReleaseRequestAsync()
Returns
Type | Description |
---|---|
Task |
SendAssociationReleaseResponseAsync()
Send association release response.
Declaration
protected Task SendAssociationReleaseResponseAsync()
Returns
Type | Description |
---|---|
Task |
SendAssociationRequestAsync(DicomAssociation)
Send association request.
Declaration
protected Task SendAssociationRequestAsync(DicomAssociation association)
Parameters
Type | Name | Description |
---|---|---|
DicomAssociation | association | DICOM association. |
Returns
Type | Description |
---|---|
Task |
SendPDUAsync(PDU)
Asynchronously send single PDU.
Declaration
protected Task SendPDUAsync(PDU pdu)
Parameters
Type | Name | Description |
---|---|---|
PDU | pdu | PDU to send. |
Returns
Type | Description |
---|---|
Task | Awaitable task. |
SendRequestAsync(DicomRequest)
Send request from service.
Declaration
public virtual Task SendRequestAsync(DicomRequest request)
Parameters
Type | Name | Description |
---|---|---|
DicomRequest | request | Request to send. |
Returns
Type | Description |
---|---|
Task |
SendResponseAsync(DicomResponse)
Send response from service.
Declaration
protected Task SendResponseAsync(DicomResponse response)
Parameters
Type | Name | Description |
---|---|---|
DicomResponse | response | Response to send. |
Returns
Type | Description |
---|---|
Task |