Example #1
0
        public void TestComputationIsotropicPixel()
        {
            double widthInPixels = 4;
            double heightInPixels = 3;
            double pixelAspectRatio = 1;
            double pixelSpacingWidth, pixelSpacingHeight;

            double testPixelSpacingWidth  = 1;
            double testPixelSpacingHeight = testPixelSpacingWidth * pixelAspectRatio;
            double testWidthInMm          = testPixelSpacingWidth * widthInPixels;
            double testHeightInMm         = testPixelSpacingHeight * heightInPixels;
            double lengthInMm             = Math.Sqrt(testWidthInMm * testWidthInMm + testHeightInMm * testHeightInMm);

            CalibrationTool.CalculatePixelSpacing(
                lengthInMm,
                widthInPixels,
                heightInPixels,
                pixelAspectRatio,
                out pixelSpacingWidth,
                out pixelSpacingHeight);

            Assert.AreEqual(1, pixelSpacingWidth, 1e-10);
            Assert.AreEqual(1, pixelSpacingHeight, 1e-10);
        }