Skip to content

Commit

Permalink
only show SSD warnings once
Browse files Browse the repository at this point in the history
  • Loading branch information
becker89 committed Feb 15, 2018
1 parent ff9108b commit 3825070
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions matRad_computeSSD.m
Expand Up @@ -35,6 +35,9 @@
mode = 'first';
end

% booleon to show warnings only once in the console
boolShowWarning = true;

% set density threshold for SSD computation
densityThreshold = 0.05;

Expand All @@ -50,13 +53,16 @@
{ct.cube{1}});
ixSSD = find(rho{1} > densityThreshold,1,'first');


if isempty(ixSSD)
warning('ray does not hit patient. Trying to fix afterwards...');
elseif ixSSD(1) == 1
warning('Surface for SSD calculation starts directly in first voxel of CT\n');
if boolShowWarning
if isempty(ixSSD)
matRad_dispToConsole('ray does not hit patient. Trying to fix afterwards...',[],'warning');
boolShowWarning = false;
elseif ixSSD(1) == 1
matRad_dispToConsole('Surface for SSD calculation starts directly in first voxel of CT\n',[],'warning');
boolShowWarning = false;
end
end

% calculate SSD
SSD{j} = double(2 * stf(i).SAD * alpha(ixSSD));
stf(i).ray(j).SSD = SSD{j};
Expand Down
2 changes: 1 addition & 1 deletion matRad_dispToConsole.m
Expand Up @@ -48,7 +48,7 @@ function matRad_dispToConsole(string,param,typeOfMessage,formatSpec)

if param.logLevel < 4

fprintf(string);
fprintf(['[\bWarning:]\b ' string]);

end

Expand Down

0 comments on commit 3825070

Please sign in to comment.