Created
June 8, 2018 15:01
-
-
Save mrajchl/6244a35c51f22ba926998f4c59e324fc to your computer and use it in GitHub Desktop.
Reading a .nii image with SimpleITK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SimpleITK as sitk | |
import numpy as np | |
# A path to a T1-weighted brain .nii image: | |
t1_fn = './brain_t1_0001.nii' | |
# Read the .nii image containing the volume with SimpleITK: | |
sitk_t1 = sitk.ReadImage(t1_fn) | |
# and access the numpy array: | |
t1 = sitk.GetArrayFromImage(sitk_t1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment