public ClassifierPartitionTree3D() { builder = new AlphaPartitionTreeBuilderMinTree <float[], float>(new AlgebraRealFloat32(), new MaxTreeBuilderSingleQueue <float>()); topology = null; edge_model = null; node_detector = null; }
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); }
public AlphaPartitionTree3D( IAlphaPartitionTreeBuilder <ElementValueType, EdgeValueType> builder, ITopologyElementEdgeRaster <IRaster3DInteger> topology, IFunctionDissimilarity <ElementValueType, EdgeValueType> edge_function, IImageRaster <IRaster3DInteger, ElementValueType> image) { //TODO make sure topology matches image ElementValueType[] element_values = image.GetElementValues(false); tree = builder.BuildAlphaPartitionTree(topology, edge_function, element_values); }
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); }
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); }