예제 #1
0
        public void UpdateDataset(DcmDataset dataset)
        {
            if (_lossy)
            {
                DcmCodeString cs = dataset.GetCS(DicomTags.ImageType);
                if (cs != null)
                {
                    string[] values = cs.GetValues();
                    values[0] = "DERIVED";
                    cs.SetValues(values);
                }

                dataset.AddElementWithValue(DicomTags.SOPInstanceUID, DicomUID.Generate());

                // FIXME: append existing values
                dataset.AddElementWithValue(DicomTags.LossyImageCompression, "01");
                dataset.AddElementWithValue(DicomTags.LossyImageCompressionMethod, _lossyMethod);
                dataset.AddElementWithValue(DicomTags.LossyImageCompressionRatio, _lossyRatio);
            }
            dataset.AddElementWithValue(DicomTags.NumberOfFrames, _frames);
            dataset.AddElementWithValue(DicomTags.Columns, _width);
            dataset.AddElementWithValue(DicomTags.Rows, _height);
            dataset.AddElementWithValue(DicomTags.HighBit, _highBit);
            dataset.AddElementWithValue(DicomTags.BitsStored, _bitsStored);
            dataset.AddElementWithValue(DicomTags.BitsAllocated, _bitsAllocated);
            dataset.AddElementWithValue(DicomTags.SamplesPerPixel, _samplesPerPixel);
            dataset.AddElementWithValue(DicomTags.PixelRepresentation, _pixelRepresentation);
            dataset.AddElementWithValue(DicomTags.PhotometricInterpretation, _photometricInterpretation);
            if (SamplesPerPixel == 1)
            {
                dataset.AddElementWithValue(DicomTags.RescaleSlope, _rescaleSlope);
                dataset.AddElementWithValue(DicomTags.RescaleIntercept, _rescaleIntercept);
                //if (_pixelPaddingValue != 0)
                //    dataset.AddElementWithValue(DicomTags.PixelPaddingValue, _pixelPaddingValue);
            }
            else
            {
                dataset.AddElementWithValue(DicomTags.PlanarConfiguration, _planarConfiguration);
            }
            dataset.AddItem(_pixelDataItem);
        }