def get_input(): output_data_path, tree_input_path = get_data_paths_from_args() classification_config = parse_classification_config() trees: List[nx.Graph] = [] for tree_path in Path(tree_input_path).glob("*/tree.graphml"): trees.append(nx.read_graphml(tree_path)) return output_data_path, trees, classification_config
def get_input(): output_data_path, tree_input_path = get_data_paths_from_args(inputs=1) classification_config = parse_classification_config() trees: List[nx.Graph] = [] ignored_patients = get_ignored_patients() print(ignored_patients) for tree_path in Path(tree_input_path).glob("*/tree.graphml"): if tree_path.parent.name not in ignored_patients: trees.append(nx.read_graphml(tree_path)) return output_data_path, trees, classification_config
def get_input(): output_data_path, tree_input_path = get_data_paths_from_args() trees: List[List[nx.Graph]] = [] for tree_path in Path(tree_input_path).glob("*"): pair = [] for name in ["tree.graphml", "tree_gt.graphml"]: if (tree_path / name).exists(): pair.append(nx.read_graphml(tree_path / name)) trees.append(pair) classification_config = parse_classification_config() return output_data_path, trees, classification_config
def get_input(): output_data_path, tree_input_path, render_path = get_data_paths_from_args( inputs=2) classification_config = parse_classification_config() for cc_dict in classification_config.values(): if "clustering_endnode" not in cc_dict: cc_dict["clustering_endnode"] = False trees: List[nx.Graph] = [] ignored_patients = get_ignored_patients() for tree_path in Path(tree_input_path).glob("*/tree.graphml"): if tree_path.parent.name not in ignored_patients: trees.append(nx.read_graphml(tree_path)) return output_data_path, trees, classification_config, render_path
for node_id in tree.nodes(): if node_id in allowed: if condition(tree, node_id): ids.append(node_id) else: allowed.update(bfs_successors.get(node_id, [])) return ids def is_lobe(tree: nx.Graph, node_id: int) -> bool: return re.fullmatch( r"[RL](Lower|Middle|Upper)Lobe", tree.nodes[node_id]["split_classification"]) is not None classification_config = parse_classification_config() def is_segment(tree: nx.Graph, node_id: int) -> bool: return classification_config.get( tree.nodes[node_id]["split_classification"], {}).get("clustering_endnode", False) def main(): ( output_data_path, reduced_model_path, distance_mask_path, tree_path, ) = get_data_paths_from_args(inputs=3)