예제 #1
0
        private static void AssertComposedLut(IComposableLut[] luts, ComposedLut composedLut, LutValueRange lutRange)
        {
            Assert.AreEqual(lutRange.MinInputValue, composedLut.MinInputValue, "MinInputValue");
            Assert.AreEqual(lutRange.MaxInputValue, composedLut.MaxInputValue, "MaxInputValue");
            Assert.AreEqual(lutRange.MinOutputValue, composedLut.MinOutputValue, "MinOutputValue");
            Assert.AreEqual(lutRange.MaxOutputValue, composedLut.MaxOutputValue, "MaxOutputValue");

            var data = composedLut.Data;

            Assert.IsNotNull(data, "Data");

            var lutCount = luts.Length;

            for (var i = -65536; i < 65535; ++i)
            {
                double value = i;
                for (var j = 0; j < lutCount; ++j)
                {
                    value = luts[j][value];
                }

                var expectedValue = (int)Math.Round(value);
                Assert.AreEqual(expectedValue, composedLut[i], "LUT @{0}", i);

                if (i >= lutRange.MinInputValue && i <= lutRange.MaxInputValue)
                {
                    Assert.AreEqual(expectedValue, data[i - lutRange.MinInputValue], "Data @{0} (Value {1})", i - lutRange.MinInputValue, i);
                }
            }
        }
예제 #2
0
		public void TestClassic13Bit()
		{
			const bool isSigned = false;
			const int bitsStored = 13;

			var luts = new IComposableLut[]
			           	{
			           		new ModalityLutLinear(bitsStored, isSigned, 2.15, -100),
			           		new BasicVoiLutLinear(4963, 6920)
			           	};
			var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

			var composedLut = new ComposedLut(luts);

			AssertComposedLut(luts, composedLut, lutRange);
		}
예제 #3
0
		public void TestClassic16BitSigned()
		{
			const bool isSigned = true;
			const int bitsStored = 16;

			var luts = new IComposableLut[]
			           	{
			           		new ModalityLutLinear(bitsStored, isSigned, 1.15, -100.80),
			           		new BasicVoiLutLinear(16794, 0)
			           	};
			var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

			var composedLut = new ComposedLut(luts);

			AssertComposedLut(luts, composedLut, lutRange);
		}
예제 #4
0
        public void TestClassic13BitSigned()
        {
            const bool isSigned   = true;
            const int  bitsStored = 13;

            var luts = new IComposableLut[]
            {
                new ModalityLutLinear(bitsStored, isSigned, 2.15, -100),
                new BasicVoiLutLinear(4963, 0)
            };
            var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

            var composedLut = new ComposedLut(luts);

            AssertComposedLut(luts, composedLut, lutRange);
        }
예제 #5
0
        public void TestClassic16Bit()
        {
            const bool isSigned   = false;
            const int  bitsStored = 16;

            var luts = new IComposableLut[]
            {
                new ModalityLutLinear(bitsStored, isSigned, 1.15, -100.80),
                new BasicVoiLutLinear(16794, 6920)
            };
            var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

            var composedLut = new ComposedLut(luts);

            AssertComposedLut(luts, composedLut, lutRange);
        }
예제 #6
0
        public void Test16BitDisplay16BitSigned()
        {
            const bool isSigned   = true;
            const int  bitsStored = 16;

            var luts = new IComposableLut[]
            {
                new ModalityLutLinear(bitsStored, isSigned, 1.0145, 32767),
                new BasicVoiLutLinear(32743, 35314),
                new PresentationLutLinear(0, 65535)
            };
            var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

            var composedLut = new ComposedLut(luts);

            AssertComposedLut(luts, composedLut, lutRange);
        }
예제 #7
0
        public void TestSubnormal15BitSigned()
        {
            const bool   isSigned         = true;
            const int    bitsStored       = 15;
            const double rescaleSlope     = 0.000000153412;
            const double rescaleIntercept = 0;

            var luts = new IComposableLut[]
            {
                new ModalityLutLinear(bitsStored, isSigned, rescaleSlope, rescaleIntercept),
                new NormalizationLutLinear(rescaleSlope, rescaleIntercept),
                new BasicVoiLutLinear(12453, 6742)
            };
            var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

            var composedLut = new ComposedLut(luts);

            AssertComposedLut(luts, composedLut, lutRange);
        }
예제 #8
0
		private static void AssertComposedLut(IComposableLut[] luts, ComposedLut composedLut, LutValueRange lutRange)
		{
			Assert.AreEqual(lutRange.MinInputValue, composedLut.MinInputValue, "MinInputValue");
			Assert.AreEqual(lutRange.MaxInputValue, composedLut.MaxInputValue, "MaxInputValue");
			Assert.AreEqual(lutRange.MinOutputValue, composedLut.MinOutputValue, "MinOutputValue");
			Assert.AreEqual(lutRange.MaxOutputValue, composedLut.MaxOutputValue, "MaxOutputValue");

			var data = composedLut.Data;
			Assert.IsNotNull(data, "Data");

			var lutCount = luts.Length;
			for (var i = -65536; i < 65535; ++i)
			{
				double value = i;
				for (var j = 0; j < lutCount; ++j)
					value = luts[j][value];

				var expectedValue = (int) Math.Round(value);
				Assert.AreEqual(expectedValue, composedLut[i], "LUT @{0}", i);

				if (i >= lutRange.MinInputValue && i <= lutRange.MaxInputValue)
				{
					Assert.AreEqual(expectedValue, data[i - lutRange.MinInputValue], "Data @{0} (Value {1})", i - lutRange.MinInputValue, i);
				}
			}
		}
예제 #9
0
		public void Test16BitDisplay16BitSigned()
		{
			const bool isSigned = true;
			const int bitsStored = 16;

			var luts = new IComposableLut[]
			           	{
			           		new ModalityLutLinear(bitsStored, isSigned, 1.0145, 32767),
			           		new BasicVoiLutLinear(32743, 35314),
			           		new PresentationLutLinear(0, 65535)
			           	};
			var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

			var composedLut = new ComposedLut(luts);

			AssertComposedLut(luts, composedLut, lutRange);
		}
예제 #10
0
		public void TestSubnormal15BitSigned()
		{
			const bool isSigned = true;
			const int bitsStored = 15;
			const double rescaleSlope = 0.000000153412;
			const double rescaleIntercept = 0;

			var luts = new IComposableLut[]
			           	{
			           		new ModalityLutLinear(bitsStored, isSigned, rescaleSlope, rescaleIntercept),
			           		new NormalizationLutLinear(rescaleSlope, rescaleIntercept),
			           		new BasicVoiLutLinear(12453, 6742)
			           	};
			var lutRange = SyncMinMaxValues(luts, bitsStored, isSigned);

			var composedLut = new ComposedLut(luts);

			AssertComposedLut(luts, composedLut, lutRange);
		}