Nifty script to crop an image by supplying a binary mask. Let's assume we have a brain scan and an associated binary mask like
We can crop the original image using
In [1]:
medpy_extract_sub_volume_by_example.py resources/flair.nii.gz output/cropped.nii.gz resources/brainmask.nii.gz
In [ ]: