コード例 #1
0
        public DicomFile GetDicom(Image <Gray, byte> outputImage, DicomInformation dicomInformation)
        {
            var bitmap = outputImage.Bitmap;

            bitmap = GetValidImage(bitmap);

            int rows, columns;

            byte[] pixels = GetPixels(bitmap, out rows, out columns);

            MemoryByteBuffer buffer = new MemoryByteBuffer(pixels);

            DicomDataset dataset = new DicomDataset();

            FillDataset(dataset, dicomInformation);

            dataset.Add(DicomTag.PhotometricInterpretation, PhotometricInterpretation.Rgb.Value);
            dataset.Add(DicomTag.Rows, (ushort)rows);
            dataset.Add(DicomTag.Columns, (ushort)columns);
            dataset.Add(DicomTag.BitsAllocated, (ushort)8);

            DicomPixelData pixelData = DicomPixelData.Create(dataset, true);

            pixelData.BitsStored          = 8;
            pixelData.BitsAllocated       = 8;
            pixelData.SamplesPerPixel     = 3;
            pixelData.HighBit             = 7;
            pixelData.PixelRepresentation = 0;
            pixelData.PlanarConfiguration = 0;
            pixelData.AddFrame(buffer);

            DicomFile dicomfile = new DicomFile(dataset);

            return(dicomfile);
        }
コード例 #2
0
ファイル: SuperTomograph.cs プロジェクト: a-mile/Tomograph
        public SuperTomograph(IImageLoader bitmapLoader, IEmitterDetectorSystem emitterDetectorSystem,
                              IDicomCreator dicomCreator)
        {
            _bitmapLoader          = bitmapLoader;
            _emitterDetectorSystem = emitterDetectorSystem;
            _dicomCreator          = dicomCreator;

            Configuration    = new TomographConfiguration();
            DicomInformation = new DicomInformation();
        }
コード例 #3
0
        private void FillDataset(DicomDataset dataset, DicomInformation dicomInformation)
        {
            dataset.Add(DicomTag.SOPClassUID, DicomUID.SecondaryCaptureImageStorage);
            dataset.Add(DicomTag.StudyInstanceUID, GenerateUid());
            dataset.Add(DicomTag.SeriesInstanceUID, GenerateUid());
            dataset.Add(DicomTag.SOPInstanceUID, GenerateUid());

            dataset.Add(DicomTag.PatientName, dicomInformation.PatientName);
            dataset.Add(DicomTag.PatientAddress, dicomInformation.PatientAddress);
            dataset.Add(DicomTag.PatientBirthDate, dicomInformation.PatientBirthDate);
            dataset.Add(DicomTag.PatientSex, dicomInformation.PatientSex);
            dataset.Add(DicomTag.PatientAge, dicomInformation.PatientAge);
            dataset.Add(DicomTag.PatientWeight, dicomInformation.PatientWeight);
            dataset.Add(DicomTag.StudyDate, dicomInformation.StudyDate);
            dataset.Add(DicomTag.StudyTime, dicomInformation.StudyDate);
            dataset.Add(DicomTag.StudyDescription, dicomInformation.StudyDescription);
        }