本文整理汇总了C#中ClearCanvas.Dicom.Network.ServerAssociationParameters类的典型用法代码示例。如果您正苦于以下问题:C# ServerAssociationParameters类的具体用法?C# ServerAssociationParameters怎么用?C# ServerAssociationParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerAssociationParameters类属于ClearCanvas.Dicom.Network命名空间,在下文中一共展示了ServerAssociationParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReceiveRequestMessage
public void OnReceiveRequestMessage(DicomServer server, ServerAssociationParameters association, byte presentationID, ClearCanvas.Dicom.DicomMessage message)
{
foreach (byte pcid in association.GetPresentationContextIDs())
{
DicomPresContext context = association.GetPresentationContext(pcid);
if (context.Result == DicomPresContextResult.Accept)
{
if (context.AbstractSyntax == SopClass.StudyRootQueryRetrieveInformationModelFind)
{
DicomMessage response = new DicomMessage();
response.DataSet[DicomTags.StudyInstanceUid].SetStringValue("1.2.3");
response.DataSet[DicomTags.PatientId].SetStringValue("1");
response.DataSet[DicomTags.PatientsName].SetStringValue("test");
response.DataSet[DicomTags.StudyId].SetStringValue("1");
response.DataSet[DicomTags.StudyDescription].SetStringValue("dummy");
server.SendCFindResponse(presentationID, message.MessageId, response, DicomStatuses.Pending);
DicomMessage finalResponse = new DicomMessage();
server.SendCFindResponse(presentationID, message.MessageId, finalResponse, DicomStatuses.Success);
}
else if (context.AbstractSyntax == SopClass.VerificationSopClass)
{
server.SendCEchoResponse(presentationID, message.MessageId, DicomStatuses.Success);
}
}
}
}
示例2: ReceiveMessageAsFileStream
public override bool ReceiveMessageAsFileStream(Dicom.Network.DicomServer server, ServerAssociationParameters association, byte presentationId,
DicomMessage message)
{
var sopClassUid = message.AffectedSopClassUid;
if (sopClassUid.Equals(SopClass.BreastTomosynthesisImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedCtImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedMrColorImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedMrImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedPetImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedUsVolumeStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedXaImageStorageUid)
|| sopClassUid.Equals(SopClass.EnhancedXrfImageStorageUid)
|| sopClassUid.Equals(SopClass.UltrasoundMultiFrameImageStorageUid)
|| sopClassUid.Equals(SopClass.MultiFrameGrayscaleByteSecondaryCaptureImageStorageUid)
|| sopClassUid.Equals(SopClass.MultiFrameGrayscaleWordSecondaryCaptureImageStorageUid)
|| sopClassUid.Equals(SopClass.MultiFrameSingleBitSecondaryCaptureImageStorageUid)
|| sopClassUid.Equals(SopClass.MultiFrameTrueColorSecondaryCaptureImageStorageUid))
{
server.DimseDatasetStopTag = DicomTagDictionary.GetDicomTag(DicomTags.ReconstructionIndex); // Random tag at the end of group 20
server.StreamMessage = true;
return true;
}
return false;
}
示例3: AddPresentationContexts
private static void AddPresentationContexts(ServerAssociationParameters assoc)
{
byte pcid = assoc.AddPresentationContext(SopClass.ModalityWorklistInformationModelFind);
assoc.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
assoc.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);
}
示例4: OnReceiveAssociateRequest
public void OnReceiveAssociateRequest(DicomServer server, ServerAssociationParameters association)
{
if (_delayAssociationAccept.Checked)
Thread.Sleep(TimeSpan.FromSeconds(35));
if (_rejectAssociation.Checked)
server.SendAssociateReject(DicomRejectResult.Permanent, DicomRejectSource.ServiceUser, DicomRejectReason.CallingAENotRecognized);
else
server.SendAssociateAccept(association);
}
示例5: OnStartFilestream
public override IDicomFilestreamHandler OnStartFilestream(Dicom.Network.DicomServer server, ServerAssociationParameters association,
byte presentationId, DicomMessage message)
{
if (_importContext == null)
{
LoadImportContext(association);
}
return new StorageFilestreamHandler(Context, _importContext);
}
示例6: AddPresentationContexts
private static void AddPresentationContexts(ServerAssociationParameters assoc)
{
byte pcid = assoc.AddPresentationContext(SopClass.VerificationSopClass);
assoc.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
assoc.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);
pcid = assoc.AddPresentationContext(SopClass.ModalityPerformedProcedureStepSopClass);
assoc.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
assoc.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);
}
示例7: StorageFilestreamHandler
public StorageFilestreamHandler(DicomScpContext context, Device remoteDevice, ServerAssociationParameters assoc)
{
_context = context;
_remoteDevice = remoteDevice;
_importContext = new SopInstanceImporterContext(
String.Format("{0}_{1}", assoc.CallingAE, assoc.TimeStamp.ToString("yyyyMMddhhmmss")),
assoc.CallingAE, assoc.CalledAE);
if (_remoteDevice != null && _remoteDevice.DeviceTypeEnum.Equals(DeviceTypeEnum.PrimaryPacs))
{
_importContext.DuplicateProcessing = DuplicateProcessingEnum.OverwriteSopAndUpdateDatabase;
}
}
示例8: SetImageTransferSyntaxes
private static void SetImageTransferSyntaxes(byte pcid, ServerAssociationParameters assoc)
{
if (JpegLossless)
assoc.AddTransferSyntax(pcid,TransferSyntax.JpegLosslessNonHierarchicalFirstOrderPredictionProcess14SelectionValue1);
if (Rle)
assoc.AddTransferSyntax(pcid, TransferSyntax.RleLossless);
if (J2KLossy)
assoc.AddTransferSyntax(pcid, TransferSyntax.Jpeg2000ImageCompression);
if (J2KLossless)
assoc.AddTransferSyntax(pcid, TransferSyntax.Jpeg2000ImageCompressionLosslessOnly);
if (JpegLossy)
{
assoc.AddTransferSyntax(pcid, TransferSyntax.JpegBaselineProcess1);
assoc.AddTransferSyntax(pcid, TransferSyntax.JpegExtendedProcess24);
}
assoc.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
assoc.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);
}
示例9: Listen
public static bool Listen(ServerAssociationParameters parameters, StartAssociation acceptor)
{
lock (_syncLock)
{
Listener theListener;
if (_listeners.TryGetValue(parameters.LocalEndPoint, out theListener))
{
ListenerInfo info = new ListenerInfo();
info.StartDelegate = acceptor;
info.Parameters = parameters;
if (theListener._applications.ContainsKey(parameters.CalledAE))
{
Platform.Log(LogLevel.Error, "Already listening with AE {0} on {1}", parameters.CalledAE,
parameters.LocalEndPoint.ToString());
return false;
}
theListener._applications.Add(parameters.CalledAE, info);
Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on existing port {1}", parameters.CalledAE,
parameters.LocalEndPoint.ToString());
}
else
{
theListener = new Listener(parameters, acceptor);
if (!theListener.StartListening())
{
Platform.Log(LogLevel.Error, "Unexpected error starting to listen on {0}", parameters.LocalEndPoint.ToString());
return false;
}
_listeners[parameters.LocalEndPoint] = theListener;
theListener.StartThread();
Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on port {1}", parameters.CalledAE,
parameters.LocalEndPoint.ToString());
}
return true;
}
}
示例10: StartListening
public static void StartListening(string aeTitle, int port)
{
if (_started)
return;
_staticAssocParameters = new ServerAssociationParameters(aeTitle, new IPEndPoint(IPAddress.Any, port));
Platform.Log(LogLevel.Info, "MPPS Server Started");
AddPresentationContexts(_staticAssocParameters);
DicomServer.StartListening(_staticAssocParameters,
delegate(DicomServer server, ServerAssociationParameters assoc)
{
return new MPPSScp(assoc);
});
_started = true;
}
示例11: ScuAbortTest
public void ScuAbortTest()
{
int port = 2112;
/* Setup the Server */
ServerAssociationParameters serverParameters = new ServerAssociationParameters("AssocTestServer", new IPEndPoint(IPAddress.Any, port));
byte pcid = serverParameters.AddPresentationContext(SopClass.MrImageStorage);
serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrBigEndian);
serverParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);
_serverType = TestTypes.Receive;
DicomServer.StartListening(serverParameters, ServerHandlerCreator);
StorageScu scu = SetupScu();
IList<DicomAttributeCollection> list = SetupMRSeries(4, 2, DicomUid.GenerateUid().UID);
foreach (DicomAttributeCollection collection in list)
{
DicomFile file = new DicomFile("test",new DicomAttributeCollection(),collection );
file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;
file.MediaStorageSopClassUid = SopClass.MrImageStorage.Uid;
file.MediaStorageSopInstanceUid = collection[DicomTags.SopInstanceUid].ToString();
scu.AddStorageInstance(new StorageInstance(file));
}
scu.ImageStoreCompleted += delegate(object o, StorageInstance instance)
{
// Test abort
scu.Abort();
};
scu.Send();
scu.Join();
Assert.AreEqual(scu.Status, ScuOperationStatus.NetworkError);
// StopListening
DicomServer.StopListening(serverParameters);
}
示例12: Verify
/// <summary>
/// Do the actual verification if an association is acceptable.
/// </summary>
/// <remarks>
/// This method primarily checks the remote AE title to see if it is a valid device that can
/// connect to the partition.
/// </remarks>
/// <param name="context">Generic parameter passed in, is a DicomScpParameters instance.</param>
/// <param name="assocParms">The association parameters.</param>
/// <param name="result">Output parameter with the DicomRejectResult for rejecting the association.</param>
/// <param name="reason">Output parameter with the DicomRejectReason for rejecting the association.</param>
/// <returns>true if the association should be accepted, false if it should be rejected.</returns>
public static bool Verify(DicomScpContext context, ServerAssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason)
{
bool isNew;
Device device = DeviceManager.LookupDevice(context.Partition, assocParms, out isNew);
if (device==null)
{
if (context.Partition.AcceptAnyDevice)
{
reason = DicomRejectReason.NoReasonGiven;
result = DicomRejectResult.Permanent;
return true;
}
reason = DicomRejectReason.CallingAENotRecognized;
result = DicomRejectResult.Permanent;
return false;
}
if (device.Enabled==false)
{
Platform.Log(LogLevel.Error,
"Rejecting association from {0} to {1}. Device is disabled.",
assocParms.CallingAE, assocParms.CalledAE);
reason = DicomRejectReason.CallingAENotRecognized;
result = DicomRejectResult.Permanent;
return false;
}
reason = DicomRejectReason.NoReasonGiven;
result = DicomRejectResult.Permanent;
return true;
}
示例13: StartListening
public static void StartListening(string aeTitle, int port, int bufferedQueryResponses,int maxQueryResponses)
{
_bufferedQueryResponses = bufferedQueryResponses;
_maxQueryResponses = maxQueryResponses;
if (_started)
return;
_staticAssocParameters = new ServerAssociationParameters(aeTitle, new IPEndPoint(IPAddress.Any, port));
Platform.Log(LogLevel.Info, "MWL Server Started");
AddPresentationContexts(_staticAssocParameters);
DicomServer.StartListening(_staticAssocParameters,
delegate(DicomServer server, ServerAssociationParameters assoc)
{
return new MWLScp(assoc);
});
_started = true;
}
示例14: Start
/// <summary>
/// Starts the service.
/// </summary>
/// <returns>True/False depending if service started successfully.</returns>
public bool Start()
{
try
{
if (isRunning)
return true;
_staticAssocParameters = new ServerAssociationParameters(_aet, new IPEndPoint(IPAddress.Any, _port));
AddPresentationContexts(_staticAssocParameters);
if (DicomServer.StartListening(_staticAssocParameters,
delegate (DicomServer server, ServerAssociationParameters assoc)
{
return new DicomSCP(assoc)
{
Aet = _aet,
Port = _port
};
}))
{
isRunning = true;
}
}
catch (Exception ex)
{
throw ex;
}
return isRunning;
}
示例15: InstancesTransferredAuditLogger
public static void InstancesTransferredAuditLogger(DicomScpContext context, ServerAssociationParameters assocParams, List<StorageInstance> instances)
{
Dictionary<string, AuditPatientParticipantObject> list = new Dictionary<string, AuditPatientParticipantObject>();
foreach (StorageInstance instance in instances)
{
string key = instance.PatientId + instance.PatientsName;
if (!list.ContainsKey(key))
{
AuditPatientParticipantObject patient =
new AuditPatientParticipantObject(instance.PatientsName, instance.PatientId);
list.Add(key, patient);
}
}
foreach (AuditPatientParticipantObject patient in list.Values)
{
// Audit Log
DicomInstancesTransferredAuditHelper helper =
new DicomInstancesTransferredAuditHelper(ServerPlatform.AuditSource,
EventIdentificationContentsEventOutcomeIndicator.Success,
EventIdentificationContentsEventActionCode.E,
assocParams);
foreach (StorageInstance instance in instances)
{
if (patient.PatientId.Equals(instance.PatientId)
&& patient.PatientsName.Equals(instance.PatientsName))
{
helper.AddStorageInstance(instance);
}
}
ServerAuditHelper.LogAuditMessage(helper);
}
}