private void CopyStudy() { ReasonDialog dlgReason = new ReasonDialog("Input Reason For Copying Study"); if (dlgReason.ShowDialog(this) == DialogResult.OK) { CopyStudy move = new CopyStudy(); DicomCommandStatusType status = DicomCommandStatusType.Success; ProgressDialog progress = new ProgressDialog(); move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.OtherPatientIDs = textBoxOtherPid.Text; move.Name.Given = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.Name.Family = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.Sex = comboBoxSex.Text; move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id)); if (dateTimePickerBirth.Checked) { move.Birthdate = dateTimePickerBirth.Value; } else { move.Birthdate = null; } move.StudyInstanceUID = _StudyInstanceUID; move.Reason = dlgReason.Reason; move.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; move.Description = "Copy Study"; Thread thread = new Thread(() => { try { status = _naction.SendNActionRequest <CopyStudy>(_scp, move, NActionScu.CopyStudy, NActionScu.PatientUpdateInstance); } catch (Exception e) { ApplicationUtils.ShowException(this, e); status = DicomCommandStatusType.Failure; } }); progress.ActionThread = thread; progress.Title = "Copying Study"; progress.ProgressInfo = "Performing study copy: " + textBoxFirstname.Text + " " + textBoxLastname.Text + "."; progress.ShowDialog(this); if (status == DicomCommandStatusType.Success) { _Action = ActionType.CopyStudy; TaskDialogHelper.ShowMessageBox(this, "Study Copied", "The study has been successfully copied.", string.Empty, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); DialogResult = DialogResult.OK; } else { string message = "The series was not copied.\r\nError - " + _naction.GetErrorMessage(); if (status == DicomCommandStatusType.MissingAttribute) { message = "The series was not copied.\r\nSeries not found on server."; } TaskDialogHelper.ShowMessageBox(this, "Copy Series Error", "The series was not copied.", message, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); } } }
private void ChangeSeries() { ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Series"); if (dlgReason.ShowDialog(this) == DialogResult.OK) { ChangeSeries change = new ChangeSeries(); DicomCommandStatusType status = DicomCommandStatusType.Success; ProgressDialog progress = new ProgressDialog(); change.SeriesInstanceUID = _Series.InstanceUID; change.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; change.Reason = dlgReason.Reason; change.Description = "Change Series"; change.Modality = comboBoxModality.Text; change.SeriesDescription = textBoxDescription.Text.Replace(@"\", @"\\").Replace("'", @"''"); if (dateTimePickerSeriesDate.Checked) { change.SeriesDate = dateTimePickerSeriesDate.Value; } else { change.SeriesDate = null; } if (dateTimePickerSeriesTime.Checked) { change.SeriesTime = dateTimePickerSeriesTime.Value; } else { change.SeriesTime = null; } Thread thread = new Thread(() => { try { status = _naction.SendNActionRequest <ChangeSeries>(_scp, change, NActionScu.ChangeSeries, NActionScu.PatientUpdateInstance); } catch (Exception e) { ApplicationUtils.ShowException(this, e); status = DicomCommandStatusType.Failure; } }); progress.ActionThread = thread; progress.Title = "Changing Series"; progress.ProgressInfo = "Performing series change."; progress.ShowDialog(this); if (status == DicomCommandStatusType.Success) { _Series.Modality = comboBoxModality.Text; _Series.Description = textBoxDescription.Text; if (dateTimePickerSeriesDate.Checked) { _Series.Date = change.SeriesDate; } else { _Series.Date = null; } if (dateTimePickerSeriesTime.Checked) { _Series.Time = change.SeriesTime; } else { _Series.Time = null; } _Action = ActionType.Change; TaskDialogHelper.ShowMessageBox(this, "Series Changed", "The series has been successfully changed.", string.Empty, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); DialogResult = DialogResult.OK; } else { string message = "The series was not changed.\r\nError - " + _naction.GetErrorMessage(); if (status == DicomCommandStatusType.MissingAttribute) { message = "The series was not changed.\r\nSeries not found on server."; } TaskDialogHelper.ShowMessageBox(this, "Change Series Error", "The series was not changed.", message, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); } } }
private void MoveToNewPatient() { ReasonDialog dlgReason = new ReasonDialog("Input Reason For Moving Study To New Patient"); if (dlgReason.ShowDialog(this) == DialogResult.OK) { MoveToNewPatient move = new MoveToNewPatient(); DicomCommandStatusType status = DicomCommandStatusType.Success; ProgressDialog progress = new ProgressDialog(); move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''"); #if (LEADTOOLS_V19_OR_LATER) if (textBoxOtherPid.Text.Length > 0) { move.OtherPatientIds = new List <string>(); string textBoxStringOtherPid = textBoxOtherPid.Text.Replace("'", @"''"); if (!string.IsNullOrEmpty(textBoxStringOtherPid)) { char[] delimiterChars = { '\\' }; string[] otherPatientIds = textBoxStringOtherPid.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); foreach (string otherPatientId in otherPatientIds) { move.OtherPatientIds.Add(otherPatientId); } } } #endif move.Name.Given = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.Name.Family = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.Sex = comboBoxSex.Text; move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id)); if (dateTimePickerBirth.Checked) { move.Birthdate = dateTimePickerBirth.Value; } else { move.Birthdate = null; } move.StudyInstanceUID = _StudyInstanceUID; move.Reason = dlgReason.Reason; move.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; move.Description = "Move Study To New Patient"; Thread thread = new Thread(() => { try { status = _naction.SendNActionRequest <MoveToNewPatient>(_scp, move, NActionScu.MoveStudyToNewPatient, NActionScu.PatientUpdateInstance); } catch (Exception e) { ApplicationUtils.ShowException(this, e); status = DicomCommandStatusType.Failure; } }); progress.ActionThread = thread; progress.Title = "Moving Study To New Patient"; progress.ProgressInfo = "Performing study move to patient: " + textBoxFirstname.Text + " " + textBoxLastname.Text + "."; progress.ShowDialog(this); if (status == DicomCommandStatusType.Success) { _Patient.Id = textBoxId.Text; _Patient.Name.Given = textBoxFirstname.Text; _Patient.Name.Family = textBoxLastname.Text; _Patient.Sex = comboBoxSex.Text; if (dateTimePickerBirth.Checked) { _Patient.BirthDate = dateTimePickerBirth.Value; } else { _Patient.BirthDate = null; } _Action = ActionType.Move; TaskDialogHelper.ShowMessageBox(this, "Study Moved To New Patient", "The study has been successfully moved.", string.Empty, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); DialogResult = DialogResult.OK; } else { string message = "The series was not moved.\r\nError - " + _naction.GetErrorMessage(); if (status == DicomCommandStatusType.MissingAttribute) { message = "The series was not moved.\r\nSeries not found on server."; } TaskDialogHelper.ShowMessageBox(this, "Move Series Error", "The series was not moved.", message, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); } } }
/* * Example for deleting a study * * private void DeleteStudy() * { * ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Study"); * * if (dlgReason.ShowDialog(this) == DialogResult.OK) * { * Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy deleteStudy = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy(); * DicomCommandStatusType status = DicomCommandStatusType.Success; * ProgressDialog progress = new ProgressDialog(); * * deleteStudy.StudyInstanceUID = _StudyInstanceUID; * deleteStudy.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; * deleteStudy.Reason = dlgReason.Reason; * deleteStudy.Description = "Delete Study"; * * Thread thread = new Thread(() => * { * try * { * status = _naction.SendNActionRequest<Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy>(_scp, deleteStudy, * Leadtools.Dicom.Common.DataTypes.PatientUpdater.PatientUpdaterConstants.Action.DeleteStudy, * NActionScu.PatientUpdateInstance); * } * catch (Exception e) * { * ApplicationUtils.ShowException(this, e); * status = DicomCommandStatusType.Failure; * } * }); * * progress.ActionThread = thread; * progress.Title = "Deleting Study"; * progress.ProgressInfo = "Performing study delete."; * progress.ShowDialog(this); * if (status == DicomCommandStatusType.Success) * { * _Action = ActionType.Change; * TaskDialogHelper.ShowMessageBox(this, "Study Deleted", "The study has been successfully deleted.", string.Empty, * string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, * null); * DialogResult = DialogResult.OK; * } * else * { * string message = "The study was not deleted.\r\nError - " + _naction.GetErrorMessage(); * * if (status == DicomCommandStatusType.MissingAttribute) * message = "The study was not deleted.\r\nStudy not found on server."; * * TaskDialogHelper.ShowMessageBox(this, "Delete Study Error", "The study was not deleted.", message, * string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, * null); * } * } * }*/ //Example for changing study information private void ChangeStudy() { ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Study"); if (dlgReason.ShowDialog(this) == DialogResult.OK) { #if LEADTOOLS_V19_OR_LATER ChangeStudy change = new ChangeStudy(); #else Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy change = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy(); #endif DicomCommandStatusType status = DicomCommandStatusType.Success; ProgressDialog progress = new ProgressDialog(); change.StudyID = txtID.Text; change.AccessionNumber = txtAccession.Text; change.Description = "Change Study"; change.StudyDescription = txtDescription.Text; if (dateTimePickerStudyDate.Checked) { change.StudyDate = dateTimePickerStudyDate.Value; } else { change.StudyDate = null; } change.StudyInstanceUID = _StudyInstanceUID; change.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; change.Reason = dlgReason.Reason; Thread thread = new Thread(() => { try { #if LEADTOOLS_V19_OR_LATER status = _naction.SendNActionRequest <ChangeStudy>(_scp, change, NActionScu.ChangeStudy, NActionScu.PatientUpdateInstance); #else status = _naction.SendNActionRequest <Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy>(_scp, change, NActionScu.ChangeStudy, NActionScu.PatientUpdateInstance); #endif } catch (Exception e) { ApplicationUtils.ShowException(this, e); status = DicomCommandStatusType.Failure; } }); progress.ActionThread = thread; progress.Title = "Changing Study"; progress.ProgressInfo = "Performing study change."; progress.ShowDialog(this); if (status == DicomCommandStatusType.Success) { _Action = ActionType.Change; TaskDialogHelper.ShowMessageBox(this, "Study Changed", "The study has been successfully changed.", string.Empty, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); DialogResult = DialogResult.OK; } else { string message = "The study was not changed.\r\nError - " + _naction.GetErrorMessage(); if (status == DicomCommandStatusType.MissingAttribute) { message = "The study was not changed.\r\nStudy not found on server."; } TaskDialogHelper.ShowMessageBox(this, "Change Study Error", "The study was not changed.", message, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); } } }