示例#1
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            Patient patient = DicomUtils.FindPatient(this, _find, _scp, textBoxId.Text);

            if (patient != null)
            {
                textBoxLastname.Text      = patient.Name.Family;
                textBoxFirstname.Text     = patient.Name.Given;
                comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                if (patient.BirthDate.HasValue)
                {
                    dateTimePickerBirth.Value   = patient.BirthDate.Value;
                    dateTimePickerBirth.Checked = true;
                }

                if (Program.OtherPID.ContainsKey(patient.Id))
                {
                    textBoxOtherPid.Text = Program.OtherPID[patient.Id];
                }
                else
                {
                    OtherPatientIds.Text = string.Empty;
                    textBoxOtherPid.Text = string.Empty;
                }
            }
            else
            {
                TaskDialogHelper.ShowMessageBox(this, "Patient Search", "Patient with specified id was not found.", string.Empty,
                                                string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                null);
            }
            ActionButton.Enabled = patient != null;
        }
示例#2
0
        private void StayImageButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog();

            bool trueFile = true;

            if (dialog.ShowDialog() == true)
            {
                var filename = dialog.FileName;

                try
                {
                    var dcmfile = DicomFile.Open(filename);
                    secondFilename  = filename;
                    secondDirection = DicomUtils.GetDirectionParameter(dcmfile);
                }
                catch (Exception)
                {
                    trueFile = false;
                }
            }

            if (!trueFile)
            {
                secondFilename  = null;
                secondDirection = null;
            }
            else
            {
                StayImageLabel.Content = System.IO.Path.GetFileName(secondFilename);
            }
            CheckOkAvailability();
        }
示例#3
0
        public static SpineStorage GenerateStorageForAddedFile(DicomFile file)
        {
            var storage = new SpineStorage();

            var window_params = DicomUtils.GetWindowParameters(file);

            storage.windowWidth  = window_params.Item1;
            storage.windowCenter = window_params.Item2;

            storage.SetRotatingAngle(0);

            storage.direction      = 0;
            storage.imageDirection = 0;

            return(storage);
        }
        public void RenewBitmap()
        {
            pixels = DicomUtils.CreateBitmap(newpix);


            var bmp = DicomUtils.RotateImg(pixels, angle, System.Drawing.Color.Black);

            rotpixels = bmp;

            MemoryStream ms = new MemoryStream();

            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            ms.Position = 0;
            BitmapImage bi = new BitmapImage();

            bi.BeginInit();
            bi.StreamSource = ms;
            bi.EndInit();

            image.Source = bi;
        }
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                var filename = openFileDialog.FileName;
                fname = Path.GetFileName(filename);

                var dicom = DicomFile.Open(filename);

                var raw = DicomUtils.ExtractRawValues(dicom);

                var wc = DicomUtils.GetWindowParameters(dicom);

                newpix = DicomUtils.ChangeWindowWidthCenter(raw, wc.Item1, wc.Item2);

                rotpixels = pixels = DicomUtils.CreateBitmap(newpix);

                angle = 0;
                group.Children.Add(new ScaleTransform(2, 2));
                myCanvas.LayoutTransform = group;


                //image.Source = this.imageSourceForImageControl(pixels); //image1 is your control

                MemoryStream ms = new MemoryStream();
                pixels.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = ms;
                bi.EndInit();

                image.Source = bi;
            }
        }
示例#6
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            Patient patient = DicomUtils.FindPatient(this, _find, _scp, textBoxId.Text);

            if (!radioButtonMoveStudyToNewPatient.Checked)
            {
                if (patient != null)
                {
                    textBoxLastname.Text  = patient.Name.Family;
                    textBoxFirstname.Text = patient.Name.Given;
                    if (Program.OtherPID.ContainsKey(patient.Id))
                    {
                        textBoxOtherPid.Text = Program.OtherPID[patient.Id];
                    }
                    else
                    {
                        textBoxOtherPid.Text = string.Empty;
                    }
                    if (string.IsNullOrEmpty(patient.Sex))
                    {
                        comboBoxSex.Text = string.Empty;
                    }
                    else
                    {
                        comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                    }
                    if (patient.BirthDate.HasValue)
                    {
                        dateTimePickerBirth.Value   = patient.BirthDate.Value;
                        dateTimePickerBirth.Checked = true;
                    }
                    else
                    {
                        dateTimePickerBirth.Checked = false;
                    }
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Patient Search", "Patient with specified id was not found.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
                ActionButton.Enabled = patient != null;
            }
            else
            {
                if (patient != null)
                {
                    TaskDialogResult result = TaskDialogResult.Yes;

                    result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge the study with existing patient?",
                                                             "The patient id already exisits.", "Existing Patient: " + patient.Name.Full,
                                                             TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);
                    if (result == TaskDialogResult.Yes)
                    {
                        radioButtonMoveStudyToExistingPatient.Checked = true;
                        textBoxLastname.Text  = patient.Name.Family;
                        textBoxFirstname.Text = patient.Name.Given;
                        if (string.IsNullOrEmpty(patient.Sex))
                        {
                            comboBoxSex.Text = string.Empty;
                        }
                        else
                        {
                            comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                        }
                        if (patient.BirthDate.HasValue)
                        {
                            dateTimePickerBirth.Value   = patient.BirthDate.Value;
                            dateTimePickerBirth.Checked = true;
                        }
                        else
                        {
                            dateTimePickerBirth.Checked = false;
                        }
                        ActionButton.Enabled = true;
                    }
                    else
                    {
                        ActionButton.Enabled = false;
                    }
                }
                else
                {
                    ActionButton.Enabled = true;
                }
            }

            CopyButton.Enabled = ActionButton.Enabled && !radioButtonMoveSeriesToExistingPatient.Checked;
        }