Why does a specific nifti image cannot be unzipped when using niftiread? Tmpdir needs write permission and sufficient free space.
19 views (last 30 days)
Show older comments
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!
1 Comment
Walter Roberson
on 6 Nov 2023
Are you using linux? If so see the discussion at https://www.mathworks.com/matlabcentral/answers/1798895-invalid-cross-device-link-18-when-saving-a-file-on-arch-linux?s_tid=srchtitle
Accepted Answer
Neha
on 14 Nov 2023
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!
0 Comments
More Answers (1)
Ricardo Alonso
on 6 Apr 2024
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.
0 Comments
See Also
Categories
Find more on 3-D Volumetric Image Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!