Questions tagged [nifti]

A data format used in biomedical imaging, proposed by the Neuroimaging Informatics Technology Initiative.

It can be used to represent the 2 current formats, NIfTI-1 or NIfTI-2, as well as the organization behind it, the Neuroimaging Informatics Technology Initiative.

179 questions
14
votes
1 answer

Create a .obj file from 3d array in python

My goal is to get a .obj file from a nifty (.nii) format using python, with the purpose of open it on Unity. I know that the "scikit-image" package has a module called "measure" which has the Marching cube algorithm implemented. I apply the marching…
Diego Orellana
  • 994
  • 1
  • 9
  • 20
14
votes
2 answers

Creating a nifti file from a numpy array

I have a numpy array that I would like to covert into a nifti file. Through the documentation it seems PyNIfTI used to do this with: image=NiftiImage(Array) However, PyNIfTI isn't supported anymore. NiBabel, the successor to…
Michelle
  • 143
  • 1
  • 1
  • 4
8
votes
1 answer

How to convert 3D numpy array to nifti image in nibabel?

From this question How to convert Nifti file to Numpy array? , I created a 3D numpy array of nifti image. I made some modifications to this array, like I changed depth of the array by adding padding of zeroes. Now I want to convert this array back…
Prvt_Yadav
  • 324
  • 1
  • 6
  • 20
8
votes
2 answers

How to convert Nifti file to Numpy array?

I have 3D array in Nifti file (.ii.gz) and I want to save it as a 3D numpy array. I used Nibabel to convert Numpy to Nifti1. Can I do the opposite?
Char
  • 1,635
  • 7
  • 27
  • 38
7
votes
1 answer

Inputting an obscure file type into tensorflow

I am currently trying to train a neural network model on MRI scan images. The images are in a NIfTI (.nii) file format which I don't believe tensorflow or keras has the inherent ability to read. I have a python package that allows me to read these…
6
votes
1 answer

What is difference between get_data and get_fdata in Nibabel library?

I'm working with Nibabel to read some .nii files. I came across different examples and some of them use get_data() function while some of them use get_fdata() function. I could not find what the difference is in their documentation (nibabel manuel).…
umitkilic
  • 327
  • 1
  • 4
  • 17
4
votes
4 answers

How to get images intensity matrix from Nifti images with Nibabel?

i'm new with NiBabel. I want to know how to get intensity matrix from a Nifti images with this library. I use the following script to get voxels: import nibabel as ni example_img = ni.load('myImage.nii') data = example_img.get_data() I thought at…
chaw359
  • 505
  • 1
  • 5
  • 14
4
votes
2 answers

How to write a color 3D NIfTI with NiBabel?

I've had no problem writing out 3D grayscale .nii files with nibabel and opening them in NIfTI viewers (Mango, MCIcron). However I haven't been able to write out 3D color, as each RGB plane is being interpreted as a different volume. E.g. the output…
Ken
  • 508
  • 1
  • 4
  • 15
4
votes
1 answer

What is 'originator' tag in nifti file?

I've a clear question. what is the 'originator' tag in nifti file? and how to must calculate this tag value?
AmiR Hossein
  • 163
  • 1
  • 11
3
votes
0 answers

OpenCv for NifTi files Python

I want to use openCV to create a mask for my Nifti pictures. I found how to show one picture with plot but not with openCV. Sadly I still haven't figured how. This is the link to the nifti image I tried this: img =…
Royal
  • 95
  • 1
  • 7
3
votes
1 answer

Decompress nifti medical image in gz format using python

I want to decompress a butch of nii.gz files in python so that they could be processed in sitk later on. When I decompress a single file manually by right-clicking the file and choosing 'Extract..', this file is then correctly interpreted by sitk (I…
Biba
  • 631
  • 9
  • 28
3
votes
2 answers

Loading a Nifti through Nibabel and using the shape function

I have a nifti file 1.nii.gz Now, i never dealt with nifti files. So, just opening it using this software i realized that a nii.gz is a sort of container that contains 3 arrays of 2d pictures. In fact, if i scroll the mouse i can see 448 2d…
AleWolf
  • 133
  • 1
  • 6
3
votes
1 answer

Aligning nifti files with different shape and q_offset values in header

I have a whole-body MRI scans with the header below: { dim : [ 3 320 260 96 1 0 0 0] pixdim : [1. 1.40625 1.40625 3. 0.00436 0. 0. 0. ] qoffset_x : -216.09375 qoffset_y :…
Jyotirmay
  • 1,533
  • 3
  • 21
  • 41
3
votes
1 answer

Change entire images slices of NIFTI in Python 3.7

I'm actually work on MRI images using Python. The image format is the NIFTI format I get how to visualise slices on x, y or z axe, but now, I want tu use Sobel filtering on each of them and create a new NIFTI image with those slices. For that: I…
Batfly
  • 33
  • 5
3
votes
1 answer

How to access individual time sample of .nii (NIFTI) format without loading fMRI big data?

I have access to The Human Connectome Project data where I have more than 1000 .nii files. In order to analyze them I need to load them as a numpy array which takes up a lot of memory. For example, consider the following codes: import nibabel as…
Saeed
  • 598
  • 10
  • 19
1
2 3
11 12