private QueryRetrieveScu GetScu(AeInfo server) { QueryRetrieveScu scu = null; bool useSecurePort = (server.Port == 0) && (server.SecurePort != 0); int port = useSecurePort ? server.SecurePort : server.Port; if (useSecurePort) { GatewaySession.InitializeDicomSecurity(false); scu = new QueryRetrieveScu(string.Empty, DicomNetSecurityMode.Tls, GatewaySession._openSslOptions); scu.UseSecureHost = true; GatewaySession.SetCiphers(scu); } if (scu == null) { scu = new QueryRetrieveScu(); } scu.AETitle = server.AETitle; scu.HostAddress = IPAddress.Parse(server.Address); scu.HostPort = port; return(scu); }
public static Patient FindPatient(Control owner, QueryRetrieveScu find, DicomScp scp, string pid) { PatientRootQueryPatient query = new PatientRootQueryPatient(); Patient patient = null; ProgressDialog progress = new ProgressDialog(); query.PatientQuery.PatientId = pid; Thread thread = new Thread(() => { try { find.Find <PatientRootQueryPatient, Patient>(scp, query, (p, ds) => patient = p); } catch (Exception e) { ApplicationUtils.ShowException(owner, e); } }); progress.ActionThread = thread; progress.Title = "Searching For Patient"; progress.ProgressInfo = "Looking for patient to merge with."; progress.ShowDialog(owner); return(patient); }
QueryRetrieveScu CreateQRObject() { QueryRetrieveScu _QRScu = null; _QRScu = new QueryRetrieveScu(); _QRScu.MaxLength = 46726; _QRScu.ImplementationClass = ConfigurationImplementationClass; _QRScu.ProtocolVersion = ConfigurationProtocolversion; _QRScu.ImplementationVersionName = ConfigurationImplementationVersionName; _QRScu.AETitle = ClientAE; _QRScu.HostPort = ClientPort; _QRScu.Moved += new Leadtools.Dicom.Scu.Common.MovedDelegate(_find_Moved); _QRScu.AfterCMove += new Leadtools.Dicom.Scu.Common.AfterCMoveDelegate(_find_AfterCMove); _QRScu.PrivateKeyPassword += new PrivateKeyPasswordDelegate(_find_PrivateKeyPassword); if (UseTls) { _QRScu.SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.DheRsaWith3DesEdeCbcSha); _QRScu.SetTlsClientCertificate( ClientCertificate, DicomTlsCertificateType.Pem, ClientPrivateKey.Length > 0 ? ClientPrivateKey : null); } _QRScu.DebugLogFilename = string.Empty; _QRScu.EnableDebugLog = false; return(_QRScu); }
public EditPatientDialog(NActionScu naction, QueryRetrieveScu find, DicomScp scp, Patient patient) { InitializeComponent(); _Patient = patient; _naction = naction; _find = find; _scp = scp; errorProvider = new ErrorProvider(this); errorProvider.SetIconAlignment(textBoxLastname, ErrorIconAlignment.TopLeft); errorProvider.SetIconAlignment(textBoxId, ErrorIconAlignment.TopLeft); }
override public void StartJob() { try { #region LOG { string message = @"MoveObjectsJob StartJob"; Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now, LogType.Information, MessageDirection.None, message, null, null); } #endregion if (IsAbortTriggered()) { JobAborted(); return; } JobPending(); #region LOG { string message = @"MoveObjectsJob StartJob - Pending"; Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now, LogType.Information, MessageDirection.None, message, null, null); } #endregion using (_QRScu = CreateQRObject()) { JobRunning(); _QRScu.Move(CreateServerObject(), MoveToClientAE, DataSet); #region LOG { string message = @"MoveObjectsJob Completed"; Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now, LogType.Information, MessageDirection.None, message, null, null); } #endregion PostJobRoutine(); JobSucceeded(); } } catch (System.Exception ex) { JobFailed("Error connecting to remote server {" + ServerAE + "}: " + ex.Message); } finally { _QRScu = null; } }
private QueryRetrieveScu CreateQueryRetrieveClient() { QueryRetrieveScu find; find = new QueryRetrieveScu(); find.ImplementationClass = Constants.ConfigurationImplementationClass; find.ProtocolVersion = Constants.ConfigurationProtocolversion; find.ImplementationVersionName = Constants.ConfigurationImplementationVersionName; find.AETitle = ScuInfo.AETitle; find.HostPort = ScuInfo.Port; find.HostAddress = IPAddress.Parse(ScuInfo.Address); return(find); }
private void UnregisterEvents(QueryRetrieveScu find) { try { find.AfterAssociateRequest -= new AfterAssociateRequestDelegate(find_AfterAssociateRequest); find.AfterCMove -= new AfterCMoveDelegate(find_AfterCMove); find.AfterConnect -= new AfterConnectDelegate(find_AfterConnect); find.PrivateKeyPassword -= find_PrivateKeyPassword; find.AfterSecureLinkReady -= Find_AfterSecureLinkReady; } catch (Exception exception) { System.Diagnostics.Debug.Assert(false, exception.Message); throw; } }
private void UnregisterEvents(QueryRetrieveScu find) { try { find.AfterAssociateRequest -= new AfterAssociateRequestDelegate(find_AfterAssociateRequest); find.AfterCFind -= new AfterCFindDelegate(find_AfterCFind); find.AfterConnect -= new AfterConnectDelegate(find_AfterConnect); find.MatchStudy -= new MatchStudyDelegate(find_MatchStudy); find.MatchSeries -= new MatchSeriesDelegate(find_MatchSeries); find.MatchInstance -= new MatchInstanceDelegate(find_MatchInstance); } catch (Exception exception) { System.Diagnostics.Debug.Assert(false, exception.Message); throw; } }
protected override void OnReceiveCStoreRequest(QueryRetrieveScu scu, byte presentationID, int messageID, string affectedClass, string instance, DicomCommandPriorityType priority, string moveAE, int moveMessageID, DicomDataSet dataSet) { if ((_mainForm != null) && (_mainForm._mySettings.LogLowLevel)) { string sMsg = _sNewlineTab + "scu:\t" + scu.ToString() + _sNewlineTab + "presentationID:\t" + presentationID.ToString() + _sNewlineTab + "messageID:\t" + messageID.ToString() + _sNewlineTab + "affectedClass:\t" + affectedClass + _sNewlineTab + "instance:\t" + instance + _sNewlineTab + "priority:\t" + priority.ToString() + _sNewlineTab + "moveAE:\t" + moveAE + _sNewlineTab + "moveMessageID:\t" + moveMessageID.ToString(); _mainForm.LogText("OnReceiveCStoreRequest", sMsg, System.Drawing.Color.Green); } base.OnReceiveCStoreRequest(scu, presentationID, messageID, affectedClass, instance, priority, moveAE, moveMessageID, dataSet); }
private void RegisterEvents(QueryRetrieveScu find) { try { find.AfterAssociateRequest += new AfterAssociateRequestDelegate(find_AfterAssociateRequest); find.AfterCFind += new AfterCFindDelegate(find_AfterCFind); find.AfterConnect += new AfterConnectDelegate(find_AfterConnect); find.MatchStudy += new MatchStudyDelegate(find_MatchStudy); find.MatchSeries += new MatchSeriesDelegate(find_MatchSeries); find.MatchInstance += new MatchInstanceDelegate(find_MatchInstance); find.AfterSecureLinkReady += Find_AfterSecureLinkReady; find.PrivateKeyPassword += find_PrivateKeyPassword; } catch (Exception exception) { System.Diagnostics.Debug.Assert(false, exception.Message); throw; } }
public EditSeriesDialog(NActionScu naction, QueryRetrieveScu find, DicomScp scp, string studyInstanceUID, PatientUpdaterSeries series, Patient patient) { InitializeComponent(); _Series = series; _Patient = patient; _naction = naction; _scp = scp; _find = find; _StudyInstanceUID = studyInstanceUID; InitializeModalities(); try { radioButtonMoveSeriesToExistingPatient.Visible = ConfigurationManager.AppSettings["AllowSeriesMove"] == null ? false : bool.Parse(ConfigurationManager.AppSettings["AllowSeriesMove"]); } catch { radioButtonMoveSeriesToExistingPatient.Visible = false; } }
public T[] DoFind(DicomDataSet query) { using (QueryRetrieveScu find = CreateQueryRetrieveClient()) { __CurrentFind = find; RegisterEvents(find); try { DicomScp scp = new DicomScp( ); scp.AETitle = ScpInfo.AETitle; scp.Port = ScpInfo.Port; scp.PeerAddress = IPAddress.Parse(ScpInfo.Address); Matches = new List <T>(); find.EnableDebugLog = false; find.Find(scp, query); return(Matches.ToArray( )); } catch (Exception exception) { System.Diagnostics.Debug.Assert(false, exception.Message); throw; } finally { __CurrentFind = null; UnregisterEvents(find); } } }
public PatientData[] DoFindPatient(PatientsQueryOptions query) { using (QueryRetrieveScu find = CreateQueryRetrieveClient()) { __CurrentFind = find; RegisterEvents(find); try { DicomScp scp = new DicomScp( ); scp.AETitle = ScpInfo.AETitle; scp.Port = ScpInfo.Port; scp.PeerAddress = IPAddress.Parse(ScpInfo.Address); Patients = new List <PatientData>(); find.EnableDebugLog = false; PatientRootQueryPatient patientRootQuery = new PatientRootQueryPatient( ); if (query != null) { if (!string.IsNullOrEmpty(query.BirthDate)) { #if LEADTOOLS_V19_OR_LATER DateRange dr = new DateRange(); DateTime dt = DateTime.Parse(query.BirthDate); dr.StartDate = dt; dr.EndDate = dt; patientRootQuery.PatientQuery.PatientBirthDate = dr;//DateTime.Parse ( query.BirthDate ) ; #else patientRootQuery.PatientQuery.PatientBirthDate = DateTime.Parse(query.BirthDate); #endif } patientRootQuery.PatientQuery.PatientId = query.PatientID; patientRootQuery.PatientQuery.PatientName = query.PatientName; patientRootQuery.PatientQuery.PatientSex = query.Sex; patientRootQuery.PatientQuery.PatientComments = query.Comments; // patientRootQuery.PatientQuery.EthnicGroup = query.EthnicGroup; } find.Find <PatientRootQueryPatient, PatientQuery> (scp, patientRootQuery, PatientMatchDelegate); return(Patients.ToArray( )); } catch (Exception exception) { System.Diagnostics.Debug.Assert(false, exception.Message); throw; } finally { __CurrentFind = null; UnregisterEvents(find); } } }