Input folders or files do not contain specified file extensions:
19 views (last 30 days)
Emerson Nithiyaraj on 29 Oct 2019
I have a doubt regarding loading '.nii' (NIFTI) files in my CNN architecture for segmentation (I am using segnet architecture). I have attached the snapshot of the error and my code. I want to load my .nii file dataset inside imds . please suggest me any option.
Ajay Pattassery on 4 Nov 2019
Edited: Ajay Pattassery on 4 Nov 2019
Here if you do not define the ReadFcn explicitly, the default function used is imread() which is not supported for .nii extension.
Hence add ReadFcn as suggested by Walter Roberson.
pxds = pixelLabelDatastore(labelDir,classNames,labelIds,'FileExtensions','.nii','ReadFcn',sampleReadFcn);
imds = imageDatastore(imageDir,'FileExtensions','.nii','ReadFcn',sampleReadFcn);
The custom ReadFcn looks something like the following
function data = sampleReadFcn(filename)
data = niftiread(filename);
Refer here for more information on custom ReadFcn.
Refer niftiread for more info.
More Answers (1)
Gökay Karayegen on 18 May 2020
Edited: Gökay Karayegen on 18 May 2020