Exemple #1
0
        private void ReadFromReader()
        {
            this.label1.Visible = true;

            if (this.reader.FilePath != null && this.reader.Read())
            {
                this.pictureBox1.Image = this.reader.BitmapImage;
                this.fileInformation = this.reader.FileInf;
                this.dictionary = this.fileInformation.GetTagsDictionary();

                int[] dims = this.reader.Dims;

                StringBuilder stringBuilder = new StringBuilder("Patient: ");
                stringBuilder.Append(this.fileInformation.PatientName);
                stringBuilder.Append(" | Body part: ");
                stringBuilder.Append(this.fileInformation.BodyPart);
                stringBuilder.AppendFormat(" | Image dimensions: {0}x{1}", dims[0], dims[1]);
                this.toolStripStatusLabel1.Text = stringBuilder.ToString();

                this.dataGridView1.Rows.Clear();

                foreach (KeyValuePair<string, string> kv in this.dictionary)
                    this.dataGridView1.Rows.Add(kv.Key, kv.Value);
            }
            else
                MessageBox.Show("File has not been found. File name has been changed, file has been deleted or file is corrupted.", "DICOM Reader error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            this.label1.Visible = false;
        }
Exemple #2
0
        private bool ReadTags()
        {
            if (this.image != null)
            {
                this.fileInformation = new FileInformation();

                this.fileInformation.StudyID = this.ReadTag(0x20, 0x10);
                this.fileInformation.StudyInstanceUID = this.ReadTag(0x20, 0xD);
                this.fileInformation.SeriesInstanceUID = this.ReadTag(0x20, 0xE);
                this.fileInformation.PatientID = this.ReadTag(0x10, 0x20);
                this.fileInformation.PatientName = this.ReadTag(0x10, 0x10);
                this.fileInformation.PatientBirthDate = this.ReadTag(0x10, 0x30);
                this.fileInformation.PatientAge = this.ReadTag(0x10, 0x1010);
                this.fileInformation.BodyPart = this.ReadTag(0x18, 0x15);
                this.fileInformation.ProcedureStep = this.ReadTag(0x40, 0x254);
                this.fileInformation.PatientSex = this.ReadTag(0x10, 0x40);
                this.fileInformation.PatientWeight = this.ReadTag(0x10, 0x1030);
                this.fileInformation.PatientSize = this.ReadTag(0x10, 0x1020);
                this.fileInformation.PatientPosition = this.ReadTag(0x18, 0x5100);
                this.fileInformation.PatientOrientation = this.ReadTag(0x20, 0x20);
                this.fileInformation.PatientMotherName = this.ReadTag(0x10, 0x1060);
                this.fileInformation.PatientReligion = this.ReadTag(0x10, 0x21F0);
                this.fileInformation.PatientAddress = this.ReadTag(0x10, 0x1040);
                this.fileInformation.AcquisitionDate = this.ReadTag(0x8, 0x22);
                this.fileInformation.ContentDate = this.ReadTag(0x8, 0x23);
                this.fileInformation.ContentTime = this.ReadTag(0x8, 0x33);
                this.fileInformation.CreationDate = this.ReadTag(0x2100, 0x40);
                this.fileInformation.CreationTime = this.ReadTag(0x2100, 0x50);
                this.fileInformation.Date = this.ReadTag(0x40, 0xA121);
                this.fileInformation.SeriesDate = this.ReadTag(0x8, 0x21);
                this.fileInformation.SeriesTime = this.ReadTag(0x8, 0x31);
                this.fileInformation.StudyDate = this.ReadTag(0x8, 0x20);
                this.fileInformation.StudyTime = this.ReadTag(0x8, 0x30);
                this.fileInformation.TreatmentDate = this.ReadTag(0x3008, 0x250);
                this.fileInformation.ImageID = this.ReadTag(0x54, 0x400);
                this.fileInformation.ImageCenter = this.ReadTag(0x28, 0x1050);
                this.fileInformation.ImageOrientation = this.ReadTag(0x20, 0x37);
                this.fileInformation.ImagePosition = this.ReadTag(0x2020, 0x10);
                this.fileInformation.ImageRotation = this.ReadTag(0x70, 0x42);
                this.fileInformation.InstitutionName = this.ReadTag(0x8, 0x80);
                this.fileInformation.InstitutionAddress = this.ReadTag(0x8, 0x81);
                this.fileInformation.PhysicianName = this.ReadTag(0x8, 0x90);
                this.fileInformation.DeviceCalibrationDate = this.ReadTag(0x18, 0x1200);
                this.fileInformation.DeviceManufacturer = this.ReadTag(0x8, 0x70);
                this.fileInformation.DeviceModel = this.ReadTag(0x8, 0x1090);
                this.fileInformation.DetectorID = this.ReadTag(0x18, 0x700A);
                this.fileInformation.SOPClassUID = this.ReadTag(0x8, 0x16);
                this.fileInformation.SOPInstanceUID = this.ReadTag(0x8, 0x18);

                return true;
            }
            else
                return false;
        }