Questions tagged [nibabel]

Nibabel is an open source python package for processing neuroimaging files. It supports processing of ANALYZE (plain, SPM99, SPM2 and later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT file formats.

Nibabel is an open source python package for processing neuroimaging files. It supports processing of ANALYZE (plain, SPM99, SPM2 and later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT file formats.

Resources

Nibabel

80 questions
0
votes
2 answers

Is it possible to turn a 3D array to coordinate system?

Is it possible to take a 3D array and and turn it into a coordinate system? My array consists of 0s and 1s. If the value is 1 I want to take the xyz coordinate. In the end I want to output all coordinates to a csv file. import nibabel as nib coord…
0
votes
0 answers

Create nifti volume with nifti images that have different voxel size

I have a question about creating nifti volume for biomedical images I usually use nibabel in python to load and create 3D nifti volume, but I recently have a group of images with alter slice thickness (odd number slices are 300 micron (0.3 mm/pixel)…
LGUMI
  • 23
  • 4
0
votes
1 answer

Clarification regarding BraTS dataset

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…
Naman Bansal
  • 191
  • 2
  • 13
0
votes
1 answer

Add a dimension to a nifti file

I have nifti file (.nii) with a shape of (112, 176, 112). I want to add another dimension to it so that it becomes (112, 176, 112, 3). When I try img2 = np.arange(img).reshape(112,176,112,3) I get an error. Is it possible to do this with np.reshape…
rzaratx
  • 756
  • 3
  • 9
  • 29
0
votes
0 answers

How to align Brain MRIs

I have a dataset of nifti files about Brain MRI performed to different patients and i've loaded them in Python using a library called Nibabel. Here a slice of an MRI taken from my dataset: As you can see this head is not perfectly aligned (in this…
AleWolf
  • 133
  • 1
  • 6
0
votes
1 answer

How to write the header information from a Nifti image into a csv?

I am new to the medical image processing. I am trying to read a Nifti image and write the header information into a csv file. import nibabel as nib img = nib.load("xxx.hdr.gz") hdr = img.header print(hdr)
0
votes
1 answer

Python program to calculate voxel count

I want to write a script to calculate voxel count using python. I have one main folder named "PET-CT" and inside this main folder there are 100 "mrn" sub-folder named as 12345, 43523, 73092,....... Inside each sub-folder there are other 3 "followup"…
0
votes
0 answers

Out of memory error in opening nifti file happens randomly

I'm trying to open a zipped nifty file using nibabel library (as nib) and the following code: img = nib.load (nifti_file) img_data = img.get_data () where nifti_file is a variable with the path to the file in the same directory. On the second line,…
0
votes
1 answer

Unzipping a .nii.gz file in python

I am using the nibabel package to load an image with 7 parcellations in it. It is a .nii.gz file and when I try to load it with nibable.load('image_file') I get the following error: File "", line 1 …
Angus Campbell
  • 563
  • 4
  • 19
0
votes
1 answer

Saving vector with complex components in a nifti file

I generate a 4D complex numpy array for example: numpy_array = np.tile(np.array([3, 4, 0], dtype=np.complex64), (100,100,100,1)) i want to save the numpy array as a nifti file I tried using vtk and SimpleITK, but both of them don't support complex…
Shay Levi
  • 21
  • 5
0
votes
2 answers

How to remove a modality from MRI image - Python Nibabel

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…
The Great
  • 7,215
  • 7
  • 40
  • 128
0
votes
1 answer

How to change pixDim in medical volumetric data using nibabel preferably or numpy or something else?

I am trying to train a model where one set of data contain a particular pixDim, whereas another set contains a different pixDim. I want to normalize both the voxel resolution and execute. Can we change the pixDim dimension of a volumetric data like…
Jyotirmay
  • 1,533
  • 3
  • 21
  • 41
0
votes
0 answers

Error 'WARNING' message when using Extractor from Deepbrain library

I receive this error (as follow) when trying to use Etractor from deepbrain library: WARNING:tensorflow:From C:\Users\myname\Anaconda3\lib\site-packages\deepbrain\extractor.py:19: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated…
Marco
  • 37
  • 1
  • 7
0
votes
1 answer

Saving nibabel images with voxel dimensions

Unable to set image voxel dimensions in NiftiHeader in nibabel. How to set particular voxel dimensions for a given image? I need to save the image with some particular voxel dimensions in nibabel. image = nib.load('some_image') c =…
BlackSpecter
  • 61
  • 2
  • 12
0
votes
0 answers

How can I figure out channel number of a Nifti file in python?

I work on deep learning with medical images and use nibabel package for reading .nii files in python. My code is shown below. import numpy as np from pylab import * import nibabel as nib img_path=r"C:\\Users\\Umit…
umitkilic
  • 327
  • 1
  • 4
  • 17