private void Load(DcmDataset ds) { _rows = ds.GetUInt16(OverlayTag(DicomTags.OverlayRows), 0); _columns = ds.GetUInt16(OverlayTag(DicomTags.OverlayColumns), 0); _type = ds.GetString(OverlayTag(DicomTags.OverlayType), "Unknown"); DicomTag tag = OverlayTag(DicomTags.OverlayOrigin); if (ds.Contains(tag)) { short[] xy = ds.GetSS(tag).GetValues(); if (xy != null && xy.Length == 2) { _originX = xy[0]; _originY = xy[1]; } } _bitsAllocated = ds.GetUInt16(OverlayTag(DicomTags.OverlayBitsAllocated), 1); _bitPosition = ds.GetUInt16(OverlayTag(DicomTags.OverlayBitPosition), 0); tag = OverlayTag(DicomTags.OverlayData); if (ds.Contains(tag)) { DcmElement elem = ds.GetElement(tag); _data = elem.ByteBuffer.ToBytes(); } _description = ds.GetString(OverlayTag(DicomTags.OverlayDescription), String.Empty); _subtype = ds.GetString(OverlayTag(DicomTags.OverlaySubtype), String.Empty); _label = ds.GetString(OverlayTag(DicomTags.OverlayLabel), String.Empty); _frames = ds.GetInt32(OverlayTag(DicomTags.NumberOfFramesInOverlay), 1); _frameOrigin = ds.GetUInt16(OverlayTag(DicomTags.ImageFrameOrigin), 1); //TODO: include ROI }
public DcmPixelData(DcmDataset dataset) { _transferSyntax = dataset.InternalTransferSyntax; _lossy = dataset.GetString(DicomTags.LossyImageCompression, "00") != "00"; _lossyMethod = dataset.GetString(DicomTags.LossyImageCompressionMethod, String.Empty); _lossyRatio = dataset.GetString(DicomTags.LossyImageCompressionRatio, String.Empty); _frames = dataset.GetInt32(DicomTags.NumberOfFrames, 1); _width = dataset.GetUInt16(DicomTags.Columns, 0); _height = dataset.GetUInt16(DicomTags.Rows, 0); _bitsStored = dataset.GetUInt16(DicomTags.BitsStored, 0); _bitsAllocated = dataset.GetUInt16(DicomTags.BitsAllocated, 0); _highBit = dataset.GetUInt16(DicomTags.HighBit, (ushort)(_bitsStored - 1)); _samplesPerPixel = dataset.GetUInt16(DicomTags.SamplesPerPixel, 0); _pixelRepresentation = dataset.GetUInt16(DicomTags.PixelRepresentation, 0); _planarConfiguration = dataset.GetUInt16(DicomTags.PlanarConfiguration, 0); _photometricInterpretation = dataset.GetString(DicomTags.PhotometricInterpretation, String.Empty); _rescaleSlope = dataset.GetDouble(DicomTags.RescaleSlope, 1.0); _rescaleIntercept = dataset.GetDouble(DicomTags.RescaleIntercept, 0.0); _pixelDataItem = dataset.GetItem(DicomTags.PixelData); _hasPixelPadding = dataset.Contains(DicomTags.PixelPaddingValue); if (_hasPixelPadding) { DcmElement elem = dataset.GetElement(DicomTags.PixelPaddingValue); if (elem is DcmUnsignedShort) _pixelPaddingValue = (elem as DcmUnsignedShort).GetValue(); else if (elem is DcmSignedShort) { _pixelPaddingValue = (elem as DcmSignedShort).GetValue(); } else _pixelPaddingValue = MinimumDataValue; } }