本文整理汇总了C#中DicomClient类的典型用法代码示例。如果您正苦于以下问题:C# DicomClient类的具体用法?C# DicomClient怎么用?C# DicomClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DicomClient类属于命名空间,在下文中一共展示了DicomClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddFindRequest_NullDicomRequest_ThrowsException
public void AddFindRequest_NullDicomRequest_ThrowsException()
{
// Arrange
var mockProvider = new MockProvider();
var dicomClient = new DicomClient<TestInfo>(mockProvider.GetSettingsProviderFake(), mockProvider.GetRequestAdapterFake());
// Act + Assert
Assert.That(() => dicomClient.AddFindRequest(null), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:tomastauer,项目名称:Tauco.Dicom,代码行数:9,代码来源:DicomClientTests.cs
示例2: AddMoveRequest_RequestAdapterIsCalled
public void AddMoveRequest_RequestAdapterIsCalled()
{
// Arrange
var mockProvider = new MockProvider();
var requestAdapter = mockProvider.GetRequestAdapterFake();
var dicomClient = new DicomClient<TestInfo>(mockProvider.GetSettingsProviderFake(), requestAdapter);
var dicomMoveRequest = Substitute.For<IDicomMoveRequest>();
// Act
dicomClient.AddMoveRequest(dicomMoveRequest);
// Assert
Assert.That(() => requestAdapter.Received(1).CreateMoveDicomRequest(dicomMoveRequest), Throws.Nothing);
}
开发者ID:tomastauer,项目名称:Tauco.Dicom,代码行数:14,代码来源:DicomClientTests.cs
示例3: AddFindRequest_RequestAdapterIsCalled
public void AddFindRequest_RequestAdapterIsCalled()
{
// Arrange
var mockProvider = new MockProvider();
var fellowOakMockProvider = new FellowOakMockProvider();
var requestAdapter = mockProvider.GetRequestAdapterFake();
var dicomClient = new DicomClient<TestInfo>(mockProvider.GetSettingsProviderFake(), requestAdapter);
var dicomFindRequest = new FellowOakDicomFindRequest<TestInfo>(mockProvider.GetDicomMappingFake(),fellowOakMockProvider.GetDicomTagAdapterFake(), mockProvider.GetDicomInfoBuilderFake(), mockProvider.GetGeneralizedInfoProviderFake(), fellowOakMockProvider.GetDicomSopClassUidProviderFake(), c=> {},mockProvider.GetDicomWhereCollectionFake());
// Act
dicomClient.AddFindRequest(dicomFindRequest);
// Assert
Assert.That(() => requestAdapter.Received(1).CreateFindDicomRequest(dicomFindRequest), Throws.Nothing);
}
开发者ID:tomastauer,项目名称:Tauco.Dicom,代码行数:15,代码来源:DicomClientTests.cs
示例4: OnReceiveRequestMessage
public override void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
try
{
// We only handle NEventReport request messages
if (message.CommandField != DicomCommandField.NEventReportRequest ||
message.AffectedSopClassUid != SopClass.PrinterSopClassUid)
{
base.OnReceiveRequestMessage(client, association, presentationID, message);
return;
}
var printerStatus = IodBase.ParseEnum(message.EventTypeId.ToString(), PrinterStatus.None);
var printerModule = new PrinterModuleIod(message.DataSet);
var logMessage = string.Format("Received NEventReportRequest, Printer Status: {0}, Status Info = {1}", printerStatus,
printerModule.PrinterStatusInfo);
//Always respond.
Client.SendNEventReportResponse(GetPresentationContextId(this.AssociationParameters),
message, new DicomMessage(), DicomStatuses.Success);
switch (printerStatus)
{
case PrinterStatus.Failure:
Platform.Log(LogLevel.Error, logMessage);
this.FailureDescription = SR.MessagePrinterError;
this.ReleaseConnection(client);
return;
case PrinterStatus.Warning:
Platform.Log(LogLevel.Warn, logMessage);
break;
case PrinterStatus.None:
case PrinterStatus.Normal:
default:
Platform.Log(LogLevel.Debug, logMessage);
break;
}
}
catch (Exception ex)
{
this.FailureDescription = ex.Message;
Platform.Log(LogLevel.Error, ex.ToString());
ReleaseConnection(client);
throw;
}
}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:47,代码来源:PrintScu.cs
示例5: OnReceiveResponseMessage
/// <summary>
/// Called when received response message. Sets the <see cref="Result"/> property as appropriate.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
/// <param name="presentationID">The presentation ID.</param>
/// <param name="message">The message.</param>
public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
if (message.Status.Status != DicomState.Success)
{
Platform.Log(LogLevel.Error, "Failure status received in sending verification: {0}", message.Status.Description);
_verificationResult = VerificationResult.Failed;
}
else if (_verificationResult == VerificationResult.Canceled)
{
Platform.Log(LogLevel.Info, "Verification was canceled");
}
else
{
Platform.Log(LogLevel.Info, "Success status received in sending verification!");
_verificationResult = VerificationResult.Success;
}
client.SendReleaseRequest();
StopRunningOperation();
}
开发者ID:khaha2210,项目名称:radio,代码行数:26,代码来源:VerificationScu.cs
示例6: SendVerificationRequest
/// <summary>
/// Generic routine to send the next C-ECHO-RQ message.
/// </summary>
/// <param name="client">DICOM Client class</param>
/// <param name="association">Association Parameters</param>
private void SendVerificationRequest(DicomClient client, ClientAssociationParameters association)
{
byte pcid = association.FindAbstractSyntax(SopClass.VerificationSopClass);
client.SendCEchoRequest(pcid, client.NextMessageID());
}
开发者ID:khaha2210,项目名称:radio,代码行数:11,代码来源:VerificationScu.cs
示例7: OnReceiveResponseMessage
/// <summary>
/// Called when received response message. If there are more files to send, will send them here.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
/// <param name="presentationID">The presentation ID.</param>
/// <param name="message">The message.</param>
public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
if (Status == ScuOperationStatus.Canceled)
{
Platform.Log(LogLevel.Info, "Cancel request received, releasing association from {0} to {1}", association.CallingAE, association.CalledAE);
client.SendReleaseRequest();
StopRunningOperation();
return;
}
}
开发者ID:khaha2210,项目名称:radio,代码行数:17,代码来源:StorageCommitScu.cs
示例8: OnReceiveResponseMessage
/// <summary>
/// Called when received response message.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
/// <param name="presentationID">The presentation ID.</param>
/// <param name="message">The message.</param>
public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
base.ResultStatus = message.Status.Status;
if (message.Status.Status == DicomState.Success)
{
this._results = message.DataSet;
}
base.ReleaseConnection(client);
}
开发者ID:nhannd,项目名称:Xian,代码行数:16,代码来源:PrinterStatusScu.cs
示例9: OnDimseTimeout
/// <summary>
/// Called when a timeout occurs waiting for the next message, as specified by <see cref="AssociationParameters.ReadTimeout"/>.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
public override void OnDimseTimeout(DicomClient client, ClientAssociationParameters association)
{
Status = ScuOperationStatus.TimeoutExpired;
FailureDescription =
String.Format("Timeout Expired ({0} seconds) for remote host {1} when processing C-MOVE-RQ, aborting connection", association.ReadTimeout/1000,
RemoteAE);
Platform.Log(LogLevel.Error, FailureDescription);
try
{
client.SendAssociateAbort(DicomAbortSource.ServiceUser, DicomAbortReason.NotSpecified);
}
catch (Exception ex)
{
Platform.Log(LogLevel.Error, ex, "Error aborting association");
}
Platform.Log(LogLevel.Warn, "Completed aborting connection (after DIMSE timeout) from {0} to {1}",
association.CallingAE, association.CalledAE);
ProgressEvent.Set();
}
开发者ID:scottshea,项目名称:monodicom,代码行数:26,代码来源:MoveScu.cs
示例10: SendDeleteFilmSessionRequest
private void SendDeleteFilmSessionRequest(DicomClient client, ClientAssociationParameters association)
{
DicomMessage newRequestMessage = new DicomMessage(null, null);
newRequestMessage.RequestedSopInstanceUid = _filmSessionUid;
newRequestMessage.RequestedSopClassUid = SopClass.BasicFilmSessionSopClassUid;
_nextRequestType = RequestType.Close;
byte pcid = association.FindAbstractSyntaxOrThrowException(SopClass.BasicGrayscalePrintManagementMetaSopClass);
client.SendNDeleteRequest(pcid, client.NextMessageID(), newRequestMessage);
}
开发者ID:khaha2210,项目名称:radio,代码行数:10,代码来源:BasicGrayscalePrintScu.cs
示例11: SendDeleteFilmBoxRequest
private void SendDeleteFilmBoxRequest(DicomClient client, ClientAssociationParameters association, DicomMessage responseMessage)
{
if (_filmBoxUids.Count == 0)
{
// no more film boxes left to delete - so send delete film session
SendDeleteFilmSessionRequest(client, association);
}
else
{
string currentFilmBoxUid = _filmBoxUids[0];
_filmBoxUids.Remove(currentFilmBoxUid);
DicomMessage newRequestMessage = new DicomMessage(null, null);
newRequestMessage.RequestedSopInstanceUid = currentFilmBoxUid;
newRequestMessage.RequestedSopClassUid = SopClass.BasicFilmBoxSopClassUid;
newRequestMessage.Priority = DicomPriority.Medium;
_nextRequestType = RequestType.DeleteFilmBox;
byte pcid = association.FindAbstractSyntaxOrThrowException(SopClass.BasicGrayscalePrintManagementMetaSopClass);
client.SendNDeleteRequest(pcid, client.NextMessageID(), newRequestMessage);
}
}
开发者ID:khaha2210,项目名称:radio,代码行数:23,代码来源:BasicGrayscalePrintScu.cs
示例12: SendSetImageBoxRequest
private void SendSetImageBoxRequest(DicomClient client, ClientAssociationParameters association)
{
if (_currentImageBoxIndex >= _imageBoxPixelModuleIods.Count)
{
// done sending images box - send print request
_nextRequestType = RequestType.PrintAction;
SendActionPrintRequest(client, association);
}
else
{
// want to get first film box response - although not sure if CC is using .net 3.5.. prolly not so do it old way
IEnumerator<DicomAttributeCollection> filmBoxResponseEnumerator = _filmBoxResponseMessages.Values.GetEnumerator();
filmBoxResponseEnumerator.Reset();
filmBoxResponseEnumerator.MoveNext();
BasicFilmBoxModuleIod basicFilmBoxModuleIod = new BasicFilmBoxModuleIod(filmBoxResponseEnumerator.Current);
if (_currentImageBoxIndex > basicFilmBoxModuleIod.ReferencedImageBoxSequenceList.Count)
{
throw new DicomException("Current Image Box Index is greater than number of Referenced ImageBox Sequences - set image box data");
}
ImageBoxPixelModuleIod imageBoxPixelModuleIod = _imageBoxPixelModuleIods[_currentImageBoxIndex];
DicomMessage newRequestMessage = new DicomMessage(null, (DicomAttributeCollection)imageBoxPixelModuleIod.DicomAttributeProvider);
newRequestMessage.RequestedSopClassUid = SopClass.BasicGrayscaleImageBoxSopClassUid;
newRequestMessage.RequestedSopInstanceUid = basicFilmBoxModuleIod.ReferencedImageBoxSequenceList[_currentImageBoxIndex].ReferencedSopInstanceUid;
byte pcid = association.FindAbstractSyntax(SopClass.BasicGrayscalePrintManagementMetaSopClass);
_currentImageBoxIndex++;
client.SendNSetRequest(pcid, client.NextMessageID(), newRequestMessage);
}
}
开发者ID:khaha2210,项目名称:radio,代码行数:35,代码来源:BasicGrayscalePrintScu.cs
示例13: SendCreateFilmBoxRequest
private void SendCreateFilmBoxRequest(DicomClient client, ClientAssociationParameters association, DicomMessage responseMessage)
{
ReferencedInstanceSequenceIod referencedFilmSessionSequence = new ReferencedInstanceSequenceIod();
referencedFilmSessionSequence.ReferencedSopClassUid = SopClass.BasicFilmSessionSopClassUid;
referencedFilmSessionSequence.ReferencedSopInstanceUid = responseMessage.AffectedSopInstanceUid;
_basicFilmBoxModuleIod.ReferencedFilmSessionSequenceList.Add(referencedFilmSessionSequence);
DicomMessage newRequestMessage = new DicomMessage(null, (DicomAttributeCollection)_basicFilmBoxModuleIod.DicomAttributeProvider);
byte pcid = association.FindAbstractSyntaxOrThrowException(SopClass.BasicGrayscalePrintManagementMetaSopClass);
_nextRequestType = RequestType.ImageBox;
client.SendNCreateRequest(DicomUid.GenerateUid(), pcid, client.NextMessageID(), newRequestMessage, DicomUids.BasicFilmBoxSOP);
}
开发者ID:khaha2210,项目名称:radio,代码行数:15,代码来源:BasicGrayscalePrintScu.cs
示例14: SendCreateFilmSessionRequest
private void SendCreateFilmSessionRequest(DicomClient client, ClientAssociationParameters association)
{
DicomMessage newRequestMessage = new DicomMessage(null, (DicomAttributeCollection)_basicFilmSessionModuleIod.DicomAttributeProvider);
byte pcid = association.FindAbstractSyntaxOrThrowException(SopClass.BasicGrayscalePrintManagementMetaSopClass);
_nextRequestType = RequestType.FilmBox;
client.SendNCreateRequest(DicomUid.GenerateUid(), pcid, client.NextMessageID(), newRequestMessage, DicomUids.BasicFilmSession);
}
开发者ID:khaha2210,项目名称:radio,代码行数:8,代码来源:BasicGrayscalePrintScu.cs
示例15: 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)
//.........这里部分代码省略.........
开发者ID:khaha2210,项目名称:radio,代码行数:101,代码来源:StorageScu.cs
示例16: OnReceiveAssociateAccept
/// <summary>
/// Called when received associate accept.
/// </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);
SendMoveRequest(client, association);
}
开发者ID:scottshea,项目名称:monodicom,代码行数:11,代码来源:MoveScu.cs
示例17: OnReceiveResponseMessage
/// <summary>
/// Called when received response message.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
/// <param name="presentationID">The presentation ID.</param>
/// <param name="message">The message.</param>
public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
// Discovered issue with an SCP that was not setting these values on the final Success return, so blocking an update of the values if all of them are 0.
if (message.NumberOfFailedSubOperations != 0
|| message.NumberOfCompletedSubOperations != 0
|| message.NumberOfRemainingSubOperations != 0
|| message.NumberOfWarningSubOperations != 0)
{
_failureSubOperations = message.NumberOfFailedSubOperations;
_successSubOperations = message.NumberOfCompletedSubOperations;
_remainingSubOperations = message.NumberOfRemainingSubOperations;
_warningSubOperations = message.NumberOfWarningSubOperations;
_totalSubOperations = _failureSubOperations + _successSubOperations + _remainingSubOperations +
_warningSubOperations;
}
if (message.Status.Status == DicomState.Pending)
{
OnImageMoveCompleted();
}
else
{
DicomState status = message.Status.Status;
if (message.Status.Status != DicomState.Success)
{
if (status == DicomState.Cancel)
{
if (LogInformation) Platform.Log(LogLevel.Info, "Cancel status received in Move Scu: {0}", message.Status);
Status = ScuOperationStatus.Canceled;
}
else if (status == DicomState.Failure)
{
string msg = String.Format("Failure status received in Move Scu: {0}", message.Status);
Platform.Log(LogLevel.Error, msg);
Status = ScuOperationStatus.Failed;
FailureDescription = msg;
}
else if (status == DicomState.Warning)
{
Platform.Log(LogLevel.Warn, "Warning status received in Move Scu: {0}", message.Status);
}
else if (Status == ScuOperationStatus.Canceled)
{
if (LogInformation) Platform.Log(LogLevel.Info, "Client cancelled Move Scu operation.");
}
}
else
{
if (LogInformation) Platform.Log(LogLevel.Info, "Success status received in Move Scu!");
}
client.SendReleaseRequest();
StopRunningOperation();
}
}
开发者ID:scottshea,项目名称:monodicom,代码行数:62,代码来源:MoveScu.cs
示例18: OnReceiveResponseMessage
/// <summary>
/// Called when received response message.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
/// <param name="presentationID">The presentation ID.</param>
/// <param name="message">The message.</param>
public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
{
try
{
base.ResultStatus = message.Status.Status;
if (message.Status.Status == DicomState.Success)
{
if (message.CommandField == DicomCommandField.NCreateResponse && message.AffectedSopClassUid == SopClass.BasicFilmSessionSopClassUid)
{
_filmSessionUid = message.AffectedSopInstanceUid;
}
else if (message.CommandField == DicomCommandField.NCreateResponse && message.AffectedSopClassUid == SopClass.BasicFilmBoxSopClassUid)
{
_filmBoxUids.Add(message.AffectedSopInstanceUid);
_filmBoxResponseMessages.Add(message.AffectedSopInstanceUid, message.DataSet);
}
Platform.Log(LogLevel.Info, "Success status received in Printer Status Scu!");
_results = message.DataSet;
switch (_nextRequestType)
{
case RequestType.FilmBox:
SendCreateFilmBoxRequest(client, association, message);
break;
case RequestType.ImageBox:
SendSetImageBoxRequest(client, association);
break;
case RequestType.PrintAction:
SendActionPrintRequest(client, association);
break;
case RequestType.DeleteFilmBox:
SendDeleteFilmBoxRequest(client, association, message);
break;
case RequestType.DeleteFilmSession:
SendDeleteFilmSessionRequest(client, association);
break;
case RequestType.Close:
base.ReleaseConnection(client);
break;
case RequestType.None:
default:
// TODO: throw error....
break;
}
}
else
{
// TODO: Handle this... check for warnings - they are OK? throw exception on errors... ?
}
}
catch (Exception ex)
{
Platform.Log(LogLevel.Error, ex.ToString());
base.ReleaseConnection(client);
throw;
}
}
开发者ID:khaha2210,项目名称:radio,代码行数:72,代码来源:BasicGrayscalePrintScu.cs
示例19: SendRequest
/// <summary>
/// Sends the find request.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="association">The association.</param>
private static void SendRequest(DicomClient client, ClientAssociationParameters association)
{
DicomMessage newRequestMessage = new DicomMessage();
PrinterModuleIod.SetCommonTags(newRequestMessage.DataSet);
byte pcid = association.FindAbstractSyntax(SopClass.PrinterSopClass);
if (pcid > 0)
{
client.SendNGetRequest(DicomUids.PrinterSOPInstance, pcid, client.NextMessageID(), newRequestMessage);
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:15,代码来源:PrinterStatusScu.cs
示例20: SendCStoreUntilSuccess
/// <summary>
/// Generic routine to continue attempting to send C-STORE-RQ messages in the <see cref="StorageInstanceList"/> until one is successful.
/// </summary>
/// <remarks>
/// <para>
/// This routine will continue attempting to send a C-STORE until one has successfully been sent or all
/// SOP instances in the <see cref="StorageInstanceList"/> have been sent. Possible failures are that
/// a SOP Class was not negotiated, or a failure happened reading the SOP Instance from disk.
/// </para>
/// </remarks>
/// <param name="client">DICOM Client class</param>
/// <param name="association">Association Parameters</param>
private void SendCStoreUntilSuccess(DicomClient client, ClientAssociationParameters association)
{
/// TODO (CR Jun 2012): Probably shouldn't use thread pool threads for potentially long-running operations.
/// Although unlikely, this could exhaust the .NET thread pool.
// Added the background thread as part of ticket #9568. Note that we probably should have some threading
// built into NetworkBase as opposed to here.
ThreadPool.QueueUserWorkItem(delegate
{
try
{
bool ok = SendCStore(client, association);
while (ok == false)
{
Platform.Log(LogLevel.Info, "Attempted to send {0} of {1} instances to {2}.", _fileListIndex + 1, _storageInstanceList.Count, client.AssociationParams.CalledAE);
_fileListIndex++;
if (_fileListIndex >= _storageInstanceList.Count)
{
Platform.Log(LogLevel.Info,
"Completed sending C-STORE-RQ messages, releasing association.");
client.SendReleaseRequest();
StopRunningOperation();
return;
}
/// TODO (CR Jun 2012): Do we need to check for a stop signal?
// TODO (Marmot): Check stop?
// TODO (CR Jun 2012): Stop is checked for in OnReceiveResponseMessage after each c-store-rsp received.
// There's a small chance that every image we're attempting to send wasn't negotiated over the association and it
// takes awhile to go through the list, but the chances of that are small, plus it should be quick.
ok = SendCStore(client, association);
}
}
catch
{
Platform.Log(LogLevel.Error, "Error when sending C-STORE-RQ messages, aborted on-going send operations");
try
{
client.SendAssociateAbort(DicomAbortSource.ServiceProvider, DicomAbortReason.NotSpecified);
StopRunningOperation();
}
catch
{
Platform.Log(LogLevel.Error, "Error attempting to abort association");
}
}
}, null);
}
开发者ID:emmandeb,项目名称:ClearCanvas-1,代码行数:60,代码来源:StorageScu.cs
注:本文中的DicomClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论