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

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

            _buffer = new MappedFileBuffer(data.Data);
		}