本文整理汇总了C#中ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的典型用法代码示例。如果您正苦于以下问题:C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的具体用法?C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax怎么用?C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientAssociationParameters
的用法示例。
在下文中一共展示了ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReceiveAssociateAccept
/// <summary>
/// Called when received associate accept. For StorageScu, we then attempt to send the first file.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
public override void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
{
base.OnReceiveAssociateAccept(client, association);
Platform.Log(LogLevel.Info, "Association Accepted:\r\n{0}", association.ToString());
byte pcid = association.FindAbstractSyntaxWithTransferSyntax(SopClass.StorageCommitmentPushModelSopClass,
TransferSyntax.ExplicitVrLittleEndian);
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(SopClass.StorageCommitmentPushModelSopClass,
TransferSyntax.ImplicitVrLittleEndian);
if (pcid == 0)
{
client.SendAssociateAbort(DicomAbortSource.ServiceUser, DicomAbortReason.NotSpecified);
return;
}
DicomMessage msg = new DicomMessage();
msg.RequestedSopInstanceUid = "1.2.840.10008.1.20.1.1";
msg.ActionTypeId = 1;
msg.DataSet[DicomTags.TransactionUid].SetStringValue(DicomUid.GenerateUid().UID);
foreach (StorageInstance instance in StorageInstanceList)
{
DicomSequenceItem item = new DicomSequenceItem();
msg.DataSet[DicomTags.ReferencedSopSequence].AddSequenceItem(item);
item[DicomTags.ReferencedSopClassUid].SetStringValue(instance.SopClass.Uid);
item[DicomTags.ReferencedSopInstanceUid].SetStringValue(instance.SopInstanceUid);
}
}
示例2: SelectUncompressedPresentationContext
private byte SelectUncompressedPresentationContext(ClientAssociationParameters association, DicomMessage msg)
{
byte pcid = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass,
TransferSyntax.ExplicitVrLittleEndian);
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass,
TransferSyntax.ImplicitVrLittleEndian);
return pcid;
}
示例3: SelectPresentationContext
private byte SelectPresentationContext(ClientAssociationParameters association, StorageInstance fileToSend, DicomFile dicomFile, out DicomMessage msg)
{
byte pcid = 0;
if (PresentationContextSelectionDelegate != null)
{
// Note, this may do a conversion of the file according to codecs, need to catch a codec exception if it occurs
pcid = PresentationContextSelectionDelegate(association, dicomFile, out msg);
}
else
{
msg = new DicomMessage(dicomFile);
if (fileToSend.TransferSyntax.Encapsulated)
{
pcid = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass,
msg.TransferSyntax);
if (DicomCodecRegistry.GetCodec(fileToSend.TransferSyntax) != null)
{
// We can compress/decompress the file. Check if remote device accepts it
if (pcid == 0)
pcid = SelectUncompressedPresentationContext(association, msg);
}
}
else
{
if (pcid == 0)
pcid = SelectUncompressedPresentationContext(association, msg);
}
}
return pcid;
}
示例4: SendCStore
/// <summary>
/// Generic routine to send the next C-STORE-RQ message in the <see cref="StorageInstanceList"/>.
/// </summary>
/// <param name="client">DICOM Client class</param>
/// <param name="association">Association Parameters</param>
private bool SendCStore(DicomClient client, ClientAssociationParameters association)
{
StorageInstance fileToSend = _storageInstanceList[_fileListIndex];
OnImageStoreStarted(fileToSend);
DicomFile dicomFile;
try
{
// Check to see if image does not exist or is corrupted
if (fileToSend.SendStatus == DicomStatuses.ProcessingFailure)
{
_failureSubOperations++;
_remainingSubOperations--;
OnImageStoreCompleted(fileToSend);
return false;
}
dicomFile = fileToSend.LoadFile();
}
catch (DicomException e)
{
Platform.Log(LogLevel.Error, e, "Unexpected exception when loading DICOM file {0}", fileToSend.Filename);
fileToSend.ExtendedFailureDescription = e.GetType().Name + " " + e.Message;
_failureSubOperations++;
_remainingSubOperations--;
OnImageStoreCompleted(fileToSend);
return false;
}
DicomMessage msg = new DicomMessage(dicomFile);
byte pcid = 0;
if (fileToSend.TransferSyntax.Encapsulated)
{
pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.SopClass, fileToSend.TransferSyntax);
if (DicomCodecRegistry.GetCodec(fileToSend.TransferSyntax) != null)
{
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.SopClass,
TransferSyntax.ExplicitVrLittleEndian);
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.SopClass,
TransferSyntax.ImplicitVrLittleEndian);
}
}
else
{
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.SopClass,
TransferSyntax.ExplicitVrLittleEndian);
if (pcid == 0)
pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.SopClass,
TransferSyntax.ImplicitVrLittleEndian);
}
if (pcid == 0)
{
fileToSend.SendStatus = DicomStatuses.SOPClassNotSupported;
fileToSend.ExtendedFailureDescription = "No valid presentation contexts for file.";
OnImageStoreCompleted(fileToSend);
_failureSubOperations++;
_remainingSubOperations--;
return false;
}
try
{
if (_moveOriginatorAe == null)
client.SendCStoreRequest(pcid, client.NextMessageID(), DicomPriority.Medium, msg);
else
client.SendCStoreRequest(pcid, client.NextMessageID(), DicomPriority.Medium, _moveOriginatorAe,
_moveOriginatorMessageId, msg);
}
catch(DicomNetworkException)
{
throw; //This is a DicomException-derived class that we want to throw.
}
catch(DicomCodecException e)
{
Platform.Log(LogLevel.Error, e, "Unexpected exception when compressing or decompressing file before send {0}", fileToSend.Filename);
fileToSend.SendStatus = DicomStatuses.ProcessingFailure;
fileToSend.ExtendedFailureDescription = "Error decompressing or compressing file before send.";
OnImageStoreCompleted(fileToSend);
_failureSubOperations++;
_remainingSubOperations--;
return false;
}
catch(DicomException e)
//.........这里部分代码省略.........