Error in running 3-D Brain Tumor Segmentation Using Deep Learning

15 views (last 30 days)
I encounted an error while running the 3-D Brain Tumor Segmentation Using Deep Learning example.
It gives the following error
Error using matlab.io.datastore.ImageDatastore/read (line 77)
Error using ReadFcn @(x)(niftiread(x)>0) function handle for file
C:\Users\Jenni\AppData\Local\Temp\BraTS\Task01_BrainTumor\labelsTr\._BRATS_166.nii.gz.
Error using images.internal.nifti.niftiFile/getUncompressedFileName (line 130)
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{:});
Error in preprocessBraTSdataset>@(x)(niftiread(x)>0) (line 31)
labelReader = @(x) (niftiread(x) > 0);
Error in matlab.io.datastore.PixelLabelDatastore/readNumeric (line 854)
[L,info] = read(this.ImageDatastore);
Error in preprocessBraTSdataset (line 46)
outL = readNumeric(pxds);
Anyone knows how to fix this error? The code can be obtained here.
Thank you
  1 Comment
David Vaughan
David Vaughan on 20 Jan 2021
This error from niftiRead occurs when there is no java machine running.
You can check this using : usejava('jvm').
The displayed error message that tmpdir needs write permissions etc is misleading.
The error occurs when trying to niftiRead() a .nii.gz file, which calls gunzip(), which calls checkFilesDirinputs(). This last function throws an error if there is no active java machine, but (for me) the message that java is required for this function is never displayed - perhaps because of the multiple try/catch layers at that point.
For me, the fix was to lauch matlab as 'matlab -nodesktop' rather than 'matlab -nojvm -nodesktop'

Sign in to comment.

Answers (1)

Shashank Gupta
Shashank Gupta on 30 Sep 2019
Hi Jennifer,
Cannot unzip file. tempdir needs write permissions and sufficient free space
this stack of error suggest that “niftiread()” is not able to unzip “.nii.gz” file either because of the folder does not have a read/write permission or there is no sufficient space for the function to unzip the file in the CPU/GPU memory.
You can cross check this error by reading one or two “.nii” volumes through “ImageDatastore” function. If the error persists then check your administrator permission for the folder.
I hope this helps.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!