Exemplo n.º 1
0
        private void MoveSeries()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Moving Series");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                MoveSeries             move     = new MoveSeries();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));
                move.SeriesInstanceUID = _Series.InstanceUID;
                move.Reason            = dlgReason.Reason;
                move.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                move.Description       = "Move Series";

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <MoveSeries>(_scp, move, NActionScu.MoveSeries,
                                                                          NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Moving Series";
                progress.ProgressInfo = "Performing series move to patient: " + textBoxFirstname.Text + " " + textBoxLastname.Text + ".";
                progress.ShowDialog(this);

                if (status == DicomCommandStatusType.Success)
                {
                    _Action = ActionType.Merge;
                    TaskDialogHelper.ShowMessageBox(this, "Move Series", "The series has been successfully move.", GetMergeInfo(),
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The series was not move.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The series was not move.\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);
                }
            }
        }
Exemplo n.º 2
0
        private void DeletePatientButton_Click(object sender, EventArgs e)
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Patient")
            {
                Icon = Icon
            };

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                ProgressDialog         progress   = new ProgressDialog();
                Patient                patient    = listViewPatients.SelectedItems[0].Tag as Patient;
                DeletePatient          delPatient = new DeletePatient();
                DicomCommandStatusType status     = DicomCommandStatusType.Success;

                delPatient.Reason      = dlgReason.Reason;
                delPatient.Operator    = Environment.UserName != string.Empty?Environment.UserName:Environment.MachineName;
                delPatient.Station     = Environment.MachineName;
                delPatient.PatientId   = patient.Id;
                delPatient.Description = "Patient Delete";
                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <DeletePatient>(_server, delPatient, NActionScu.DeletePatient,
                                                                             NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception ex)
                    {
                        ApplicationUtils.ShowException(this, ex);
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Deleting Patient: " + patient.Name.Full;
                progress.ProgressInfo = "Performing patient delete.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    //
                    // Remove the deleted patient from the list
                    //
                    DeletePatient(listViewPatients.SelectedItems[0]);
                }
                else
                {
                    if (status == DicomCommandStatusType.UnrecognizedOperation)
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Patient", "Check Server Permissions", "There was an error deleting the patient. " +
                                                        "This is usually caused by invalid AE permissions.", string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                    else
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Patient", "Check Server Log", "There was an error deleting the patient. " +
                                                        string.Format("The server return the following error: {0}.", _naction.GetErrorMessage()), string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void DeleteSeriesButton_Click(object sender, EventArgs e)
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Series")
            {
                Icon = Icon
            };

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                Series                 series    = listViewSeries.SelectedItems[0].Tag as Series;
                DeleteSeries           delSeries = new DeleteSeries();
                DicomCommandStatusType status    = DicomCommandStatusType.Success;

                delSeries.Reason            = dlgReason.Reason;
                delSeries.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                delSeries.Description       = "Series Delete";
                delSeries.StudyInstanceUID  = listViewSeries.SelectedItems[0].SubItems[listViewSeries.SelectedItems[0].SubItems.Count - 1].Text;
                delSeries.SeriesInstanceUID = series.InstanceUID;

                status = _naction.SendNActionRequest <DeleteSeries>(_server, delSeries, NActionScu.DeleteSeries,
                                                                    NActionScu.PatientUpdateInstance);
                if (status == DicomCommandStatusType.Success)
                {
                    DeleteSeries(listViewSeries.SelectedItems[0]);
                }
                else
                {
                    if (status == DicomCommandStatusType.UnrecognizedOperation)
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Series", "Check Server Permissions", "There was an error deleting the series. " +
                                                        "This is usually caused by invalid AE permissions.", string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                    else
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Series", "Check Server Log", "There was an error deleting the series. " +
                                                        string.Format("The server return the following error: {0}.", _naction.GetErrorMessage()), string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void CopyPatient()
        {
            //
            // If the patient ID has changed then we need to see if a patient with that id already exists
            //
            if (_Patient.Id != textBoxId.Text)
            {
                PatientRootQueryPatient query    = new PatientRootQueryPatient();
                List <Patient>          patients = new List <Patient>();

                query.PatientQuery.PatientId = textBoxId.Text;
                try
                {
                    _find.Find <PatientRootQueryPatient, Patient>(_scp, query, (patient, ds) => patients.Add(patient));
                    if (patients.Count > 0)
                    {
                        TaskDialogResult result = TaskDialogResult.Yes;

                        result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge with existing patient?",
                                                                 "The patient id already exisits.", "Existing Patient: " + patients[0].Name.Full,
                                                                 TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);

                        if (result == TaskDialogResult.Yes)
                        {
                            radioButtonMerge.Checked = true;
                            textBoxLastname.Text     = patients[0].Name.Family;
                            textBoxFirstname.Text    = patients[0].Name.Given;
                            if (string.IsNullOrEmpty(patients[0].Sex))
                            {
                                comboBoxSex.Text = string.Empty;
                            }
                            else
                            {
                                comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patients[0].Sex);
                            }
                            if (patients[0].BirthDate.HasValue)
                            {
                                dateTimePickerBirth.Value   = patients[0].BirthDate.Value;
                                dateTimePickerBirth.Checked = true;
                            }
                            else
                            {
                                dateTimePickerBirth.Checked = false;
                            }
                        }
                        else
                        {
                            textBoxId.Text = _Patient.Id;
                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                    return;
                }
            }

            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Copying Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                CopyPatient            change = new CopyPatient();
                DicomCommandStatusType status = DicomCommandStatusType.Success;

                change.OriginalPatientId = _Patient.Id.Replace(@"\", @"\\").Replace("'", @"''");
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.PatientId         = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Reason            = dlgReason.Reason;
                change.Description       = "Copy Patient";
                change.Name.Given        = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Name.Family       = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Sex = comboBoxSex.Text;
                if (dateTimePickerBirth.Checked)
                {
                    change.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    change.Birthdate = null;
                }

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID opid = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID();

                    change.OtherPatientIdsSequence = new List <Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID>();
                    opid.PatientId       = textBoxOtherPid.Text.Replace(@"\", @"\\").Replace("'", @"''");
                    opid.TypeOfPatientId = "TEXT";
                    change.OtherPatientIdsSequence.Add(opid);
                }
#endif

                status = _naction.SendNActionRequest <CopyPatient>(_scp, change, NActionScu.CopyPatient, NActionScu.PatientUpdateInstance);
                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.CopyPatient;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Copied", "The patient has been successfully copied.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Copy Error", "The patient has not been successfully copied.", string.Empty,
                                                    "Error - " + _naction.GetErrorMessage(), TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
Exemplo n.º 5
0
        private void MergePatient()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Merging Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                MergePatient           merge    = new MergePatient();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                merge.PatientId   = textBoxId.Text;
                merge.Operator    = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                merge.Reason      = dlgReason.Reason;
                merge.Description = "Merge Patient";
                merge.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <MergePatient>(_scp, merge, NActionScu.MergePatient,
                                                                            NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Merging Patient: " + _Patient.Name.Full;
                progress.ProgressInfo = "Performing patient merge.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    Action = ActionType.Merge;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Merge", "The patient has been successfully merged.", GetMergeInfo(),
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The patient has not been merged.\r\nError - ";
                    string footer  = string.Empty;

                    if (status == DicomCommandStatusType.Reserved2)
                    {
                        message += "Missing Files";
                    }
                    else
                    {
                        message += _naction.GetErrorMessage();
                    }

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The patient has not been merged.\r\nPatient not found on server.";
                    }
                    else if (status == DicomCommandStatusType.Reserved2)
                    {
                        footer = "Contact system administrator for help in resolving this issue.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Merge Patient Error", "The patient has not been merged.", message,
                                                    footer, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
Exemplo n.º 6
0
        private void ChangePatient()
        {
            //
            // If the patient ID has changed then we need to see if a patient with that id already exists
            //
            if (_Patient.Id != textBoxId.Text)
            {
                PatientRootQueryPatient query    = new PatientRootQueryPatient();
                List <Patient>          patients = new List <Patient>();

                query.PatientQuery.PatientId = textBoxId.Text;
                try
                {
                    _find.Find <PatientRootQueryPatient, Patient>(_scp, query, (patient, ds) => patients.Add(patient));
                    if (patients.Count > 0)
                    {
                        TaskDialogResult result = TaskDialogResult.Yes;

                        result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge with existing patient?",
                                                                 "The patient id already exisits.", "Existing Patient: " + patients[0].Name.Full,
                                                                 TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);

                        if (result == TaskDialogResult.Yes)
                        {
                            radioButtonMerge.Checked  = true;
                            textBoxLastname.Text      = patients[0].Name.Family;
                            textBoxFirstname.Text     = patients[0].Name.Given;
                            comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patients[0].Sex);
                            if (patients[0].BirthDate.HasValue)
                            {
                                dateTimePickerBirth.Value   = patients[0].BirthDate.Value;
                                dateTimePickerBirth.Checked = true;
                            }
                            else
                            {
                                dateTimePickerBirth.Checked = false;
                            }
                            MergePatient();
                            return;
                        }
                        else
                        {
                            textBoxId.Text = _Patient.Id;
                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                    return;
                }
            }

            bool isError = VerifyPatientSettings();

            if (isError)
            {
                return;
            }

            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                ChangePatient          change = new ChangePatient();
                DicomCommandStatusType status = DicomCommandStatusType.Success;

                change.OriginalPatientId = _Patient.Id.Replace(@"\", @"\\").Replace("'", @"''");
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.PatientId         = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Reason            = dlgReason.Reason;
                change.Description       = "Change Patient";
                change.Name.Given        = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Name.Family       = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Sex = comboBoxSex.Text;
                if (dateTimePickerBirth.Checked)
                {
                    change.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    change.Birthdate = null;
                }

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    change.OtherPatientIdsSequence = new List <Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID>();
                    string textBoxStringOtherPid = textBoxOtherPid.Text.Replace("'", @"''");

                    if (!string.IsNullOrEmpty(textBoxStringOtherPid))
                    {
                        char[]   delimiterChars  = { '\\' };
                        string[] otherPatientIds = textBoxStringOtherPid.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string otherPatientId in otherPatientIds)
                        {
                            Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID opid = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID();
                            opid.PatientId       = otherPatientId;
                            opid.TypeOfPatientId = "TEXT";
                            change.OtherPatientIdsSequence.Add(opid);
                        }
                    }
                }
#endif

                status = _naction.SendNActionRequest <ChangePatient>(_scp, change, NActionScu.ChangePatient,
                                                                     NActionScu.PatientUpdateInstance);
                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.Change;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Changed", "The patient has been successfully changed.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;

                    if (change.OriginalPatientId != _Patient.Id)
                    {
                        if (Program.OtherPID.ContainsKey(change.OriginalPatientId))
                        {
                            Program.OtherPID.Remove(change.OriginalPatientId);
                        }
                    }

                    Program.OtherPID[_Patient.Id] = textBoxOtherPid.Text;
                }
                else
                {
                    string message = "The patient was not changed.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The patient was not changed.\r\nPatient not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Change Patient Error", "The patient was not changed.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
Exemplo n.º 7
0
        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);
                }
            }
        }
Exemplo n.º 8
0
        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);
                }
            }
        }
Exemplo n.º 9
0
        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);
                }
            }
        }
Exemplo n.º 10
0
        /*
         * 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);
                }
            }
        }