Example #1
0
        public void TestTrivial0(IAlphaPartitionTreeBuilder <float, float> builder)
        {
            ImageRaster3D <float> image            = new ImageRaster3D <float>();
            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).Length);
            Assert.AreEqual(1, tree.GetFullElementsIndexesWithMaxAlfa(0, 0).Length);
        }
Example #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);
        }
Example #3
0
        public void TestTrival0()
        {
            IMaxTreeBuilder <float> builder_max = new MaxTreeBuilderSingleQueue <float>();
            IAlphaPartitionTreeBuilder <float, float> builder_alfa_partition = new   AlphaPartitionTreeBuilderMinTree <float, float>(new AlgebraRealFloat32(), builder_max);

            ImageRaster3D <float> image            = new ImageRaster3D <float>();
            ITopologyElementEdge  element_topology = new TopologyElementRaster3D6Connectivity(image.Raster).GetElementEdgeRasterTopology();
            IFunctionDissimilarity <float, float> edge_function = new FunctionDistanceAbsoluteDifference();
            IAlphaPartitionTree <float>           tree          = builder_alfa_partition.BuildAlphaPartitionTree(element_topology, edge_function, image.GetElementValues(false));

            float [] values_input = new float [] { 555 };
            FilterAlfaPartitionMean <float> filter = new FilterAlfaPartitionMean <float>(new AlgebraRealFloat32());

            float[] values_filtered = filter.Filter(tree, values_input, 0, 0);
            Assert.AreEqual(555, values_filtered[0]);
        }
Example #4
0
        public void TestSimple1(IAlphaPartitionTreeBuilder <float, float> builder)
        {
            ImageRaster3D <float> image            = new ImageRaster3D <float>(9, 1, 1, new float[] { 1, 2, 2, 3, 4, 2, 4, 4, 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.5f).Length);
            Assert.AreEqual(5, tree.GetRealElementsIndexesWithMaxAlfa(0, 1.5f).Length);
            Assert.AreEqual(8, tree.GetRealElementsIndexesWithMaxAlfa(0, 2.5f).Length);
            Assert.AreEqual(9, tree.GetRealElementsIndexesWithMaxAlfa(0, 3.5f).Length);

            Assert.AreEqual(2, tree.GetRealElementsIndexesWithMaxAlfa(6, 0.5f).Length);
            Assert.AreEqual(2, tree.GetRealElementsIndexesWithMaxAlfa(6, 1.5f).Length);
            Assert.AreEqual(8, tree.GetRealElementsIndexesWithMaxAlfa(6, 2.5f).Length);
            Assert.AreEqual(9, tree.GetRealElementsIndexesWithMaxAlfa(6, 3.5f).Length);
        }
Example #5
0
        public void TestSimple0()
        {
            IMaxTreeBuilder <float> builder_max = new MaxTreeBuilderSingleQueue <float>();
            IAlphaPartitionTreeBuilder <float, float> builder_alfa_partition = new AlphaPartitionTreeBuilderMinTree <float, float>(new AlgebraRealFloat32(), builder_max);


            float[] values_input                   = new float[] { 1, 2, 2, 3, 4, 2, 4, 4, 1 };
            ImageRaster3D <float> image            = new ImageRaster3D <float>(9, 1, 1, values_input, false);
            ITopologyElementEdge  element_topology = new TopologyElementRaster3D6Connectivity(image.Raster).GetElementEdgeRasterTopology();
            IFunctionDissimilarity <float, float> edge_function = new FunctionDistanceAbsoluteDifference();
            IAlphaPartitionTree <float>           tree          = builder_alfa_partition.BuildAlphaPartitionTree(element_topology, edge_function, image.GetElementValues(false));


            FilterAlfaPartitionMean <float> filter = new FilterAlfaPartitionMean <float>(new AlgebraRealFloat32());
            int max_size = 1000;

            float[] values_filtered05 = filter.Filter(tree, values_input, max_size, 0.5f);
            float[] values_filtered15 = filter.Filter(tree, values_input, max_size, 1.5f);
            float[] values_filtered25 = filter.Filter(tree, values_input, max_size, 2.5f);
        }