### Config Module Usage Example Source: https://github.com/pennlinc/qsirecon/blob/main/AGENTS.md Demonstrates how to read settings from the config module and how to serialize/load configuration to/from disk. ```python from import config # Read a setting work_dir = config.execution.work_dir # Serialize to disk config.to_filename(path) # Load from disk (in a subprocess) config.load(path) ``` -------------------------------- ### Fetch Example BIDS Data Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.interfaces.freesurfer.md Fetches example BIDS data for testing and sets the current working directory. Requires the niworkflows library. ```python >>> import os >>> from niworkflows import data >>> data_root = data.get_bids_examples(variant='BIDS-examples-1-enh-ds054') >>> os.chdir(data_root) ``` -------------------------------- ### Running QSIRecon Container with Mounted Volumes Source: https://github.com/pennlinc/qsirecon/blob/main/docs/contributors.md Example of running the QSIRecon Docker container, mounting data, output, and the local qsirecon repository. This allows testing changes directly without rebuilding the image. ```bash $ docker run --rm -v $HOME/fullds005:/data:ro -v $HOME/dockerout:/out \ -v $HOME/projects/qsirecon/qsirecon:/usr/local/miniconda/lib/python3.10/site-packages/qsirecon:ro \ pennlinc/qsirecon:latest /data /out/out participant \ -w /out/work/ ``` -------------------------------- ### Default Atlases in QSIRecon Source: https://github.com/pennlinc/qsirecon/blob/main/docs/builtin_workflows.md Example of how to specify multiple default atlases for a connectivity matrix workflow. Ensure these atlases are available in your QSIRecon installation. ```bash --atlases 4S156Parcels 4S256Parcels 4S456Parcels Brainnetome246Ext AICHA384Ext Gordon333Ext AAL116 ``` -------------------------------- ### Run QSIRecon with Docker Source: https://github.com/pennlinc/qsirecon/blob/main/docs/installation.md Execute QSIRecon using a Docker container. Ensure Docker is installed and has sufficient memory allocated (6GB+ for Docker Desktop on macOS). Mount local directories for input data and output, and the Freesurfer license file. ```bash docker run -ti --rm \ -v /filepath/to/data/dir \ -v /filepath/to/output/dir \ -v ${FREESURFER_HOME}/license.txt:/opt/freesurfer/license.txt \ pennlinc/qsirecon:latest \ /filepath/to/data/dir /filepath/to/output/dir participant \ --fs-license-file /opt/freesurfer/license.txt \ --recon-spec pyafq_tractometry ``` -------------------------------- ### qsirecon.cli.workflow.build_boilerplate Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.cli.workflow.md Writes boilerplate configuration and setup files within an isolated multiprocessing environment to manage memory scope. ```APIDOC ## qsirecon.cli.workflow.build_boilerplate ### Description Write boilerplate in an isolated process. ### Method (Not specified, likely a function call) ### Parameters - **config_file**: (type not specified) - Description not specified. - **workflow**: (type not specified) - Description not specified. ``` -------------------------------- ### Installing Non-Python Dependencies in Dockerfile Source: https://github.com/pennlinc/qsirecon/blob/main/docs/contributors.md Add non-Python dependencies to the Docker image by including a RUN command in the Dockerfile. This example shows how to install a package using apt-get update and apt-get install. ```dockerfile RUN apt-get update && \ apt-get install -y ``` -------------------------------- ### qsirecon.utils.sentry.sentry_setup Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.utils.sentry.md Initializes and sets up the Sentry client for the application. ```APIDOC ## qsirecon.utils.sentry.sentry_setup() ### Description Sets up the Sentry client for the application. This function should be called during application initialization. ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_connectivity_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio connectivity workflow. ```APIDOC ## init_dsi_studio_connectivity_wf ### Description Initializes the DSI Studio connectivity workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### Pipeline-level Metadata Example Source: https://github.com/pennlinc/qsirecon/blob/main/docs/building_workflows.md Defines the name of the pipeline and lists additional computations based on anatomical images. ```yaml name: dsistudio_pipeline anatomical: - mrtrix_5tt_hsvs nodes: [] ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_recon_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio reconstruction workflow. ```APIDOC ## init_dsi_studio_recon_wf ### Description Initializes the DSI Studio reconstruction workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_autotrack_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio autotrack workflow. ```APIDOC ## init_dsi_studio_autotrack_wf ### Description Initializes the DSI Studio autotrack workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### init_qsirecon_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the main QSIrecon workflow. ```APIDOC ## init_qsirecon_wf ### Description Initializes the main QSIrecon workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_export_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio export workflow. ```APIDOC ## init_dsi_studio_export_wf ### Description Initializes the DSI Studio export workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### Mounting Repositories with Docker Source: https://github.com/pennlinc/qsirecon/blob/main/docs/contributors.md Use the -v flag with docker run to mount local repositories as source directories within the container for testing without rebuilding the image. Ensure the paths are correct for your local setup. ```bash -v $HOME/projects/qsirecon/qsirecon:/usr/local/miniconda/lib/python3.10/site-packages/qsirecon:ro -v $HOME/projects/nipype/nipype:/usr/local/miniconda/lib/python3.10/site-packages/nipype:ro ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_autotrack_registration_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio autotrack registration workflow. ```APIDOC ## init_dsi_studio_autotrack_registration_wf ### Description Initializes the DSI Studio autotrack registration workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### Add Description to Workflow Object Source: https://github.com/pennlinc/qsirecon/blob/main/docs/contributors.md This snippet shows how to add a description to a workflow object using the `__desc__` attribute. The description is formatted using Markdown and can include references to a Bibtex database. Ensure FSL is installed and its version is available. ```python workflow = Workflow(name=name) workflow.__desc__ = """\Head-motion parameters with respect to the DWI reference (transformation matrices, and six corresponding rotation and translation parameters) are estimated before any spatiotemporal filtering using `mcflirt` [FSL {fsl_ver}, @mcflirt]. """.format(fsl_ver=fsl.Info().version() or '') ``` -------------------------------- ### qsirecon.cli.run.main() Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.cli.run.md The main entry point for the qsirecon command-line interface. This function initiates the q-Space Image reconstruction workflows. ```APIDOC ## qsirecon.cli.run.main() ### Description Entry point for the q-Space Image reconstruction workflows. ### Signature main() ``` -------------------------------- ### QSIRecon Architecture Overview Source: https://github.com/pennlinc/qsirecon/blob/main/AGENTS.md Illustrates the execution flow from CLI to BIDS-compliant derivative outputs, detailing the roles of CLI, config, workflows, interfaces, utilities, reports, data, and tests. ```text CLI (parser.py / run.py) -> config singleton (config.py, serialized as ToML) -> workflow graph construction (workflows/*.py) -> Nipype interfaces (interfaces/*.py) -> BIDS-compliant derivative outputs ``` -------------------------------- ### qsirecon.workflows.base.init_qsirecon_wf() Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.workflows.base.md Organizes the execution of QSIrecon, creating a sub-workflow for each subject. ```APIDOC ## qsirecon.workflows.base.init_qsirecon_wf() ### Description Organizes the execution of QSIrecon, with a sub-workflow for each subject. ### Method (Not specified, likely a Python function call) ### Endpoint (Not applicable, Python function) ### Parameters (None specified) ### Response (Not specified) ``` -------------------------------- ### qsirecon.workflows.recon.dsi_studio.init_dsi_studio_tractography_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DSI Studio tractography workflow. ```APIDOC ## init_dsi_studio_tractography_wf ### Description Initializes the DSI Studio tractography workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### QSIRecon Command-Line Usage Source: https://github.com/pennlinc/qsirecon/blob/main/docs/quickstart.md Displays the full usage information for the QSIRecon command-line interface, including all available arguments and their descriptions. ```bash usage: qsirecon [-h] [--participant-label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--session-id SESSION_ID [SESSION_ID ...]] [-d PACKAGE=PATH [PACKAGE=PATH ...]] [--bids-filter-file FILE] [--bids-database-dir PATH] [--nprocs NPROCS] [--omp-nthreads OMP_NTHREADS] [--mem MEMORY_MB] [--low-mem] [--use-plugin FILE] [--sloppy] [--boilerplate-only] [--reports-only] [--report-output-level {root,subject,session}] [--infant] [--b0-threshold B0_THRESHOLD] [--output-resolution OUTPUT_RESOLUTION] [--fs-license-file PATH] --recon-spec RECON_SPEC [--input-type {qsiprep,ukb,hcpya}] [--fs-subjects-dir PATH] [--skip-odf-reports] [--recon-spec-aux-files RECON_SPEC_AUX_FILES] [--atlases ATLAS [ATLAS ...]] [--version] [-v] [-w WORK_DIR] [--resource-monitor] [--config-file FILE] [--write-graph] [--stop-on-first-crash] [--notrack] [--debug {pdb,all} [{pdb,all} ...]] input_dir output_dir {participant} ``` -------------------------------- ### qsirecon.utils.sentry.start_ping Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.utils.sentry.md Initiates a Sentry ping with the provided run UUID and partition number. ```APIDOC ## qsirecon.utils.sentry.start_ping(run_uuid, npart) ### Description Starts a Sentry ping to indicate activity or status for a given run. ### Parameters - **run_uuid**: The unique identifier for the run. - **npart**: The partition number. ``` -------------------------------- ### Build Singularity/Apptainer Image for QSIRecon Source: https://github.com/pennlinc/qsirecon/blob/main/docs/installation.md Build a Singularity/Apptainer image from the QSIRecon Docker repository. Replace with the specific version desired. Avoid 'latest' or 'unstable' for production use. ```bash apptainer build qsirecon-.sif docker://pennlinc/qsirecon: ``` -------------------------------- ### init_pyafq_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.workflows.recon.pyafq.md Initializes and runs the PyAFQ workflow to generate tract profiles from qsirecon outputs. ```APIDOC ## init_pyafq_wf ### Description Runs PyAFQ on some qsirecon outputs to generate tract profiles. ### Method Python Function ### Signature `qsirecon.workflows.recon.pyafq.init_pyafq_wf(inputs_dict, name='afq', qsirecon_suffix='', params={})` ### Parameters #### Arguments - **inputs_dict** (dict) - Dictionary containing qsirecon outputs. - **name** (str, optional) - Name for the workflow. Defaults to 'afq'. - **qsirecon_suffix** (str, optional) - Suffix for qsirecon outputs. Defaults to ''. - **params** (dict, optional) - Parameters for the PyAFQ workflow. Defaults to {}. ### Outputs - **profiles_csv** (file) - CSV file containing the tract profiles generated by pyAFQ. ``` -------------------------------- ### qsirecon.workflows.recon.dipy.init_dipy_brainsuite_shore_recon_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.workflows.recon.dipy.md Initializes a Dipy reconstruction workflow using the 3dSHORE method with a Brainsuite-style basis set to reconstruct EAPs and ODFs. ```APIDOC ## qsirecon.workflows.recon.dipy.init_dipy_brainsuite_shore_recon_wf ### Description Reconstructs EAPs, ODFs, using 3dSHORE (brainsuite-style basis set). ### Method Signature qsirecon.workflows.recon.dipy.init_dipy_brainsuite_shore_recon_wf(inputs_dict, name='dipy_3dshore_recon', qsirecon_suffix='', params={}) ### Parameters #### Inputs * **inputs_dict** (*dict*) – Dictionary containing the input node fields. #### Workflow Parameters * **name** (*str*) – Name of the workflow. Defaults to 'dipy_3dshore_recon'. * **qsirecon_suffix** (*str*) – Suffix for the qsirecon outputs. Defaults to ''. * **params** (*dict*) – Dictionary containing parameters for the reconstruction. * **write_fibgz** (bool) - True writes out a DSI Studio fib file. * **write_mif** (bool) - True writes out a MRTrix mif file with sh coefficients. * **convert_to_multishell** (str) - Either “HCP”, “ABCD”, or “lifespan” to resample the data with the specified scheme. * **radial_order** (int) - Radial order for spherical harmonics (even). * **zeta** (float) - Zeta parameter for basis set. * **tau** (float) - Diffusion parameter. Defaults to 4 * np.pi**2. * **regularization** (str) - Either “L2” or “L1”. Defaults to “L2”. * **lambdaN** (float) - LambdaN parameter for L2 regularization. Defaults to 1e-8. * **lambdaL** (float) - LambdaL parameter for L2 regularization. Defaults to 1e-8. * **regularization_weighting** (int or "CV") - L1 regularization weighting. Defaults to “CV” (use cross-validation). Can specify a static value. * **l1_positive_constraint** (bool) - Use positivity constraint. * **l1_maxiter** (int) - Maximum number of iterations for L1 optimization. Defaults to 1000. * **l1_alpha** (float) - Alpha parameter for L1 optimization. Defaults to 1.0. * **pos_grid** (int) - Grid points for estimating EAP. Defaults to 11. * **pos_radius** (float) - Radius for EAP estimation. Defaults to 20e-03. ### Outputs * **shore_coeffs** (*str*) – Path to the 3dSHORE coefficients. * **rtop** (*str*) – Path to the Voxelwise Return-to-origin probability. * **rtap** (*str*) – Path to the Voxelwise Return-to-axis probability. * **rtpp** (*str*) – Path to the Voxelwise Return-to-plane probability. ``` -------------------------------- ### Building a Local QSIRecon Docker Image Source: https://github.com/pennlinc/qsirecon/blob/main/docs/contributors.md Build a local Docker image named 'qsirecon' from within your working QSIRecon repository directory. This image can then be used in docker commands by replacing the official image name. ```bash ~/projects/qsirecon$ docker build -t qsirecon . ``` -------------------------------- ### init_dsi_studio_autotrack_registration_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.workflows.recon.dsi_studio.md Runs DSI Studio's AutoTrack method to create a map.gz file without saving bundles. This is useful for workflows requiring both fib and map files, leveraging GQI scalars for better registration. ```APIDOC ## qsirecon.workflows.recon.dsi_studio.init_dsi_studio_autotrack_registration_wf ### Description Run DSI Studio’s AutoTrack method to create a map.gz file. No bundles are saved. This workflow is designed to be used as input to other workflows that need both a fib and a map file (eg FOD Autotrack). The registration is better using GQI scalars than the imported FOD scalars. ### Inputs - **fibgz** (file): A DSI Studio fib file produced by DSI Studio reconstruction. ### Outputs - **fibgz** (file): The input fibgz file, unaltered. - **fibgz_map** (file): A map.gz file corresponding to the fibgz file. ``` -------------------------------- ### init_test_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes a test workflow. ```APIDOC ## init_test_wf ### Description Initializes a test workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### qsirecon.cli.workflow.build_workflow Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.cli.workflow.md Creates the Nipype Workflow, which represents the entire execution graph for data processing. ```APIDOC ## qsirecon.cli.workflow.build_workflow ### Description Create the Nipype Workflow that supports the whole execution graph. ### Method (Not specified, likely a function call) ### Parameters - **config_file**: (type not specified) - Description not specified. - **retval**: (type not specified) - Description not specified. ``` -------------------------------- ### qsirecon.workflows.recon.build_workflow.init_dwi_recon_workflow Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the DWI (Diffusion Weighted Imaging) reconstruction workflow. ```APIDOC ## init_dwi_recon_workflow ### Description Initializes the DWI (Diffusion Weighted Imaging) reconstruction workflow. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### qsirecon.workflows.recon.anatomical.init_register_fs_to_qsiprep_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes the workflow for registering FreeSurfer (FS) data to qsiprep. ```APIDOC ## init_register_fs_to_qsiprep_wf ### Description Initializes the workflow for registering FreeSurfer (FS) data to qsiprep. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not applicable. ### Response Not specified in the source text. ``` -------------------------------- ### build_documentation Function Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.utils.boilerplate.md Builds documentation for a given Nipype interface, focusing on inputs specified during initialization. ```APIDOC ### qsirecon.utils.boilerplate.build_documentation(interface) #### Description Build documentation for a given interface. This is only useful for inputs that are specified when the interface is initialized. It will not work for inputs that are set through workflow connections. It will work with either the original interface object or a Nipype Node. It has not been tested with MapNodes or JoinNodes. ``` -------------------------------- ### init_pyafq_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes a workflow for PyAFQ tractometry and visualization. ```APIDOC ## init_pyafq_wf ### Description Initializes a workflow for PyAFQ tractometry and visualization. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### init_qsirecon_to_fsl_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api/qsirecon.workflows.recon.converters.md Converts QSIRecon outputs (images, bval, bvec) to FSL standard orientation. ```APIDOC ## init_qsirecon_to_fsl_wf ### Description Converts QSIRecon outputs (images, bval, bvec) to FSL standard orientation. ### Method Not specified (likely a Python function call) ### Parameters - **inputs_dict** (dict) - Required - Dictionary containing input files. - **name** (string) - Optional - Defaults to 'qsirecon_to_fsl'. - **qsirecon_suffix** (string) - Optional - Defaults to ''. - **params** (dict) - Optional - Defaults to {}. ### Inputs (Not explicitly defined in source, likely inferred from workflow) ### Outputs (Not explicitly defined in source, likely inferred from workflow) ``` -------------------------------- ### Run QSIRecon with Apptainer Source: https://github.com/pennlinc/qsirecon/blob/main/docs/quickstart.md This command executes the QSIRecon workflow using Apptainer, specifying input and output directories, participant mode, working directory, number of threads, and the reconstruction specification. ```bash apptainer run \ --containall \ --writable-tmpfs \ -B "${PWD}" \ qsirecon-latest.sif \ "${PWD}/inputs/qsiprep" \ "${PWD}/results/qsirecon" \ participant \ -w "${PWD}/work" \ --nthreads 8 \ --omp-nthreads 8 \ --recon-spec dsi_studio_autotrack \ -v -v ``` -------------------------------- ### init_json_preproc_report_wf Source: https://github.com/pennlinc/qsirecon/blob/main/docs/api_reference.md Initializes a workflow to generate a JSON preprocessing report. ```APIDOC ## init_json_preproc_report_wf ### Description Initializes a workflow to generate a JSON preprocessing report. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### QSIRecon Atlas Directory Structure Source: https://github.com/pennlinc/qsirecon/blob/main/docs/builtin_workflows.md Illustrates the expected directory structure for atlases within the QSIRecon project, including dataset description and atlas files. ```bash qsirecon/ atlases/ dataset_description.json atlas-