From f5d7bba12f4fc9d0996f512b4c07b740780733fe Mon Sep 17 00:00:00 2001 From: CPernet Date: Wed, 15 May 2024 08:47:33 +0200 Subject: [PATCH] add case ecat annotation (method) is missing but user provides it --- matlab/ecat2nii.m | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index c2b9f407..e58025d9 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -239,10 +239,23 @@ end else % annotation is blank - no info on method - warning('no reconstruction method information found - invalid BIDS metadata') - info.ReconMethodParameterLabels = {'lower_threshold', 'upper_threshold'}; - info.ReconMethodParameterUnits = {'keV', 'keV'}; - info.ReconMethodParameterValues = [mh.lwr_true_thres, mh.upr_true_thres]; + if isfield(info.ReconMethodName) % user provided + [info.ReconMethodName,i,s] = get_recon_method(deblank(info.ReconMethodName)); + if ~isempty(i) && ~isempty(s) + info.ReconMethodParameterLabels = {'iterations', 'subsets', 'lower_threshold', 'upper_threshold'}; + info.ReconMethodParameterUnits = {'none', 'none', 'keV', 'keV'}; + info.ReconMethodParameterValues = [str2double(i), str2double(s), mh.lwr_true_thres, mh.upr_true_thres]; + else % some method without iteration and subset e.g. back projection + info.ReconMethodParameterLabels = {'lower_threshold', 'upper_threshold'}; + info.ReconMethodParameterUnits = {'keV', 'keV'}; + info.ReconMethodParameterValues = [mh.lwr_true_thres, mh.upr_true_thres]; + end + else + warning('no reconstruction method information found - invalid BIDS metadata') + info.ReconMethodParameterLabels = {'lower_threshold', 'upper_threshold'}; + info.ReconMethodParameterUnits = {'keV', 'keV'}; + info.ReconMethodParameterValues = [mh.lwr_true_thres, mh.upr_true_thres]; + end end else % no info on method