Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

pyCorr Nifti Matching in Python

Vanessa Sochat Update: September 5, 2011


pyCorr is a script that matches user specified images to a template. The applied usage that I created it for was to match group functional networks created with group independent component analysis (gica, via a but you could use it for any matching needs that you might have.

Scripts Takes a single column list of subjects (–input.txt: a column of complete paths to each subject folder that contains all images that are candidates for being matched) and a single template image to be matched to (–template=) and a list of images that each subject has in their specified folder (–images=) that should also be a single column text file. Lastly, specify an output folder (–output) where a text file with results will be generated. An overview of the method is as follows:

Read in images Find spots that meet some user specified threshold, convert coordinates to MNI space, call this list “template hotspots” Look up “template hotspots” in each image you are trying to match after converting MNI coordinates back to raw coordinate space For shared activation, add one to a shared activation voxel count, and add the value to a shared activation total Set all “template hotspots” equal to zero and then search for any remaining activation (activation in image but outside template) Create an equivalent unshared activation voxel count and value total Calculate an activation difference score Rank scores in descending order and choose top three I am still testing this algorithm, and it is subject to change!

SUBMISSION ON COMMAND LINE --subs=input.txt --template=/path/to/template/image/thresh_zstat27.nii.gz --images=images.txt --output=/path/to/output/folder Takes the text file output from and produce a stand alone folder to throw up on a web server with the matching results. the –report tag should point to the output from, the –template tag should be to some graphical representation of the template image, and the –oname tag should be the name that you want for the folder to contain the web report, which will be created in the present working directory (pwd).


python --report=thresh_zstat2.nii_bestcomps.txt --template=../groupmelodic.ica/report/IC_2_thresh.png --oname=thresh2 Modification

The intended usage is with output from the Melodic+ Dual Regression package, and this shouldn't be an issue with since the input file simply needs paths to folders with images to match. You can make the paths whatever you like, and the path to the template image can be whatever you like as well! The script, however, is expecting the names of the images to have a number in them (for example, zstat_thresh_1.nii.gz) and this number is used to look up the .png image in the original ica directory. Each .ica folder path in the output file from should end in .ica, and the script expects to find the .png for use in the web report under /stats/report (this is FSL's standard that I adopted for the ica+ package) within the subject directory. Feel free to modify the script as needed… I threw it together in about two days so it's pretty unsophisticated!


Nifti Template Matching in Python






No releases published


No packages published