Esempio n. 1
0
        public void TestSimple0(IAlphaPartitionTreeBuilder <float, float> builder)
        {
            ImageRaster3D <float> image            = new ImageRaster3D <float>(2, 1, 1, new float [] { 0, 1 }, false);
            ITopologyElementEdge  element_topology = new TopologyElementRaster3D6Connectivity(image.Raster).GetElementEdgeRasterTopology();
            IFunctionDissimilarity <float, float> edge_function = new FunctionDistanceAbsoluteDifference();
            IAlphaPartitionTree <float>           tree          = builder.BuildAlphaPartitionTree(element_topology, edge_function, image.GetElementValues(false));

            Assert.AreEqual(1, tree.GetRealElementsIndexesWithMaxAlfa(0, 0.0f).Length);
            Assert.AreEqual(1, tree.GetFullElementsIndexesWithMaxAlfa(0, 0.0f).Length);
            Assert.AreEqual(2, tree.GetRealElementsIndexesWithMaxAlfa(0, 1.5f).Length);
            Assert.AreEqual(3, tree.GetFullElementsIndexesWithMaxAlfa(0, 1.5f).Length);
            Assert.AreEqual(1, tree.GetRealElementsIndexesWithMaxAlfa(1, 0.0f).Length);
            Assert.AreEqual(1, tree.GetFullElementsIndexesWithMaxAlfa(1, 0.0f).Length);
            Assert.AreEqual(2, tree.GetRealElementsIndexesWithMaxAlfa(1, 1.5f).Length);
            Assert.AreEqual(3, tree.GetFullElementsIndexesWithMaxAlfa(1, 1.5f).Length);
        }
Esempio n. 2
0
        public void TestTrivial1(IAlphaPartitionTreeBuilder <float, float> builder)
        {
            ImageRaster3D <float> image            = new ImageRaster3D <float>(10, 10, 10);
            ITopologyElementEdge  element_topology = new TopologyElementRaster3D6Connectivity(image.Raster).GetElementEdgeRasterTopology();
            IFunctionDissimilarity <float, float> edge_function = new FunctionDistanceAbsoluteDifference();
            IAlphaPartitionTree <float>           tree          = builder.BuildAlphaPartitionTree(element_topology, edge_function, image.GetElementValues(false));

            Assert.AreEqual(1000, tree.GetRealElementsIndexesWithMaxAlfa(0, 0).Length);
            Assert.AreEqual(3700, tree.GetFullElementsIndexesWithMaxAlfa(0, 0).Length);


            ToolsIOSerialization.SerializeToFile(@"E:\Data\Dropbox\Dropbox\TestData\Tree.blb", tree);
        }