### setup() Source: https://brainsuite.org/bstr/apidocs/reference/setup.html Configures the BrainSuite installation path by reading and writing to the bstr.ini file. ```APIDOC ## setup() ### Description Reads from and writes to the setup configuration file (bstr.ini) for bstr. This is usually called automatically upon package installation but can be executed manually. ### Parameters #### Arguments - **brainsuite_path** (string) - Optional - Path to the BrainSuite installation. - **quiet** (logical) - Optional - If FALSE, displays messages to the user. - **raise_error** (logical) - Optional - If TRUE, stops execution if the file does not exist. Defaults to FALSE. ``` -------------------------------- ### Verify bstr installation Source: https://brainsuite.org/bstr/installation.html Load the library and check the BrainSuite installation path to confirm successful setup. ```R library(bstr) ``` ```R get_brainsuite_install_path() ``` -------------------------------- ### Install bstr Locally on Windows (Forward Slash) Source: https://brainsuite.org/bstr/apidocs/index.html Install bstr from a local .tar.gz file on Windows using forward slashes in the path. Replace 'C:/path/to/' with the actual directory. Ensure 'devtools' is installed first. ```r install.packages('devtools') devtools::install_local('C:/path/to/bstr_0.5.2.tar.gz') ``` -------------------------------- ### Install bstr Locally on Windows (Double Backslash) Source: https://brainsuite.org/bstr/apidocs/index.html Install bstr from a local .tar.gz file on Windows using double backslashes in the path. Replace 'C:\path\to\' with the actual directory. Ensure 'devtools' is installed first. ```r install.packages('devtools') devtools::install_local('C:\\path\\to\\bstr_0.5.2.tar.gz') ``` -------------------------------- ### Install bstr Locally on Mac/Linux Source: https://brainsuite.org/bstr/apidocs/index.html Install bstr from a local .tar.gz file on macOS or Linux. Replace '/path/to/' with the actual directory where the file was downloaded. Ensure 'devtools' is installed first. ```r install.packages('devtools') devtools::install_local('/path/to/bstr_0.5.2.tar.gz') ``` -------------------------------- ### Install Graphviz (Optional) Source: https://brainsuite.org/nipype_installation Install Graphviz and its development headers, which are optional dependencies for Nipype. This step requires sudo privileges. ```bash sudo apt-get install graphviz libgraphviz-dev ``` -------------------------------- ### Call the setup function for bstr Source: https://brainsuite.org/bstr/apidocs/reference/setup.html This function is used to set up the bstr package. It can optionally take a path to the BrainSuite installation and control message display and error handling. ```R setup(brainsuite_path = NULL, quiet = FALSE, raise_error = TRUE) ``` -------------------------------- ### Install bstr via URL Source: https://brainsuite.org/bstr/apidocs/index.html Use this command to install bstr version 0.5.2 directly from the BrainSuite server. Ensure 'devtools' is installed first. ```r install.packages('devtools') devtools::install_url('http://brainsuite.org/wp-content/uploads/2024/09/bstr_0.5.2.tar.gz') ``` -------------------------------- ### Build and Install Cortical Extraction Tools Source: https://brainsuite.org/building Run the build script to compile libraries and routines, optionally installing them to the home directory. ```bash ./buildall.sh ``` ```bash ./buildall.sh install ``` -------------------------------- ### Install bstr from local folder on Windows Source: https://brainsuite.org/bstr/installation.html Install the package from a local file path on Windows, using either double backslashes or forward slashes. ```R install.packages('devtools') devtools::install_local('C:\\path\\to\\bstr_0.5.2.tar.gz') ``` ```R install.packages('devtools') devtools::install_local('C:/path/to/bstr_0.5.2.tar.gz') ``` -------------------------------- ### Verify BrainSuite Installation Source: https://brainsuite.org/nipype_installation After adding BrainSuite to your PATH, run the 'bse' command in the terminal. If instruction text appears, the installation and PATH configuration are successful. ```bash bse ``` -------------------------------- ### Run BDP with Default Settings Source: https://brainsuite.org/processing/diffusion/pipeline Example command to execute BDP with default settings on Windows. ```bash bdp.exe C:\Users\name\subject\diffusion_processing\subj1.bfc.nii.gz --nii C:\Users\name\subject\diffusion_processing\subj1.dwi.nii.gz -g C:\Users\name\subject\diffusion_processing\subj1.bvec -b C:\Users\name\subject\diffusion_processing\subj1.bval ``` -------------------------------- ### BDP Input File List Source: https://brainsuite.org/processing/diffusion/pipeline Example file structure for BDP processing inputs. ```text C:\Users\name\subject\diffusion_processing\subj1.bfc.nii.gz C:\Users\name\subject\diffusion_processing\subj1.dwi.nii.gz C:\Users\name\subject\diffusion_processing\subj1.bvec C:\Users\name\subject\diffusion_processing\subj1.bval ``` -------------------------------- ### Verify Anaconda Installation Source: https://brainsuite.org/nipype_installation Open a Python session by running 'python' in the terminal. If Anaconda is correctly installed and in your PATH, 'Anaconda' will appear in the header text. ```python python ``` -------------------------------- ### Example: Load SBA Data Source: https://brainsuite.org/bstr/apidocs/reference/load_bstr_data.html Example of loading surface-based analysis (SBA) data. Specify the subject directory, demographic CSV file, and hemisphere. Smoothing can also be applied. ```R my_sba_data <- load_bstr_data(type="sba", subjdir = "/path/to/my/subjectdirectory", csv = "/path/to/my/demographics.csv", hemi = "left", smooth = 2.5) ``` -------------------------------- ### Test Nipype BrainSuite Interface Installation Source: https://brainsuite.org/nipype_installation Open a Python session and attempt to import the brainsuite interface from nipype.interfaces. This import should run without errors if the installation was successful. ```python python from nipype.interfaces import brainsuite ``` -------------------------------- ### Example Usage of load_bstr_data_from_filelist Source: https://brainsuite.org/bstr/apidocs/reference/load_bstr_data_from_filelist.html Example of how to use the load_bstr_data_from_filelist function with specified paths for CSV, atlas, and mask file. The 'type' and 'file_col' arguments are also set. ```R if (FALSE) { my_data <- load_bstr_data_from_filelist( csv = "/path/to/my/demographics.csv", type="sba", file_col = "COL_NAME", atlast = "/path/to/atlas", maskfile = "/path/to/maskfile") } ``` -------------------------------- ### Run pialmesh via command line Source: https://brainsuite.org/processing/surfaceextraction/pial Example command for executing the pialmesh tool with required input, output, fraction, and mask files. ```bash pialmesh -i input_mesh.dfs -o output_mesh.dfs -f frac_file.nii.gz -m mask_file.nii.gz ``` -------------------------------- ### GET /get_brainsuite_path_from_bstr_ini Source: https://brainsuite.org/bstr/apidocs/reference/get_brainsuite_path_from_bstr_ini.html Retrieves the BrainSuite installation path directly from the bstr.ini configuration file. ```APIDOC ## GET /get_brainsuite_path_from_bstr_ini ### Description Retrieves the BrainSuite installation path from the bstr.ini configuration file. ### Method GET ### Endpoint /get_brainsuite_path_from_bstr_ini ``` -------------------------------- ### GET /get_brainsuite_install_path Source: https://brainsuite.org/bstr/apidocs/reference/get_brainsuite_install_path.html Retrieves the installation path for BrainSuite with options to control warning messages and error handling. ```APIDOC ## GET /get_brainsuite_install_path ### Description Retrieve the BrainSuite installation path. ### Method GET ### Endpoint /get_brainsuite_install_path ### Parameters #### Query Parameters - **quiet** (boolean) - Optional - Specifies whether warnings/messages should be displayed. - **raise_error** (boolean) - Optional - Specifies whether an exception should be raised. ``` -------------------------------- ### Navigate to Data Directory Source: https://brainsuite.org/tutorials/dtiexercise Change the current working directory to the location of the tutorial files. ```shell cd C:\Users\Joe\Downloads\BrainSuiteTutorialDWI ``` ```shell cd /Users/Joe/Downloads/BrainSuiteTutorialDWI ``` -------------------------------- ### Verify BrainSuite Installation Path Source: https://brainsuite.org/bstr/apidocs/index.html This function checks and displays the installation path of BrainSuite. It is used to verify that bstr can locate the BrainSuite installation. ```r get_brainsuite_install_path() ``` -------------------------------- ### Acquire Tutorial Data via Bash Source: https://brainsuite.org/nipype-cse Commands to download and extract the BrainSuite Nipype tutorial dataset into the user's Documents directory. ```bash curl http://users.bmap.ucla.edu/~jwong/BrainSuiteNipype_Tutorial.zip -o "BrainSuiteNipype_Tutorial.zip" unzip -o -qq BrainSuiteNipype_Tutorial.zip -d ~/Documents ``` -------------------------------- ### Install Nipype Developer Version Source: https://brainsuite.org/nipype_installation Navigate to the site-packages directory within your Anaconda installation and clone the Nipype repository. Then, install its requirements and develop the package. ```bash cd ~/anaconda*/lib/python*/site-packages/ git clone https://github.com/nipy/nipype.git cd nipype pip install -r requirements.txt python setup.py develop ``` -------------------------------- ### Clone Sample Data Repository Source: https://brainsuite.org/BIDS/walkthrough.html Clone the GitHub repository to download the sample data required for the walk-through demo. This method downloads approximately 776MB of data. ```bash git clone https://github.com/BrainSuite/BrainSuiteBIDSAppSampleData.git ``` -------------------------------- ### Install rmarkdown package Source: https://brainsuite.org/bstr/reproducepaper.html Install the rmarkdown package in the R console if it is not already available. ```R install.packages("rmarkdown") ``` -------------------------------- ### Validate BrainSuite installation path Source: https://brainsuite.org/bstr/apidocs/reference/is_valid_brainsute_install_path.html Use this function to verify if the provided string is a valid path to a BrainSuite installation. ```R is_valid_brainsute_install_path(brainsuite_path = "") ``` -------------------------------- ### Run BFP Binary from Bash Source: https://brainsuite.org/bfp Execute the BFP tool using its bash script. Provide the configuration file, input NIfTI files, study name, subject ID, and session ID as arguments. ```bash bfp.sh /home/ajoshi/bfp/supp_data/config.ini /home/ajoshi/sub-01_T1w.nii.gz /home/ajoshi/sub-01_rest.nii.gz /home/ajoshi/mystudy sub-01 rest 2 ``` -------------------------------- ### Set BrainSuite Installation Path in bstr.ini Source: https://brainsuite.org/bstr/apidocs/reference/set_brainsuite_path_in_bstr_ini.html Use this function to specify the directory where BrainSuite is installed. The `brainsuite_path` argument is required. ```R set_brainsuite_path_in_bstr_ini(brainsuite_path) ``` -------------------------------- ### Retrieve BrainSuite installation path Source: https://brainsuite.org/bstr/apidocs/reference/get_brainsuite_path_from_bstr_ini.html Call this function to programmatically determine the BrainSuite installation directory based on the bstr.ini file. ```R get_brainsuite_path_from_bstr_ini() ``` -------------------------------- ### Build Docker Image from Source Source: https://brainsuite.org/BIDS/installation.html Clone the repository and build the Docker image locally. Note that this is not recommended due to dependencies on third-party repositories. ```bash git clone https://github.com/bids-apps/BrainSuite.git cd BrainSuite docker build -t brainsuite . ``` -------------------------------- ### Initialize BstrRmdVolumeOutput Source: https://brainsuite.org/bstr/apidocs/reference/BstrRmdVolumeOutput.html Constructor for the BstrRmdVolumeOutput class. Sets the output directory. ```R BstrRmdVolumeOutput$new(outdir = "./") ``` -------------------------------- ### Check BrainSuite Installation Status Source: https://brainsuite.org/bstr/apidocs/reference/is_brainsute_installed.html Use this function to confirm that BrainSuite is installed and its configuration is valid. It checks for the existence of required atlas files and data by parsing the `bstr.ini` file. Set `quiet` to TRUE to suppress messages and `raise_error` to TRUE to throw an exception if the installation is invalid. ```R is_brainsute_installed(quiet = FALSE, raise_error = FALSE) ``` -------------------------------- ### Example svreg_make_atlas Execution (Mac/Linux) Source: https://brainsuite.org/processing/svreg/creating-custom-atlases This command shows how to execute svreg_make_atlas on Mac or Linux systems, providing the subject's file prefix and the atlas directory path, along with the -E flag for manually edited volumetric labels. ```bash ./svreg_make_atlas.sh ~/Documents/CustomAtlas/subj1 /Applications/BrainSuite16a1/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain -E ``` -------------------------------- ### Example svreg_make_atlas Execution (Windows) Source: https://brainsuite.org/processing/svreg/creating-custom-atlases This command illustrates how to run the svreg_make_atlas module on Windows, specifying the paths for the subject's data and the base atlas, and including the -E flag for edited labels. ```bash svreg_make_atlas.exe C:\Users\BrainSuiteUser\Documents\CustomAtlas\subj1 C:\Program Files\BrainSuite16a1\svreg\BCI-DNI_brain_atlas\BCI-DNI_brain -E ``` -------------------------------- ### Get Color Palette Function Signature Source: https://brainsuite.org/bstr/apidocs/reference/get_color_palette.html Call this function with the name of the colormap and the desired number of colors to get a hex color code list. ```R get_color_palette(cmap_name, N) ``` -------------------------------- ### Launch BrainSuite Dashboard with Singularity Source: https://brainsuite.org/BIDS/dashboard.html Starts the dashboard monitoring using Singularity, utilizing local host file system paths directly. ```bash singularity run bids_brainsuite_v23a.simg \ /path/to/local/input /path/to/local/output participant \ --stages DASHBOARD --localWebserver ``` -------------------------------- ### Launch BrainSuite Dashboard with Docker Source: https://brainsuite.org/BIDS/dashboard.html Starts a local web server for the dashboard using Docker, exposing port 9095 to the host. ```bash docker run -ti --rm \ -p 9095:9095 -v /path/to/local/bids/input/dataset/:/data:ro \ -v /path/to/local/output/:/output \ bids/brainsuite:v23a \ /data /output participant --stages DASHBOARD --localWebserver ``` -------------------------------- ### Initialize BstrRmdRoiOutput Source: https://brainsuite.org/bstr/apidocs/reference/BstrRmdRoiOutput.html Constructor for the BstrRmdRoiOutput class. Use this to create a new instance, optionally specifying an output directory. ```R BstrRmdRoiOutput$new(outdir = NULL) ``` -------------------------------- ### Retrieve BrainSuite installation path Source: https://brainsuite.org/bstr/apidocs/reference/get_brainsuite_install_path.html Use this function to locate the BrainSuite installation directory. Set quiet to TRUE to suppress messages and raise_error to FALSE to prevent exceptions. ```R get_brainsuite_install_path(quiet = TRUE, raise_error = FALSE) ``` -------------------------------- ### Initialize BstrRmdOutput Source: https://brainsuite.org/bstr/apidocs/reference/BstrRmdOutput.html Creates a new instance of the BstrRmdOutput class. ```R BstrRmdOutput$new(outdir = NULL) ``` -------------------------------- ### Check BrainSuite Installation Source: https://brainsuite.org/bstr/apidocs/reference/is_brainsute_installed.html Verifies the BrainSuite installation by checking for necessary atlas files, data, and valid paths in the bstr.ini configuration file. This function is typically called during package loading. ```APIDOC ## is_brainsute_installed ### Description Check if the BrainSuite installation is valid by verifying if the appropriate atlas files and data exist. This function is called from `.onLoad()` when the package is loaded. It opens `bstr.ini` and checks if all the paths are valid. ### Method NA (This appears to be an R function, not a typical REST API endpoint) ### Endpoint NA ### Parameters #### Arguments - **quiet** (boolean) - Optional - specifying whether warnings/messages should be displayed - **raise_error** (boolean) - Optional - specifying whether an exception should be raised ### Request Example NA ### Response NA (This function likely returns a boolean or raises an error based on the installation status.) ``` -------------------------------- ### Singularity Bind Mount Option Source: https://brainsuite.org/BIDS/group-level.html If your Singularity image cannot access local files, append the `--bind` argument with the relevant folder path to the `singularity run` command. ```bash --bind /path/to/folder ``` -------------------------------- ### Add Anaconda to System Path Source: https://brainsuite.org/nipype_installation Add Anaconda's bin directory to your system's PATH. This can be done during Anaconda installation or by editing your .bashrc file. Adjust 'anaconda2' or 'anaconda3' based on your installation. ```bash export PATH=/home/user/anaconda2/bin:$PATH ``` -------------------------------- ### Run BDP for ODF and Tensor Estimation Source: https://brainsuite.org/processing/diffusion/pipeline Example command to execute BDP with specific flags for ODF and tensor estimation. ```bash bdp.exe C:\Users\name\subject\diffusion_processing\subj1.bfc.nii.gz --FRT --FRACT --tensor --nii C:\Users\name\subject\diffusion_processing\subj1.dwi.nii.gz -g C:\Users\name\subject\diffusion_processing\subj1.bvec ``` -------------------------------- ### Launch BrainSuite Dashboard for AOMIC-PIOP1 (Local Web Server) Source: https://brainsuite.org/BIDS/paperoutput.html Launch the BrainSuite Dashboard for AOMIC-PIOP1 processing by starting a local web server. This command is used when the institution does not have a pre-existing web server. ```bash singularity run $BRAINSUITEBIDSAPP $AOMIC_PIOP1_INPUT $AOMIC_PIOP1_OUTPUT participant \ --QCdir $QCDIR_AOMIC_PIOP1 --stages DASHBOARD --localWebserver ``` -------------------------------- ### Example: Load ROI Data Source: https://brainsuite.org/bstr/apidocs/reference/load_bstr_data.html Example of loading region of interest (ROI) data. Specify the subject directory, demographic CSV file, ROI IDs, and the desired ROI measure (e.g., 'gmthickness'). ```R my_roi_data <- load_bstr_data(type="roi", subjdir = "/path/to/my/subjectdirectory", csv="/path/to/my/demographics.csv", roiids=501, roimeas="gmthickness") ``` -------------------------------- ### set_brainsuite_path_in_bstr_ini Source: https://brainsuite.org/bstr/apidocs/reference/set_brainsuite_path_in_bstr_ini.html Sets the BrainSuite installation path in the bstr.ini configuration file. ```APIDOC ## set_brainsuite_path_in_bstr_ini ### Description Sets the BrainSuite installation path in the bstr.ini configuration file. ### Parameters #### Arguments - **brainsuite_path** (string) - Required - Path to the BrainSuite installation ### Request Example set_brainsuite_path_in_bstr_ini("/path/to/brainsuite") ```