private GrayscalePixelDataU16(int width, int height, ushort[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer <ushort>(data).Data); }
public GrayscalePixelDataS16(int width, int height, BitDepth bitDepth, IByteBuffer data) { _bits = bitDepth; _width = width; _height = height; var shortData = Dicom.IO.ByteConverter.ToArray <short>(data); if (bitDepth.BitsStored != 16) { int sign = 1 << bitDepth.HighBit; int mask = (UInt16.MaxValue >> (bitDepth.BitsAllocated - bitDepth.BitsStored)); Parallel.For(0, shortData.Length, (int i) => { short d = shortData[i]; if ((d & sign) != 0) { shortData[i] = (short)-(((-d) & mask) + 1); } else { shortData[i] = (short)(d & mask); } }); } _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer <short>(shortData).Data); }
public GrayscalePixelDataU8(int width, int height, IByteBuffer data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data.Data); }
private GrayscalePixelDataU8(int width, int height, byte[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data); //_data = data; }
public GrayscalePixelDataU16(int width, int height, BitDepth bitDepth, IByteBuffer data) { _bits = bitDepth; _width = width; _height = height; var ushortData = Dicom.IO.ByteConverter.ToArray <ushort>(data); if (bitDepth.BitsStored != 16) { int mask = (1 << (bitDepth.HighBit + 1)) - 1; Parallel.For(0, ushortData.Length, (int i) => { ushortData[i] = (ushort)(ushortData[i] & mask); }); } _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer <ushort>(ushortData).Data); }
public GrayscalePixelDataS32(int width, int height, BitDepth bitDepth, IByteBuffer data) { _width = width; _height = height; var intData = Dicom.IO.ByteConverter.ToArray <int>(data); int sign = 1 << bitDepth.HighBit; uint mask = (UInt32.MaxValue >> (bitDepth.BitsAllocated - bitDepth.BitsStored)); Parallel.For(0, intData.Length, (int i) => { int d = intData[i]; if ((d & sign) != 0) { intData[i] = (int)-(((-d) & mask) + 1); } else { intData[i] = (int)(d & mask); } }); _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer <int>(intData).Data); }
public ColorPixelData24(int width, int height, IByteBuffer data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data.Data); }
private ColorPixelData24(int width, int height, byte[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data); }