1. Home
  2. High Performance Computing (HPC)
  3. NI Cluster
  4. Data
  5. Shared Neuroimaging Resources Guide: Templates & Atlases

Shared Neuroimaging Resources Guide: Templates & Atlases

This guide provides instructions for accessing shared neuroimaging reference templates and atlases stored on the cluster at /lab_data/hawk/resources/neuroimaging/.

1. Available Resources & Directory Paths

Resource File Path / Location Description
TemplateFlow Cache /lab_data/hawk/resources/neuroimaging/templateflow Central offline cache containing MNI152NLin2009cAsym and standard templates.
Glasser Atlas (Volumetric) /lab_data/hawk/resources/neuroimaging/atlases/glasser/ HCP-MMP1.0 converted to 3D NIfTI volume in MNI space (.nii.gz + labels).
Glasser Atlas (Surface) /lab_data/hawk/resources/neuroimaging/atlases/glasser/HCP-MMP1_32k_fs_LR.dlabel.nii Native CIFTI surface parcellation for fsLR_32k mesh analysis.

2. Environment Setup

You should route processing tools (such as fMRIPrep or QSIPrep) to use the shared TemplateFlow directory.

Add these environment variables to your ~/.bashrc file or load them inside your Slurm submission scripts:

Bash

# Point local Python pipelines to the shared TemplateFlow directory
export TEMPLATEFLOW_HOME=/lab_data/hawk/resources/neuroimaging/templateflow

# Bind environment variable for Singularity/Apptainer containers
export APPTAINERENV_TEMPLATEFLOW_HOME=/opt/templateflow
export SINGULARITYENV_TEMPLATEFLOW_HOME=/opt/templateflow

3. Preprocessing with fMRIPrep (Slurm Submission)

When running containerized pipelines via Apptainer/Singularity, bind the shared template directory into /opt/templateflow inside the container.

Bash

#!/bin/bash
#SBATCH --job-name=fmriprep_job
#SBATCH --nodes=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --time=12:00:00
#SBATCH --output=logs/fmriprep_%j.log

# 1. Load required modules (adjust according to system module names)
module load apptainer

# 2. Define environment variables
export TEMPLATEFLOW_HOME=/lab_data/hawk/resources/neuroimaging/templateflow
export APPTAINERENV_TEMPLATEFLOW_HOME=/opt/templateflow

# 3. Execute fMRIPrep using shared templates
apptainer run --cleanenv \
  -B /lab_data/hawk:/lab_data/hawk \
  -B /lab_data/hawk/resources/neuroimaging/templateflow:/opt/templateflow \
  /lab_data/hawk/software/fmriprep.sif \
  /lab_data/hawk/data/bids \
  /lab_data/hawk/data/derivatives \
  participant \
  --participant-label 01 \
  --output-spaces MNI152NLin2009cAsym:res-2 \
  --notrack

4. Extracting Brain Signals with the Glasser Atlas

Option A: 3D Volumetric NIfTI Signal Extraction (Python & Nilearn)

Use Nilearn to regress out confounds (motion, white matter, CSF) and extract timeseries across the 360 Glasser cortical regions:

Python

import numpy as np
import pandas as pd
from nilearn.maskers import NiftiLabelsMasker
from nilearn.connectome import ConnectivityMeasure

# Paths
func_file = "/lab_data/hawk/data/derivatives/fmriprep/sub-01/func/sub-01_task-rest_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz"
confounds_file = "/lab_data/hawk/data/derivatives/fmriprep/sub-01/func/sub-01_task-rest_desc-confounds_timeseries.tsv"
glasser_atlas = "/lab_data/hawk/resources/neuroimaging/atlases/glasser/HCP-MMP1_on_MNI152NLin2009cAsym.nii.gz"

# Configure Masker
masker = NiftiLabelsMasker(
    labels_img=glasser_atlas,
    standardize="zscore_sample",
    memory="nilearn_cache",
    verbose=0
)

# Extract confounds and transform BOLD data
confounds_df = pd.read_csv(confounds_file, sep='\t')
selected_confounds = confounds_df[['trans_x', 'trans_y', 'trans_z', 'rot_x', 'rot_y', 'rot_z', 'csf', 'white_matter']]

# Time-series shape: (n_volumes, 360)
time_series = masker.fit_transform(func_file, confounds=selected_confounds)

# Compute 360x360 Functional Connectivity correlation matrix
correlation_measure = ConnectivityMeasure(kind="correlation")
fc_matrix = correlation_measure.fit_transform([time_series])[0]

# Save output
np.save("sub-01_glasser_fc_matrix.npy", fc_matrix)

Option B: Surface/CIFTI Parcellation (Connectome Workbench)

If your output data is in CIFTI space (.dtseries.nii), use Connectome Workbench (wb_command):

Bash

wb_command -cifti-parcellate \
  /lab_data/hawk/data/derivatives/fmriprep/sub-01/func/sub-01_task-rest_space-fsLR_den-32k_bold.dtseries.nii \
  /lab_data/hawk/resources/neuroimaging/atlases/glasser/HCP-MMP1_32k_fs_LR.dlabel.nii \
  COLUMN \
  sub-01_task-rest_glasser_parcellated.ptseries.nii

5. Support & Troubleshooting

  • Missing Template Errors: If your pipeline attempts to connect to the internet to download a template, ensure TEMPLATEFLOW_HOME and APPTAINERENV_TEMPLATEFLOW_HOME are correctly exported in your submission script.

  • Permission Issues: All files under /lab_data/hawk/resources/neuroimaging/ are configured with read-only permissions (755) for all cluster users.

Updated on October 20, 2026
Was this article helpful?
Need Help?
Can't find the answer you're looking for?
Contact NI Support