Skip to content

Commit

Permalink
#1689 xASL_io_ReadNifti: manage SPMsuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
HenkMutsaerts committed Apr 21, 2024
1 parent 1ee59b7 commit a8074ae
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions External/SPMmodified/xASL/xASL_io_ReadNifti.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a8074ae

Please sign in to comment.