nibabel

Clarification regarding BraTS dataset

[亡魂溺海] 提交于 2020-06-01 05:08:17
问题 I downloaded the BraTS dataset for my summer project. The dataset consisted of nii.gz files which I was able to open using nibabel library in Python. I used the following code: import os import numpy as np import nibabel as nib import matplotlib.pyplot as plat examplefile=os.path.join("mydatapath","BraTS19_2013_5_1_flair.nii.gz") img=nib.load(examplefile) print(img) this gave me the following output: <class 'nibabel.nifti1.Nifti1Image'> data shape (240, 240, 155) affine: [[ -1. 0. 0. -0.] [ 0

Swap axes of a 3D image in nilearn/numpy

为君一笑 提交于 2020-05-28 04:27:08
问题 I am working with some neuroimaging data and my dimensions for a scan is (100, 150, 100). I am currently working with the nibabel formatted file. Is there a nice way to swap the axes? For example, I want my image to be (100, 100, 150). I would preferable want this in the nibabel format, but if need be, I can get the image to a numpy ndarray and then do the work there as well. In this case, is there a nice way of doing this in numpy? Thank you for the help! 回答1: If you are using numpy use:

Swap axes of a 3D image in nilearn/numpy

情到浓时终转凉″ 提交于 2020-05-28 04:26:26
问题 I am working with some neuroimaging data and my dimensions for a scan is (100, 150, 100). I am currently working with the nibabel formatted file. Is there a nice way to swap the axes? For example, I want my image to be (100, 100, 150). I would preferable want this in the nibabel format, but if need be, I can get the image to a numpy ndarray and then do the work there as well. In this case, is there a nice way of doing this in numpy? Thank you for the help! 回答1: If you are using numpy use:

Swap axes of a 3D image in nilearn/numpy

寵の児 提交于 2020-05-28 04:26:11
问题 I am working with some neuroimaging data and my dimensions for a scan is (100, 150, 100). I am currently working with the nibabel formatted file. Is there a nice way to swap the axes? For example, I want my image to be (100, 100, 150). I would preferable want this in the nibabel format, but if need be, I can get the image to a numpy ndarray and then do the work there as well. In this case, is there a nice way of doing this in numpy? Thank you for the help! 回答1: If you are using numpy use:

How to remove a modality from MRI image - Python Nibabel

纵然是瞬间 提交于 2019-11-27 04:54:36
问题 I am trying to use MRI brain imaging data for deep learning model. Currently my image has 4 dimensions as shown below but I would like to retain only the T1c modality of the MRI image because my model input should only be 1 channel 3D MRIs (T1c). I did try to make use of the Nibabel package as shown below import nibabel as nib ff = glob.glob('imagesTr\*') a = nib.load(ff[0]) a.shape This returns the below output I am also pasting the header info of 'a' From this, which of the dimension is