本文整理汇总了C#中Dicom.Network.DcmCommand类的典型用法代码示例。如果您正苦于以下问题:C# DcmCommand类的具体用法?C# DcmCommand怎么用?C# DcmCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DcmCommand类属于Dicom.Network命名空间,在下文中一共展示了DcmCommand类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendNSetResponse
protected void SendNSetResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance,
DcmDataset dataset, DcmStatus status)
{
DcmCommand command = new DcmCommand();
command.AffectedSOPClassUID = affectedClass;
command.CommandField = DcmCommandField.NSetResponse;
command.MessageIDBeingRespondedTo = messageIdRespondedTo;
command.HasDataset = (dataset != null);
command.Status = status;
command.AffectedSOPInstanceUID = affectedInstance;
Log.Info("{0} -> N-Set response [id: {1}; class: {2}]: {3}", LogID, messageIdRespondedTo, affectedClass.Description, status);
SendDimse(presentationID, command, dataset);
}
示例2: SendNGetRequest
protected void SendNGetRequest(byte presentationID, ushort messageID, DicomUID requestedClass, DicomUID requestedInstance, DicomTag[] attributes)
{
DcmCommand command = new DcmCommand();
command.RequestedSOPClassUID = requestedClass;
command.CommandField = DcmCommandField.NGetRequest;
command.MessageID = messageID;
command.HasDataset = false;
command.RequestedSOPInstanceUID = requestedInstance;
command.AttributeIdentifierList = new DcmAttributeTag(DicomTags.AttributeIdentifierList);
command.AttributeIdentifierList.SetValues(attributes);
Log.Info("{0} -> N-Get request [pc: {1}; id: {2}; class: {3}]", LogID, presentationID, messageID, requestedClass.Description);
SendDimse(presentationID, command, null);
}
示例3: SendNSetRequest
protected void SendNSetRequest(byte presentationID, ushort messageID, DicomUID requestedClass, DicomUID requestedInstance, DcmDataset dataset)
{
DcmCommand command = new DcmCommand();
command.RequestedSOPClassUID = requestedClass;
command.CommandField = DcmCommandField.NSetRequest;
command.MessageID = messageID;
command.HasDataset = (dataset != null);
command.RequestedSOPInstanceUID = requestedInstance;
Log.Info("{0} -> N-Set request [pc: {1}; id: {2}; class: {3}]", LogID, presentationID, messageID, requestedClass.Description);
SendDimse(presentationID, command, dataset);
}
示例4: SendNActionRequest
protected void SendNActionRequest(byte presentationID, ushort messageID, DicomUID requestedClass, DicomUID requestedInstance,
ushort actionTypeID, DcmDataset dataset)
{
DcmCommand command = new DcmCommand();
command.RequestedSOPClassUID = requestedClass;
command.CommandField = DcmCommandField.NActionRequest;
command.MessageID = messageID;
command.HasDataset = (dataset != null);
command.RequestedSOPInstanceUID = requestedInstance;
command.ActionTypeID = actionTypeID;
Log.Info("{0} -> N-Action request [pc: {1}; id: {2}; class: {3}; action: {4:x4}]",
LogID, presentationID, messageID, requestedClass, actionTypeID);
SendDimse(presentationID, command, dataset);
}
示例5: SendNEventReportRequest
protected void SendNEventReportRequest(byte presentationID, ushort messageID, DicomUID affectedClass, DicomUID affectedInstance,
ushort eventTypeID, DcmDataset dataset)
{
DcmCommand command = new DcmCommand();
command.AffectedSOPClassUID = affectedClass;
command.CommandField = DcmCommandField.NEventReportRequest;
command.MessageID = messageID;
command.HasDataset = (dataset != null);
command.AffectedSOPInstanceUID = affectedInstance;
command.EventTypeID = eventTypeID;
Log.Info("{0} -> N-EventReport request [pc: {1}; id: {2}; class: {3}; event: {4:x4}]",
LogID, presentationID, messageID, affectedClass.Description, eventTypeID);
SendDimse(presentationID, command, dataset);
}
示例6: OnSendDimseProgress
protected virtual void OnSendDimseProgress(byte pcid, DcmCommand command, DcmDataset dataset, DcmDimseProgress progress)
{
}
示例7: SendCCancelRequest
protected void SendCCancelRequest(byte presentationID, ushort messageIdRespondedTo)
{
DcmCommand command = new DcmCommand();
command.CommandField = DcmCommandField.CCancelRequest;
command.MessageIDBeingRespondedTo = messageIdRespondedTo;
command.HasDataset = false;
Log.Info("{0} -> C-Cancel request [pc: {1}; id: {2}]", LogID, presentationID, messageIdRespondedTo);
SendDimse(presentationID, command, null);
}
示例8: SendDimseStream
private bool SendDimseStream(byte pcid, DcmCommand command, Stream datastream)
{
try {
_disableTimeout = true;
DicomTransferSyntax ts = _assoc.GetAcceptedTransferSyntax(pcid);
DcmDimseProgress progress = new DcmDimseProgress();
progress.EstimatedCommandLength = (int)command.CalculateWriteLength(DicomTransferSyntax.ImplicitVRLittleEndian, DicomWriteOptions.Default | DicomWriteOptions.CalculateGroupLengths);
if (datastream != null)
progress.EstimatedDatasetLength = (int)datastream.Length - (int)datastream.Position;
PDataTFStream pdustream = new PDataTFStream(_network, pcid, (int)_assoc.MaximumPduLength);
pdustream.OnPduSent += delegate() {
progress.BytesTransfered = pdustream.BytesSent;
OnSendDimseProgress(pcid, command, null, progress);
};
lock (_socket) {
OnSendDimseBegin(pcid, command, null, progress);
DicomStreamWriter dsw = new DicomStreamWriter(pdustream);
dsw.Write(command, DicomWriteOptions.Default | DicomWriteOptions.CalculateGroupLengths);
dsw = null;
if (datastream != null) {
pdustream.IsCommand = false;
pdustream.Write(datastream);
}
// last pdu is automatically flushed when streaming
//pdustream.Flush(true);
OnSendDimse(pcid, command, null, progress);
}
return true;
}
catch (Exception e) {
#if DEBUG
Log.Error("{0} -> Error sending DIMSE: {1}", LogID, e.ToString());
#else
Log.Error("{0} -> Error sending DIMSE: {1}", LogID, e.Message);
#endif
OnNetworkError(e);
return false;
}
finally {
_disableTimeout = false;
}
}
示例9: OnReceiveDimseBegin
protected virtual void OnReceiveDimseBegin(byte pcid, DcmCommand command, DcmDataset dataset, DcmDimseProgress progress)
{
}
示例10: SendDimse
private bool SendDimse(byte pcid, DcmCommand command, DcmDataset dataset)
{
try {
_disableTimeout = true;
DicomTransferSyntax ts = _assoc.GetAcceptedTransferSyntax(pcid);
if (dataset != null && ts != dataset.InternalTransferSyntax) {
if (ts.IsEncapsulated || dataset.InternalTransferSyntax.IsEncapsulated)
throw new DicomNetworkException("Unable to transcode encapsulated transfer syntax!");
dataset.ChangeTransferSyntax(ts, null);
}
DcmDimseProgress progress = new DcmDimseProgress();
progress.EstimatedCommandLength = (int)command.CalculateWriteLength(DicomTransferSyntax.ImplicitVRLittleEndian, DicomWriteOptions.Default | DicomWriteOptions.CalculateGroupLengths);
if (dataset != null)
progress.EstimatedDatasetLength = (int)dataset.CalculateWriteLength(ts, DicomWriteOptions.Default);
PDataTFStream pdustream = new PDataTFStream(_network, pcid, (int)_assoc.MaximumPduLength);
pdustream.OnPduSent += delegate() {
progress.BytesTransfered = pdustream.BytesSent;
OnSendDimseProgress(pcid, command, dataset, progress);
};
lock (_socket) {
OnSendDimseBegin(pcid, command, dataset, progress);
DicomStreamWriter dsw = new DicomStreamWriter(pdustream);
dsw.Write(command, DicomWriteOptions.Default | DicomWriteOptions.CalculateGroupLengths);
if (dataset != null) {
pdustream.IsCommand = false;
dsw.Write(dataset, DicomWriteOptions.Default);
}
// flush last pdu
pdustream.Flush(true);
OnSendDimse(pcid, command, dataset, progress);
}
return true;
}
catch (Exception e) {
#if DEBUG
Log.Error("{0} -> Error sending DIMSE: {1}", LogID, e.ToString());
#else
Log.Error("{0} -> Error sending DIMSE: {1}", LogID, e.Message);
#endif
OnNetworkError(e);
return false;
}
finally {
_disableTimeout = false;
}
}
示例11: CreateResponse
private DcmCommand CreateResponse(ushort messageIdRespondedTo, DcmCommandField commandField, DicomUID affectedClass, DcmStatus status, bool hasDataset)
{
DcmCommand command = new DcmCommand();
command.AffectedSOPClassUID = affectedClass;
command.CommandField = commandField;
command.MessageIDBeingRespondedTo = messageIdRespondedTo;
command.HasDataset = hasDataset;
command.Status = status;
if (!String.IsNullOrEmpty(status.ErrorComment))
command.ErrorComment = status.ErrorComment;
return command;
}
示例12: CreateRequest
private DcmCommand CreateRequest(ushort messageID, DcmCommandField commandField, DicomUID affectedClass, DcmPriority priority, bool hasDataset)
{
DcmCommand command = new DcmCommand();
command.AffectedSOPClassUID = affectedClass;
command.CommandField = commandField;
command.MessageID = messageID;
command.Priority = priority;
command.HasDataset = hasDataset;
return command;
}
示例13: OnReceiveDimse
protected override void OnReceiveDimse(byte pcid, DcmCommand command, DcmDataset dataset, DcmDimseProgress progress)
{
if (command.CommandField == DcmCommandField.CStoreRequest)
{
IsReceiveConnection = true;
SaveDimseToFile(dataset);
}
base.OnReceiveDimse(pcid, command, dataset, progress);
}
示例14: CreateResponse
private DcmCommand CreateResponse(ushort messageIdRespondedTo, DcmCommandField commandField, DicomUID affectedClass, DcmStatus status, bool hasDataset) {
DcmCommand command = new DcmCommand();
command.AffectedSOPClassUID = affectedClass;
command.CommandField = commandField;
command.MessageIDBeingRespondedTo = messageIdRespondedTo;
command.HasDataset = hasDataset;
command.Status = status;
return command;
}