Skip to content

Commit

Permalink
Move NaN in Mask at the top
Browse files Browse the repository at this point in the history
  • Loading branch information
tanguyduval committed Sep 25, 2019
1 parent fc18463 commit a3c1eb4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Common/FitData.m
Expand Up @@ -44,6 +44,19 @@
if ismethod(Model,'PrecomputeData'), Model = Model.PrecomputeData(data); end
end

% NaN in Mask
if isfield(data,'Mask') && (~isempty(data.Mask))
data.Mask(isnan(data.Mask))=0;
msg = 'NaNs will be set to 0. We recommend you to check your mask.';
titlemsg = 'NaN values detected in the Mask';
if exist('wait','var') && (wait)
hwarn = warndlg(msg,titlemsg);
end
fprintf('\n')
warning(titlemsg)
fprintf('%s\n\n',msg)
end

if Model.voxelwise % process voxelwise
%############################# INITIALIZE #################################
% Get dimensions
Expand Down Expand Up @@ -77,16 +90,6 @@

% Find voxels that are not empty
if isfield(data,'Mask') && (~isempty(data.Mask))
data.Mask(isnan(data.Mask))=0;
msg = 'NaNs will be set to 0. We recommend you to check your mask.';
titlemsg = 'NaN values detected in the Mask';
if exist('wait','var') && (wait)
hwarn = warndlg(msg,titlemsg);
else
fprintf('\n')
warning(titlemsg)
fprintf('%s\n\n',msg)
end
Voxels = find(all(data.Mask & ~computed,2));
else
Voxels = find(~computed)';
Expand Down

0 comments on commit a3c1eb4

Please sign in to comment.