# Error opening Nifti files

**URL:** https://discourse.paraview.org/t/error-opening-nifti-files/13565
**Category:** ParaView Support
**Created:** [December 19, 2023, 12:41pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565 "2023-12-19T12:41:21Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![mdk82jd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mdk82jd](https://discourse.paraview.org/u/mdk82jd)
#### Post date: [December 19, 2023, 12:41pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/1 "2023-12-19T12:41:22Z")

</div>

Hi,

I downloaded the most recent version of Paraview, and I’m unable to open nifti files (.nii.gz) that I can open with FSLeyes and ITKsnap. First, I open the folder and select “All files(\*)” because otherwise I can’t even see them. Then, when I click on the files, I try to open them with “Nifti Volume Reader”. Afterwards, I get the following error:

\*\* ERROR (nifti\_image\_read): failed to find header file for ‘/path/to/file.nii.gz’  
( 21.219s) [paraview] vtkNIfTIReader.cxx:203 ERR| vtkNIfTIReader (0x5dabd40): Read failed

Is there any way I can solve this? Thank you very much.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 20, 2023, 10:23am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/2 "2023-12-20T10:23:16Z")

</div>

Hi @mdk82jd

Please share your data

Best,

---

<div class="post-metadata">

### Author: ![mdk82jd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mdk82jd](https://discourse.paraview.org/u/mdk82jd)
#### Post date: [December 20, 2023, 10:35am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/3 "2023-12-20T10:35:02Z")

</div>

Hi,

I had problems with any .nii.gz. For example, [https://github.com/richardbeare/nifti\_paraview/blob/master/MNI152\_T1\_0.5mm.nii.gz](https://github.com/richardbeare/nifti_paraview/blob/master/MNI152_T1_0.5mm.nii.gz)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 20, 2023, 10:40am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/4 "2023-12-20T10:40:04Z")

</div>

You need to extract it first

`gunzip MNI152_T1_0.5mm.nii.gz`

 ![image](https://discourse.paraview.org/uploads/default/original/2X/9/90ce07d21707a1519ea2b2057ebd74ad930326f3.jpeg)

---

<div class="post-metadata">

### Author: ![mdk82jd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mdk82jd](https://discourse.paraview.org/u/mdk82jd)
#### Post date: [December 20, 2023, 10:56am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/5 "2023-12-20T10:56:25Z")

</div>

Hi,

You’re right. Unzipped nifti files can be open by paraview.

Is there any way to open .nii.gz files directly? I need to open files that, compressed, are 12GB.

Thanks!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 20, 2023, 1:03pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/6 "2023-12-20T13:03:16Z")

</div>

I’m afraid not, see this discussion though:

> [@Adding support for opening \*any\* archived single file](https://discourse.paraview.org/t/adding-support-for-opening-any-archived-single-file/13365/7):
>
> After some internal discussion, another potential solution emerged. Instead of relying on the vtkRessourceParser to abstract the decompression, going one layer deeper, to the filesystem, may prove more usefull to end users. Indeed, way too many formats rely on multiple file which would not be supported with the proposed implementation, as @Kenneth_Moreland pointed out. This new solution would be instead mounting the archive in the host filesystem in a temporary directory. This is a bit simil…

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 19, 2026, 9:14am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/7 "2026-03-19T09:14:33Z")

</div>

> [@mdk82jd](#):
>
> Nifti Volume Reader

sorry to dig this thread up…  
I wanted to open some .nii files too (I gunzip’ed them already), but I cannot find that reader in paraview 6.1 RC1?  
The .nii extension is not automatically recognized by paraview and I cannot find any hint for a plugin with that name?

---

<div class="post-metadata">

### Author: ![sherin.sugathan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sherin.sugathan/32/15264_2.png) [@sherin.sugathan](https://discourse.paraview.org/u/sherin.sugathan)
#### Post date: [March 19, 2026, 10:31am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/8 "2026-03-19T10:31:43Z")

</div>

> [@reox](#):
>
> e .nii files too (I gunzip’ed them already), but I cannot find that reader in paraview 6.1 RC1?  
> The .nii extension is not automatically recognized by paraview and I cannot find any hint for a plugin with that name?

**Tools → Manage Plugins**. Select **AnalyzeNifTIReaderWriter** and then hit “ **Load Selected”**.

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 19, 2026, 10:42am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/9 "2026-03-19T10:42:56Z")

</div>

Thanks! Silly me… I started search from N onwards and was not expecting that it is the 2nd plugin in the list 😃

Unfortunately, it seems not to work with my file:

```auto
terminate called after throwing an instance of 'std::bad_alloc'
  what(): std::bad_alloc
error: exception occurred: Subprocess aborted

```

The file is a 2.6GB image with int16 data inside.

---

<div class="post-metadata">

### Author: ![sherin.sugathan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sherin.sugathan/32/15264_2.png) [@sherin.sugathan](https://discourse.paraview.org/u/sherin.sugathan)
#### Post date: [March 19, 2026, 11:46am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/10 "2026-03-19T11:46:55Z")

</div>

I can help you test the nifti if you can share the file.

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 19, 2026, 11:54am UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/11 "2026-03-19T11:54:33Z")

</div>

Unfortunately, I cannot share the specific file, however, I created an empty file like this which gives the same error message:

```python
import SimpleITK as sitk
sitk.WriteImage(sitk.Image(1450, 1450, 667, sitk.sitkInt16), "foobaz.nii.gz")

```

[foobaz.nii.gz](https://discourse.paraview.org/uploads/short-url/9kw9ud3hpsE1dVoCMkUJF9XJUxl.gz) (2.6 MB)

---

<div class="post-metadata">

### Author: ![sherin.sugathan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sherin.sugathan/32/15264_2.png) [@sherin.sugathan](https://discourse.paraview.org/u/sherin.sugathan)
#### Post date: [March 19, 2026, 12:39pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/12 "2026-03-19T12:39:14Z")

</div>

> [@reox](#):
>
> ```auto
> import SimpleITK as sitk
> sitk.WriteImage(sitk.Image(1450, 1450, 667, sitk.sitkInt16), "foobaz.nii.gz")
> 
> ```

My paraview also crashes with the same error. I tried reducing the dimensions of the image and then it was able to load just fine. Please try that. So I think this is a problem of lack of memory thrown from the nifti reader. Solution would be to either to shrink your data dimensions or get more of those expensive golden memory sticks. 🙂

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 19, 2026, 12:50pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/13 "2026-03-19T12:50:08Z")

</div>

okay, thanks for testing!  
The server where I wanted to open the file has 1TB of RAM - if RAM is really the problem here, then the Nifty reader is really wasteful with resources… 😂

I simply converted the file to something else, like MHD, which works just fine, also with that size.

---

<div class="post-metadata">

### Author: ![sherin.sugathan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sherin.sugathan/32/15264_2.png) [@sherin.sugathan](https://discourse.paraview.org/u/sherin.sugathan)
#### Post date: [March 19, 2026, 1:44pm UTC](https://discourse.paraview.org/t/error-opening-nifti-files/13565/14 "2026-03-19T13:44:51Z")

</div>

Interesting! I just tried lowering the dimensions and it worked fine…that is what made me suspect memory in the first place. Glad switching formats did the trick. If you end up figuring out what caused the crash, definitely share it here 🙂
