Hoffman2:Scripts:gen movie.py

From Center for Cognitive Neuroscience
Revision as of 22:10, 14 August 2024 by Hwang (talk | contribs) (Created page with "==Purpose== To convert a 3D MRI image in nifti format to a movie. ==Setup Environment== To use this script, you need to load Anaconda module first and use conda environment ccn_py37<br> ccn_py37 contains nibabel which is need to read nifti files. ffmpeg is also needed for this script to run. module load anaconda3 conda activate /u/project/CCN/apps/conda/rh7/ccn_py37 module load ffmpeg/5.0.1 ==Usage/Help== To see the usage of this script ./gen_movie.py --help...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

To convert a 3D MRI image in nifti format to a movie.

Setup Environment

To use this script, you need to load Anaconda module first and use conda environment ccn_py37
ccn_py37 contains nibabel which is need to read nifti files. ffmpeg is also needed for this script to run.

 module load anaconda3
 conda activate /u/project/CCN/apps/conda/rh7/ccn_py37
 module load ffmpeg/5.0.1

Usage/Help

To see the usage of this script

./gen_movie.py --help usage: gen_movie.py [-h] -i INPUT [-o OUTDIR] [-b BIN] [-w WIN]

optional arguments:

 -h, --help            show this help message and exit
 -i INPUT, --input INPUT
                       Full path to input nii file
 -o OUTDIR, --outdir OUTDIR
                       Output directory for movie file
 -b BIN, --bin BIN     Number of bins used in histogram
 -w WIN, --win WIN     Window range

Example:

/u/project/ccn/apps/scripts/gen_movie.py -i /path/to/T1w_brain.nii.gz -o /path/to/output/ --win "0.05 0.995" --bin 100