Inheritance: IByteBuffer, IDisposable
Esempio n. 1
0
		private ColorPixelData24(int width, int height, byte[] data) {
			_width = width;
			_height = height;
            _buffer = new MappedFileBuffer(data);
		}
Esempio n. 2
0
 private GrayscalePixelDataU32(int width, int height, uint[] data) {
     _width = width;
     _height = height;
     _buffer = new MappedFileBuffer(Dicom.IO.ByteConverter.ToByteBuffer<uint>(data).Data);
 }
Esempio n. 3
0
		public ColorPixelData24(int width, int height, IByteBuffer data) {
			_width = width;
			_height = height;
            _buffer = new MappedFileBuffer(data.Data);
		}
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
		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);
		}
Esempio n. 7
0
		private GrayscalePixelDataU8(int width, int height, byte[] data) {
			_width = width;
			_height = height;

            _buffer = new MappedFileBuffer(data);
            //_data = data;
		}
Esempio n. 8
0
		public GrayscalePixelDataU8(int width, int height, IByteBuffer data) {
			_width = width;
			_height = height;

            _buffer = new MappedFileBuffer(data.Data);
		}