예제 #1
0
    def __init__(self,
                 graph=-1,
                 graph_subsampling=100,
                 graph_subsampling_power=0.001,
                 graph_subsampling_constant=10,
                 cover_type="functional",
                 filter=0,
                 resolution=-1,
                 gain=0.33,
                 Voronoi_subsampling=1000,
                 mask=0,
                 color=0,
                 verbose=False,
                 input="point cloud"):

        if USE_GUDHI == False:
            raise ImportError("Error: Gudhi not imported")

        self.cc = gd.CoverComplex()
        self.cc.set_type("GIC")
        self.cc.set_mask(mask)
        self.cc.set_verbose(verbose)
        self.graph, self.graph_subsampling, self.graph_subsampling_constant, self.graph_subsampling_power = graph, graph_subsampling, graph_subsampling_constant, graph_subsampling_power
        self.cover_type, self.filter, self.resolution, self.gain, self.Voronoi_subsampling = cover_type, filter, resolution, gain, Voronoi_subsampling
        self.color, self.input = color, input
)
parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-c", "--coordinate", type=int, default=0)
parser.add_argument("-r", "--resolution", type=int, default=10)
parser.add_argument("-g", "--gain", type=float, default=0.3)
parser.add_argument(
    "-v",
    "--verbose",
    default=False,
    action="store_true",
    help="Flag for program verbosity",
)

args = parser.parse_args()

nerve_complex = gudhi.CoverComplex()
nerve_complex.set_verbose(args.verbose)

if nerve_complex.read_point_cloud(args.file):
    nerve_complex.set_type("Nerve")
    nerve_complex.set_color_from_coordinate(args.coordinate)
    nerve_complex.set_function_from_coordinate(args.coordinate)
    nerve_complex.set_graph_from_OFF()
    nerve_complex.set_resolution_with_interval_number(args.resolution)
    nerve_complex.set_gain(args.gain)
    nerve_complex.set_cover_from_function()
    nerve_complex.find_simplices()
    nerve_complex.write_info()
    simplex_tree = nerve_complex.create_simplex_tree()
    nerve_complex.compute_PD()
    if args.verbose: