GraphHabitatFeatures
Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- class GraphHabitatFeatures(include_single_habitat_graph: bool = True, include_pairwise_habitat_graph: bool = True, edge_method: Literal['centroid_distance', 'adjacency', 'min_distance'] = 'min_distance', distance_threshold: float = 5.0, adjacency_connectivity: Literal['face', 'edge', 'corner'] = 'corner', adjacency_min_voxels: int = 10, edge_weight: Literal['none', 'distance', 'inverse_distance', 'contact_voxels'] = 'none', min_region_voxels: int = 1, connectivity: Literal['face', 'full'] = 'full', erosion_radius: int = 0, node_method: Literal['uniform_grid', 'component'] = 'uniform_grid', subdivide_region_voxels: int = 1000, block_size: int = 8, block_min_coverage: float = 0.2, pairwise_include_intra_edges: bool = True, include_extended_metrics: bool = True, extended_min_nodes: int = 10, small_world_nrand: int = 100, small_world_niter: int = 100, rich_club_q: int = 100, graph_null_sampler: Literal['analytic', 'config', 'rewire'] = 'analytic', graph_null_device: str = 'auto')[source]
Bases:
objectGraph-topology features of one subject’s habitat map.
Default nodes are per-cell subregion centroids on a global VOI lattice (
node_method='uniform_grid',block_size=8voxels, not mm): each kept cube can contribute several nodes. Default edges connect cubes whose closest voxels are withindistance_threshold(edge_method='min_distance', default 5). There is no morphological erosion (erosion_radius=0). Passnode_method='component'for connected-component nodes, andedge_method='adjacency'for contact-voxel edges (defaultadjacency_min_voxels=10,adjacency_connectivity='corner').centroid_distanceconnects centroids withindistance_threshold. NetworkX-derived topology metrics are reported per habitat (single_h*columns) and per habitat pair (pair_h*_h*columns), covering degree/edge counts, density, components, modularity, clustering, path length, betweenness, assortativity, nearest-neighbor ratio, and – by default – efficiency, small-world sigma, rich-club, and node-distribution summaries. Size-dependent features carry VOI-normalized companions (*_norm/*_per_habitat_volume).The numeric definitions live in the L0 kernels
habit.kernels.habitat_graphand are identical to the established implementation this family was migrated from. LikeIthHabitatFeatures, columns are emitted for every id in the map’shabitat_ids(absent habitats yield zero-valued empty-graph metrics), so cohort tables have stable columns.- __init__(include_single_habitat_graph: bool = True, include_pairwise_habitat_graph: bool = True, edge_method: Literal['centroid_distance', 'adjacency', 'min_distance'] = 'min_distance', distance_threshold: float = 5.0, adjacency_connectivity: Literal['face', 'edge', 'corner'] = 'corner', adjacency_min_voxels: int = 10, edge_weight: Literal['none', 'distance', 'inverse_distance', 'contact_voxels'] = 'none', min_region_voxels: int = 1, connectivity: Literal['face', 'full'] = 'full', erosion_radius: int = 0, node_method: Literal['uniform_grid', 'component'] = 'uniform_grid', subdivide_region_voxels: int = 1000, block_size: int = 8, block_min_coverage: float = 0.2, pairwise_include_intra_edges: bool = True, include_extended_metrics: bool = True, extended_min_nodes: int = 10, small_world_nrand: int = 100, small_world_niter: int = 100, rich_club_q: int = 100, graph_null_sampler: Literal['analytic', 'config', 'rewire'] = 'analytic', graph_null_device: str = 'auto') None[source]
- __call__(subject: Subject, habitat_map: HabitatMap) FeatureTable[source]
Compute the graph-topology feature family for one subject.
- Parameters:
subject – Owning subject (labels suffice; intensities unused).
habitat_map – Habitat labels for that subject.
- Returns:
One-row table of graph-topology features keyed by subject id.