### Install netneurotools from source Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs netneurotools by cloning the repository and then installing it locally. This method is useful for developers or when needing the latest unreleased version. ```bash git clone https://github.com/netneurolab/netneurotools.git cd netneurotools pip install . ``` -------------------------------- ### Install netneurotools from source (alternative) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs netneurotools from its source repository using pip. This is an alternative to cloning and installing locally, useful for developers wanting to install directly from a git URL. ```bash pip install git+https://github.com/netneurolab/netneurotools.git ``` -------------------------------- ### Install Mayavi from source Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs the Mayavi library by cloning its repository and installing directly from the source. This is useful for obtaining the latest development version or if standard installation fails. ```bash pip install git+https://github.com/enthought/mayavi.git ``` -------------------------------- ### Install Pysurfer from source Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs the Pysurfer library by cloning its repository and installing directly from the source. This method is recommended for developers or users needing the most recent Pysurfer code. ```bash pip install git+https://github.com/nipy/PySurfer.git ``` -------------------------------- ### Install netneurotools via pip Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs the netneurotools package directly from the Python Package Index (PyPI). This is the recommended method for most users and requires Python to be installed. ```bash pip install netneurotools ``` -------------------------------- ### Build VTK wheel from source Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Provides instructions for building the VTK Python wheel from source, which may be necessary for specific Python versions or when official wheels are unavailable. This involves cloning VTK, configuring the build, and then installing the generated wheel. ```bash git clone https://github.com/Kitware/VTK cd VTK mkdir build cd build PYBIN= cmake -GNinja -DVTK_BUILD_TESTING=OFF -DVTK_WHEEL_BUILD=ON -DVTK_PYTHON_VERSION=3 -DVTK_WRAP_PYTHON=ON -DPython3_EXECUTABLE=$PYBIN ../ # optionally, apt install ninja ninja $PYBIN setup.py bdist_wheel # to install pip install dist/vtk-*.whl ``` -------------------------------- ### Install Pysurfer, VTK, Mayavi dependencies Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs core dependencies for the deprecated Pysurfer plotting library, including VTK, Mayavi, and Pysurfer itself. These are typically installed via pip. ```bash pip install vtk mayavi pysurfer ``` -------------------------------- ### Install PyVista using Conda Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Sets up a new conda environment and installs PyVista, a plotting library required for certain netneurotools visualization functions. This is the recommended approach for PyVista installation. ```bash conda create -n plotting python=3.12 conda activate plotting conda install -c conda-forge pyvista ``` -------------------------------- ### Install Jupyter/Trame with PyVista dependencies Source: https://github.com/netneurolab/netneurotools/blob/main/docs/installation.rst Installs additional packages required for using PyVista within Jupyter notebooks, including jupyterlab, trame, and related extensions. This is an optional step for interactive environments. ```bash conda install -c conda-forge jupyterlab trame trame-vtk trame-vuetify trame-jupyter-extension ``` -------------------------------- ### Install Latest Development Version Source: https://github.com/netneurolab/netneurotools/blob/main/README.rst Installs the latest version of netneurotools directly from its GitHub repository. This is useful for users who want to access the most recent features or bug fixes before they are released to PyPI. ```bash pip install git+https://github.com/netneurolab/netneurotools.git ``` -------------------------------- ### Install Latest Stable Netneurotools Source: https://github.com/netneurolab/netneurotools/blob/main/README.rst Installs the most recent stable release of the netneurotools package directly from the Python Package Index (PyPI). This is the recommended method for general users. ```bash pip install netneurotools ``` -------------------------------- ### Install Older Version (0.2.X) Source: https://github.com/netneurolab/netneurotools/blob/main/README.rst Installs a specific older version of the netneurotools package, identified by the branch or tag '0.2.X' from its GitHub repository. This is for users who need compatibility with earlier versions or specific features from that release. ```bash pip install git+https://github.com/netneurolab/netneurotools.git@0.2.X ``` -------------------------------- ### General Statistics (netneurotools.stats) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Offers general statistical functions, including efficient Pearson correlation calculations, weighted correlations, and permutation testing for statistical inference. ```APIDOC netneurotools.stats: Correlations: efficient_pearsonr(x, y) Computes Pearson correlation efficiently. weighted_pearsonr(x, y, weights) Computes Pearson correlation with sample weights. make_correlated_xy(x, rho, n_samples) Generates two correlated random variables. Permutation Tests: permtest_1samp(data, perm_method='shuffle', n_perm=1000, seed=None) Performs a one-sample permutation test. permtest_rel(data1, data2, perm_method='shuffle', n_perm=1000, seed=None) Performs a paired-samples permutation test. permtest_pearsonr(x, y, perm_method='shuffle', n_perm=1000, seed=None) Performs a permutation test for Pearson correlation. Regressions: (No specific regression functions listed in the provided text, but the module is for general statistics.) ``` -------------------------------- ### Python Requirements for NetNeuroTools Source: https://github.com/netneurolab/netneurotools/blob/main/docs/requirements.txt This snippet lists the Python packages required for the netneurolab/netneurotools project. It specifies versions for Sphinx and related themes, along with other development tools like Pillow and pytest. ```python sphinx>=2.0 sphinx_rtd_theme sphinx-gallery pillow pytest-doctestplus sphinx_design ``` -------------------------------- ### Fetch Datasets (netneurotools.datasets) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides functions for automatically downloading various neuroimaging datasets and templates. These include standard brain atlases like fsaverage, HCP, CIVET, and curated datasets for specific research projects. ```APIDOC netneurotools.datasets: Fetch Datasets: fetch_fsaverage() Downloads the FreeSurfer average brain template. fetch_fsaverage_curated() Downloads curated versions of the FreeSurfer average brain template. fetch_hcp_standards() Downloads standard datasets from the Human Connectome Project. fetch_fslr_curated() Downloads curated datasets using the FSLR surface registration. fetch_civet() Downloads CIVET pipeline outputs. fetch_civet_curated() Downloads curated CIVET pipeline outputs. fetch_conte69() Downloads the Conte69 brain atlas. fetch_yerkes19() Downloads the Yerkes19 brain atlas. Fetch Atlases: fetch_cammoun2012() Downloads the Cammoun 2012 atlas. fetch_schaefer2018() Downloads the Schaefer 2018 atlas. fetch_mmpall() Downloads the MMPall atlas. fetch_pauli2018() Downloads the Pauli 2018 atlas. fetch_tian2020msa() Downloads the Tian 2020 MSA atlas. fetch_voneconomo() Downloads the von Economo atlas. Fetch Project-Related Data: fetch_vazquez_rodriguez2019() Downloads data from Vazquez-Rodriguez et al. (2019). fetch_mirchi2018() Downloads data from Mirchi et al. (2018). fetch_hansen_manynetworks() Downloads data from Hansen et al. (ManyNetworks). fetch_hansen_receptors() Downloads data from Hansen et al. (Receptors). fetch_hansen_genescognition() Downloads data from Hansen et al. (GeneScognition). fetch_hansen_brainstemfc() Downloads data from Hansen et al. (BrainstemFC). fetch_shafiei_megfmrimapping() Downloads data from Shafiei et al. (MEG-fMRI Mapping). fetch_shafiei_megdynamics() Downloads data from Shafiei et al. (MEG Dynamics). fetch_suarez_mami() Downloads data from Suarez et al. (MAMI). fetch_famous_gmat() Downloads data from Famous GMAT. fetch_neurosynth() Downloads data from Neurosynth. ``` -------------------------------- ### Modularity Analysis (netneurotools.modularity) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides functions for calculating and comparing network modularity partitions. Includes methods for label matching, assignment reordering, and consensus modularity detection. ```APIDOC netneurotools.modularity: Label Matching and Reordering: match_cluster_labels(labels1, labels2) Matches cluster labels between two sets of assignments. match_assignments(labels1, labels2) Matches community assignments between two partitions. reorder_assignments(labels) Reorders community assignments for consistency. Modularity Calculation and Comparison: find_consensus(partitions, method='randomized_refinement') Finds a consensus partition from multiple community detection results. consensus_modularity(partitions, method='randomized_refinement') Calculates the modularity of a consensus partition. zrand(labels1, labels2) Calculates the Z-rand index for comparing two partitions. get_modularity(A, partition) Calculates the modularity of a given partition for a network. get_modularity_z(A, partition) Calculates the Z-scored modularity of a partition. get_modularity_sig(A, partition, n_boot=1000) Calculates the significance of a partition's modularity via bootstrapping. ``` -------------------------------- ### Construct Networks (netneurotools.networks) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides functions for constructing and manipulating brain networks. This includes creating consensus networks from multiple sources and randomizing networks while preserving specific properties. ```APIDOC netneurotools.networks: Construct Consensus Networks: func_consensus(data, n_boot=1000, min_edges=100, n_jobs=1) Computes consensus functional connectivity networks. struct_consensus(data, n_boot=1000, min_edges=100, n_jobs=1) Computes consensus structural connectivity networks. Randomize Networks: randmio_und(A, iter=1000, seed=None) Performs a Watts-Strogatz style random rewiring for undirected networks. match_length_degree_distribution(A, iter=1000, seed=None) Randomizes a network to match degree distribution while preserving edge lengths. strength_preserving_rand_sa(A, iter=1000, seed=None) Randomizes a weighted undirected network preserving strength distribution using simulated annealing. strength_preserving_rand_sa_mse_opt(A, iter=1000, seed=None) Optimized version of strength-preserving randomization using simulated annealing. strength_preserving_rand_sa_dir(A, iter=1000, seed=None) Randomizes a weighted directed network preserving strength distribution. Convenient Functions: binarize_network(A, threshold=0.0) Binarizes a network matrix based on a threshold. threshold_network(A, threshold=0.0, copy=True) Thresholds a network matrix, setting values below threshold to zero. ``` -------------------------------- ### NetNeuroTools Experimental Functions Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Contains functions currently in an alpha stage of development. These may be experimental or subject to change. ```APIDOC netneurotools.experimental: (No specific functions listed in the provided documentation, but module exists for alpha features.) ``` -------------------------------- ### NetNeuroTools Interface Functions Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides utilities for interfacing with external data formats and tools, including CIFTI, FreeSurfer, and GIFTI files. These functions facilitate data extraction and manipulation for neuroimaging analysis. ```APIDOC netneurotools.interface: vertices_to_parcels(vertices, parcels) Maps vertex indices to parcel labels. Parameters: vertices: Array-like, vertex indices. parcels: Array-like, parcel assignments for vertices. Returns: Array-like, parcel labels for input vertices. parcels_to_vertices(parcels, parcel_labels) Maps parcel labels to vertex indices. Parameters: parcels: Array-like, parcel assignments for vertices. parcel_labels: Array-like, unique parcel labels. Returns: Dictionary, mapping parcel labels to vertex indices. describe_cifti(cifti_file) Provides metadata and structure information for a CIFTI file. Parameters: cifti_file: Path to the CIFTI file. Returns: Dictionary containing CIFTI file information. extract_cifti_volume(cifti_file, volume_idx=0) Extracts volumetric data from a CIFTI file. Parameters: cifti_file: Path to the CIFTI file. volume_idx: Index of the volume to extract. Returns: NumPy array of volumetric data. extract_cifti_surface(cifti_file, surf_idx=0) Extracts surface data from a CIFTI file. Parameters: cifti_file: Path to the CIFTI file. surf_idx: Index of the surface data to extract. Returns: NumPy array of surface data. extract_cifti_labels(cifti_file, label_idx=0) Extracts label information from a CIFTI file. Parameters: cifti_file: Path to the CIFTI file. label_idx: Index of the label information to extract. Returns: Array-like, label information. extract_cifti_surface_labels(cifti_file, surf_idx=0, label_idx=0) Extracts surface data and corresponding labels from a CIFTI file. Parameters: cifti_file: Path to the CIFTI file. surf_idx: Index of the surface data. label_idx: Index of the label information. Returns: Tuple of (surface_data, labels). deconstruct_cifti(cifti_file) Deconstructs a CIFTI file into its constituent parts. Parameters: cifti_file: Path to the CIFTI file. Returns: Dictionary of deconstructed CIFTI components. extract_annot_labels(annot_file, label_file) Extracts labels from a FreeSurfer annotation file. Parameters: annot_file: Path to the FreeSurfer annotation file. label_file: Path to the FreeSurfer label file. Returns: Tuple of (label_ids, label_names, label_colors). extract_gifti_labels(gifti_file) Extracts label information from a GIFTI file. Parameters: gifti_file: Path to the GIFTI file. Returns: Array-like, label information from GIFTI file. ``` -------------------------------- ### Plotting Functions (netneurotools.plotting) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Offers various functions for visualizing brain data and networks using different plotting libraries. Includes support for PyVista, PySurfer (deprecated), and Matplotlib. ```APIDOC netneurotools.plotting: Pyvista: pv_plot_surface(surf_mesh, scalars=None, cmap='viridis', **kwargs) Plots a surface mesh with optional scalar data using PyVista. PySurfer (deprecated): plot_conte69(data, surf='fsaverage', hemi='lh', **kwargs) Plots data on the Conte69 surface using PySurfer. plot_fslr(data, surf='fsaverage', hemi='lh', **kwargs) Plots data on the FSLR surface using PySurfer. plot_fsaverage(data, surf='fsaverage', hemi='lh', **kwargs) Plots data on the fsaverage surface using PySurfer. plot_fsvertex(data, surf='fsaverage', hemi='lh', **kwargs) Plots vertex data on a surface using PySurfer. Matplotlib: plot_point_brain(coords, values, cmap='viridis', **kwargs) Plots data points on a 2D representation of a brain. plot_mod_heatmap(data, **kwargs) Plots a heatmap for modularity analysis results. Color & Colormap: available_cmaps() Lists all available colormaps. ``` -------------------------------- ### Graph Metrics (netneurotools.metrics) Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides a comprehensive suite of functions for calculating various graph-theoretic metrics on brain networks. Supports both unweighted and weighted, directed and undirected networks. ```APIDOC netneurotools.metrics: Brain Network Metrics: degrees_und(A) Calculates node degrees for an undirected network. degrees_dir(A) Calculates in- and out-degrees for a directed network. distance_wei_floyd(A) Computes all-pairs shortest path lengths for a weighted network using Floyd-Warshall. retrieve_shortest_path(A, source, target) Retrieves the shortest path between two nodes in a network. navigation_wu(A, source, target) Calculates navigation effort between two nodes using Wu's method. get_navigation_path_length(A, source, target) Calculates the path length for navigation between two nodes. communicability_bin(A) Calculates binary communicability for nodes. communicability_wei(A) Calculates weighted communicability for nodes. path_transitivity(A) Calculates the path transitivity of a network. search_information(A) Calculates search information for nodes. mean_first_passage_time(A) Calculates the mean first passage time for nodes. diffusion_efficiency(A) Calculates diffusion efficiency of a network. resource_efficiency_bin(A) Calculates binary resource efficiency for nodes. flow_graph(A) Calculates flow graph metrics. assortativity_und(A) Calculates assortativity for an undirected network. assortativity_dir(A) Calculates assortativity for a directed network. matching_ind_und(A) Calculates index of maximum matching for an undirected network. rich_feeder_peripheral(A) Calculates rich-feeder and peripheral node metrics. Network Spreading: simulate_atrophy(A, n_nodes, n_steps, p_spread=0.5, seed=None) Simulates a spreading process (e.g., atrophy) on a network. Statistical Network Metrics: network_pearsonr(A1, A2) Computes the Pearson correlation between two network adjacency matrices. network_pearsonr_pairwise(A1, A2) Computes pairwise Pearson correlations between edges of two networks. effective_resistance(A) Calculates effective resistance between all pairs of nodes. network_polarisation(A) Calculates network polarization. network_variance(A) Calculates network variance. network_covariance(A1, A2) Calculates network covariance between two adjacency matrices. ``` -------------------------------- ### NetNeuroTools Spatial Statistics Functions Source: https://github.com/netneurolab/netneurotools/blob/main/docs/api.rst Provides functions for calculating spatial statistics, including Moran's I, Geary's C, and Lee's I, along with their local variants. These functions are essential for analyzing spatial autocorrelation in neuroimaging data. ```APIDOC netneurotools.spatial: morans_i(data, coords, weights=None) Calculates global Moran's I. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Global Moran's I statistic. local_morans_i(data, coords, weights=None) Calculates local Moran's I. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Local Moran's I statistics. gearys_c(data, coords, weights=None) Calculates global Geary's C. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Global Geary's C statistic. local_gearys_c(data, coords, weights=None) Calculates local Geary's C. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Local Geary's C statistics. lees_i(data, coords, weights=None) Calculates global Lee's I. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Global Lee's I statistic. local_lees_i(data, coords, weights=None) Calculates local Lee's I. Parameters: data: Array-like, spatial data. coords: Array-like, coordinates of data points. weights: Array-like, optional spatial weights matrix. Returns: Local Lee's I statistics. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.