Why does a specific nifti image cannot be unzipped when using niftiread? Tmpdir needs write permission and sufficient free space.

17 次查看(过去 30 天)
Hi,
I was using niftiread to load a .nii.gz file. It worked fine perfectly fine for other files except this one. It showed error message
"Error using images.internal.nifti.niftiFile/getUncompressedFileName (line 136)
Cannot unzip file. tempdir needs write permissions and sufficient free space.
Error in images.internal.nifti.niftiFile (line 45)
[filename, self.TempfileCleaners, ~] = self.getUncompressedFileName(firstFile);
Error in niftiread (line 66)
NF = images.internal.nifti.niftiFile(varargin{:});"
I used MATLAB2021b.
I had a few attempts:
1. Double checked the path and the file name. They are correct.
2. Use setenv() to change tempdir to my home directory, which I am sure I have the write permission and enough space. But it did not solve this problem.
3. I am able to open this image using image viewing tool (MRIcron, etc). But I cannot unzip it manually using 7zip.
This issue happened before, and I cannot figure it out all the times. If anyone can help me with it, I would highly appreciate it!

采纳的回答

Neha
Neha 2023-11-14
Hi Tongyao,
I understand that you are facing an error while using the "niftiread" function while loading a .nii.gz file. Since you have already confirmed that the file name and path are correct and that there are no permission or space related issues, you can try implementing the solution explained in the comments for this MATLAB Answer:
Hope this helps!

更多回答(1 个)

Ricardo Alonso
Ricardo Alonso 2024-4-6
Hello. This just happened to me.
In my case it was because the file wasn't really a compressed one, but uncompressed (.nii) that I copied with the wrong extension (.nii.gz).
Change its extension to .nii and try again.
I suspect this is your case because of your 3d point.

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by