From a8074ae8bfd8536ce11bdd60100de29c14a4b9df Mon Sep 17 00:00:00 2001 From: Henk Mutsaerts Date: Sun, 21 Apr 2024 15:38:31 +0200 Subject: [PATCH] #1689 xASL_io_ReadNifti: manage SPMsuffix --- External/SPMmodified/xASL/xASL_io_ReadNifti.m | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/External/SPMmodified/xASL/xASL_io_ReadNifti.m b/External/SPMmodified/xASL/xASL_io_ReadNifti.m index 6127fd238..afb6ea57d 100644 --- a/External/SPMmodified/xASL/xASL_io_ReadNifti.m +++ b/External/SPMmodified/xASL/xASL_io_ReadNifti.m @@ -39,31 +39,26 @@ NiftiObject = []; json = []; -[fPath, fFile] = xASL_fileparts(pathIn); -pathUnzipped = fullfile(fPath, [fFile '.nii']); -pathJson = fullfile(fPath, [fFile '.json']); - if iscell(pathIn) if length(pathIn)==1 pathIn = pathIn{1}; else - error('NiftiPath is a cell with more than one element, not a character string.'); + error('NiftiPath is a cell with more than one element, not a character string'); end end -% remove SPM image extension -IndexComma = strfind(pathIn,','); -if ~isempty(IndexComma) - ImExt = pathIn(IndexComma:end); - pathIn = pathIn(1:IndexComma-1); -else - ImExt = ''; -end - -if ~xASL_exist(pathIn,'file') +[fPath, fFile, fExt, ImExt] = xASL_fileparts(pathIn); +pathUnzipped = fullfile(fPath, [fFile '.nii']); +pathJson = fullfile(fPath, [fFile '.json']); + +pathIn = fullfile(fPath, [fFile fExt]); + +if ~xASL_exist(pathIn, 'file') error([pathIn ' does not exist as .nii[.gz]']); end + + %% Checking whether .nii & .nii.gz are equal (if both exist) xASL_adm_UnzipNifti(pathUnzipped);