public void TestDistance3DOosterbroek0() { ImageRaster3D <bool> mask = CreateTestMask3D0(); ImageRaster3D <float> distance_true = new ImageRaster3D <float>(mask.Raster); ImageRaster3D <float> distance_test = new ImageRaster3D <float>(mask.Raster); float[] voxel_size = new float[] { 1, 1, 1 }; ToolsDistance.DistanceTransform3DMediumRBA(mask, voxel_size, distance_true); ToolsDistance.DistanceTransform3DOosterbroekRBA(mask, voxel_size, distance_test); for (int index = 0; index < distance_test.ElementCount; index++) { Assert.AreEqual(distance_true[index], distance_test[index]); } }
public void TestDistance3DOosterbroek1() { ImageRaster3D <bool> mask = CreateTestMask3D1(); ImageRaster3D <float> distance_true = new ImageRaster3D <float>(mask.Raster); ImageRaster3D <float> distance_test = new ImageRaster3D <float>(mask.Raster); float[] voxel_size = new float[] { 0.31f, 0.31f, 1.25f }; ToolsDistance.DistanceTransform3DMediumRBA(mask, voxel_size, distance_true); ToolsDistance.DistanceTransform3DOosterbroekRBA(mask, voxel_size, distance_test); float Tol = 0.1f; for (int index = 0; index < distance_test.ElementCount; index++) { Assert.IsTrue(Math.Abs(distance_true[index] - distance_test[index]) < Tol); } }