private ColorPixelData24(int width, int height, byte[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data); }
private GrayscalePixelDataU32(int width, int height, uint[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer<uint>(data).Data); }
public ColorPixelData24(int width, int height, IByteBuffer data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data.Data); }
public GrayscalePixelDataU32(int width, int height, BitDepth bitDepth, IByteBuffer data) { _width = width; _height = height; var uintData = Dicom.IO.ByteConverter.ToArray<uint>(data); if (bitDepth.BitsStored != 32) { int mask = (1 << (bitDepth.HighBit + 1)) - 1; Parallel.For(0, uintData.Length, (int i) => { uintData[i] = (uint)(uintData[i] & mask); }); } _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer<uint>(uintData).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 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); }
private GrayscalePixelDataU8(int width, int height, byte[] data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data); //_data = data; }
public GrayscalePixelDataU8(int width, int height, IByteBuffer data) { _width = width; _height = height; _buffer = new MappedFileBuffer(data.Data); }