Example #1
0
        public void TestSimpleDataModalityLut()
        {
            const int    bitsStored       = 8;
            const bool   isSigned         = false;
            const double rescaleSlope     = 0.5;
            const double rescaleIntercept = 10;

            var modalityLutLinear = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            var simpleDataModalityLut =
                new SimpleDataModalityLut(modalityLutLinear.MinInputValue, modalityLutLinear.Data, modalityLutLinear.MinOutputValue, modalityLutLinear.MaxOutputValue, modalityLutLinear.GetKey(), modalityLutLinear.GetDescription());

            Assert.AreEqual(modalityLutLinear.MinInputValue, simpleDataModalityLut.MinInputValue, "MinInputValue");
            Assert.AreEqual(modalityLutLinear.MaxInputValue, simpleDataModalityLut.MaxInputValue, "MaxInputValue");
            Assert.AreEqual(modalityLutLinear.MinOutputValue, simpleDataModalityLut.MinOutputValue, "MinOutputValue");
            Assert.AreEqual(modalityLutLinear.MaxOutputValue, simpleDataModalityLut.MaxOutputValue, "MaxOutputValue");
            Assert.AreEqual(modalityLutLinear.GetKey(), simpleDataModalityLut.GetKey(), "Key");
            Assert.AreEqual(modalityLutLinear.GetDescription(), simpleDataModalityLut.GetDescription(), "Description");
            Assert.AreEqual(modalityLutLinear.Length, simpleDataModalityLut.Length, "Length");

            for (var n = -1; n < 256; ++n)
            {
                Assert.AreEqual(modalityLutLinear[n], simpleDataModalityLut[n], "Value @{0}", n);
            }

            simpleDataModalityLut.AssertLookupValues(-1, 256);
        }
		public void TestSimpleDataModalityLut()
		{
			const int bitsStored = 8;
			const bool isSigned = false;
			const double rescaleSlope = 0.5;
			const double rescaleIntercept = 10;

			var modalityLutLinear = new ModalityLutLinear(
				bitsStored,
				isSigned,
				rescaleSlope,
				rescaleIntercept);

			var simpleDataModalityLut =
				new SimpleDataModalityLut(modalityLutLinear.MinInputValue, modalityLutLinear.Data, modalityLutLinear.MinOutputValue, modalityLutLinear.MaxOutputValue, modalityLutLinear.GetKey(), modalityLutLinear.GetDescription());

			Assert.AreEqual(modalityLutLinear.MinInputValue, simpleDataModalityLut.MinInputValue, "MinInputValue");
			Assert.AreEqual(modalityLutLinear.MaxInputValue, simpleDataModalityLut.MaxInputValue, "MaxInputValue");
			Assert.AreEqual(modalityLutLinear.MinOutputValue, simpleDataModalityLut.MinOutputValue, "MinOutputValue");
			Assert.AreEqual(modalityLutLinear.MaxOutputValue, simpleDataModalityLut.MaxOutputValue, "MaxOutputValue");
			Assert.AreEqual(modalityLutLinear.GetKey(), simpleDataModalityLut.GetKey(), "Key");
			Assert.AreEqual(modalityLutLinear.GetDescription(), simpleDataModalityLut.GetDescription(), "Description");
			Assert.AreEqual(modalityLutLinear.Length, simpleDataModalityLut.Length, "Length");

			for (var n = -1; n < 256; ++n)
				Assert.AreEqual(modalityLutLinear[n], simpleDataModalityLut[n], "Value @{0}", n);

			simpleDataModalityLut.AssertLookupValues(-1, 256);
		}
        public void BitsStoredInvalid()
        {
            int    bitsStored       = 0;
            bool   isSigned         = false;
            double rescaleSlope     = 0.5;
            double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);
        }
Example #4
0
        public void BitsStoredInvalid()
        {
            const int    bitsStored       = 0;
            const bool   isSigned         = false;
            const double rescaleSlope     = 0.5;
            const double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            Assert.IsNull(lut);
        }
        public void Unsigned1()
        {
            int    bitsStored       = 1;
            bool   isSigned         = false;
            double rescaleSlope     = 1;
            double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            Assert.AreEqual(2, lut.Length);
            Assert.AreEqual(100, lut[0]);
            Assert.AreEqual(101, lut[1]);
        }
		public void TestWithModalityLut()
		{
			byte[] data = new byte[25];
			for (byte x = 0; x < 25; ++x)
			{
				data[x] = x;
			}

			ModalityLutLinear modalityLut = new ModalityLutLinear(8, true, 1.0, -10);
			GrayscalePixelData pixelData = new GrayscalePixelData(5, 5, 8, 8, 7, false, data);
			MinMaxPixelCalculatedLinearLut lut = new MinMaxPixelCalculatedLinearLut(pixelData, modalityLut);
			lut.MinInputValue = 0;
			lut.MaxInputValue = 255;

			Assert.AreEqual(lut.WindowWidth, 24);
			Assert.AreEqual(lut.WindowCenter, 2);
		}
		public void Unsigned1()
		{
			const int bitsStored = 1;
			const bool isSigned = false;
			const double rescaleSlope = 1;
			const double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored,
				isSigned,
				rescaleSlope,
				rescaleIntercept);

			Assert.AreEqual(2, lut.Length);
			Assert.AreEqual(100, lut[0]);
			Assert.AreEqual(101, lut[1]);
		}
Example #8
0
        public void Signed1()
        {
            const int    bitsStored       = 1;
            const bool   isSigned         = true;
            const double rescaleSlope     = 1;
            const double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            Assert.AreEqual(2, lut.Length);
            Assert.AreEqual(99, lut[-1]);
            Assert.AreEqual(100, lut[0]);
        }
		public void Signed1()
		{
			int bitsStored = 1;
			bool isSigned = true;
			double rescaleSlope = 1;
			double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored, 
				isSigned, 
				rescaleSlope, 
				rescaleIntercept);

			Assert.AreEqual(2, lut.Length);
			Assert.AreEqual(99, lut[-1]);
			Assert.AreEqual(100, lut[0]);
		}
Example #10
0
        public void Signed12()
        {
            const int    bitsStored       = 12;
            const bool   isSigned         = true;
            const double rescaleSlope     = 0.5;
            const double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            Assert.AreEqual(4096, lut.Length);
            Assert.AreEqual(-924, lut[-2048]);
            Assert.AreEqual(100, lut[0]);
            Assert.AreEqual(1123.5, lut[2047]);
        }
        public void Unsigned12()
        {
            int    bitsStored       = 12;
            bool   isSigned         = false;
            double rescaleSlope     = 0.5;
            double rescaleIntercept = 100;

            ModalityLutLinear lut = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            Assert.AreEqual(4096, lut.Length);
            Assert.AreEqual(100, lut[0]);
            Assert.AreEqual(1123.5, lut[2047]);
            Assert.AreEqual(2147.5, lut[4095]);
        }
        public void TestWithModalityLut()
        {
            byte[] data = new byte[25];
            for (byte x = 0; x < 25; ++x)
            {
                data[x] = x;
            }

            ModalityLutLinear              modalityLut = new ModalityLutLinear(8, true, 1.0, -10);
            GrayscalePixelData             pixelData   = new GrayscalePixelData(5, 5, 8, 8, 7, false, data);
            MinMaxPixelCalculatedLinearLut lut         = new MinMaxPixelCalculatedLinearLut(pixelData, modalityLut);

            lut.MinInputValue = 0;
            lut.MaxInputValue = 255;

            Assert.AreEqual(lut.WindowWidth, 24);
            Assert.AreEqual(lut.WindowCenter, 2);
        }
		public void Unsigned12()
		{
			const int bitsStored = 12;
			const bool isSigned = false;
			const double rescaleSlope = 0.5;
			const double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored,
				isSigned,
				rescaleSlope,
				rescaleIntercept);

			Assert.AreEqual(4096, lut.Length);
			Assert.AreEqual(100, lut[0]);
			Assert.AreEqual(1123.5, lut[2047]);
			Assert.AreEqual(2147.5, lut[4095]);
		}
Example #14
0
		public void TestSimpleLut()
		{
			int bitsStored = 8;
			bool isSigned = false;
			double rescaleSlope = 0.5;
			double rescaleIntercept = 10;

			ModalityLutLinear modalityLUT = new ModalityLutLinear(
				bitsStored,
				isSigned,
				rescaleSlope,
				rescaleIntercept);

			SimpleDataModalityLut simpleLut = 
				new SimpleDataModalityLut(modalityLUT.MinInputValue, modalityLUT.Data, modalityLUT.MinOutputValue, modalityLUT.MaxOutputValue, modalityLUT.GetKey(), modalityLUT.GetDescription()); 

			Assert.AreEqual(modalityLUT.MinInputValue, simpleLut.MinInputValue);
			Assert.AreEqual(modalityLUT.MaxInputValue, simpleLut.MaxInputValue);
			Assert.AreEqual(modalityLUT.MinOutputValue, simpleLut.MinOutputValue);
			Assert.AreEqual(modalityLUT.MaxOutputValue, simpleLut.MaxOutputValue);
			Assert.AreEqual(modalityLUT.GetKey(), simpleLut.GetKey());
			Assert.AreEqual(modalityLUT.GetDescription(), simpleLut.GetDescription());
			Assert.AreEqual(modalityLUT.Length, simpleLut.Length);
		}
        public void TestSimpleLut()
        {
            int    bitsStored       = 8;
            bool   isSigned         = false;
            double rescaleSlope     = 0.5;
            double rescaleIntercept = 10;

            ModalityLutLinear modalityLUT = new ModalityLutLinear(
                bitsStored,
                isSigned,
                rescaleSlope,
                rescaleIntercept);

            SimpleDataModalityLut simpleLut =
                new SimpleDataModalityLut(modalityLUT.MinInputValue, modalityLUT.Data, modalityLUT.MinOutputValue, modalityLUT.MaxOutputValue, modalityLUT.GetKey(), modalityLUT.GetDescription());

            Assert.AreEqual(modalityLUT.MinInputValue, simpleLut.MinInputValue);
            Assert.AreEqual(modalityLUT.MaxInputValue, simpleLut.MaxInputValue);
            Assert.AreEqual(modalityLUT.MinOutputValue, simpleLut.MinOutputValue);
            Assert.AreEqual(modalityLUT.MaxOutputValue, simpleLut.MaxOutputValue);
            Assert.AreEqual(modalityLUT.GetKey(), simpleLut.GetKey());
            Assert.AreEqual(modalityLUT.GetDescription(), simpleLut.GetDescription());
            Assert.AreEqual(modalityLUT.Length, simpleLut.Length);
        }
		public void BitsStoredInvalid()
		{
			const int bitsStored = 0;
			const bool isSigned = false;
			const double rescaleSlope = 0.5;
			const double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored,
				isSigned,
				rescaleSlope,
				rescaleIntercept);

			Assert.IsNull(lut);
		}
		public void BitsStoredInvalid()
		{
			int bitsStored = 0;
			bool isSigned = false;
			double rescaleSlope = 0.5;
			double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored, 
				isSigned, 
				rescaleSlope, 
				rescaleIntercept);
		}
		public void Signed12()
		{
			int bitsStored = 12;
			bool isSigned = true;
			double rescaleSlope = 0.5;
			double rescaleIntercept = 100;

			ModalityLutLinear lut = new ModalityLutLinear(
				bitsStored, 
				isSigned, 
				rescaleSlope, 
				rescaleIntercept);

			Assert.AreEqual(4096, lut.Length);
			Assert.AreEqual(-924, lut[-2048]);
			Assert.AreEqual(100, lut[0]);
			Assert.AreEqual(1123.5, lut[2047]);
		}
		public void TestLookupValues()
		{
			var lut = new ModalityLutLinear(15, true, 1.2345, -67.890);

			lut.AssertLookupValues(short.MinValue - 1, short.MaxValue + 1);
		}
Example #20
0
        public void TestLookupValues()
        {
            var lut = new ModalityLutLinear(15, true, 1.2345, -67.890);

            lut.AssertLookupValues(short.MinValue - 1, short.MaxValue + 1);
        }