Skip to content

Commit

Permalink
add case ecat annotation (method) is missing but user provides it
Browse files Browse the repository at this point in the history
  • Loading branch information
CPernet committed May 15, 2024
1 parent 0a926ff commit f5d7bba
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions matlab/ecat2nii.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

Copy link
@bendhouseart

bendhouseart May 29, 2024

Contributor

@bendhouseart adding @ for follow up.

[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
Expand Down

1 comment on commit f5d7bba

@CPernet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bendhouseart not sure if you cover that scenario

Please sign in to comment.