Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions matRad/util/matRad_plotSlice.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [] = matRad_plotSlice(ct, varargin)
function [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSlice(ct, varargin)
% matRad tool function to directly plot a complete slice of a ct with dose
% optionally including contours and isolines
%
Expand Down Expand Up @@ -68,14 +68,14 @@
isCubeIdx = @(x) isscalar(x);
isPlane = @(x) isscalar(x) && (sum(x==[1, 2, 3])==1);
isDoseWindow = @(x) (length(x) == 2 && isvector(x));
isThresh = @(x) isscalar(x) && (x>=0) && (x<=1);
isAlpha = @(x) isscalar(x) && (x>=0) && (x<=1);
isThresh = @(x) (isscalar(x) && (x>=0) && (x<=1)) || isempty(x);
isAlpha = @(x) isscalar(x) && (x>=0) && (x<=1) || isempty(x);
isDoseColorMap = @(x) isnumeric(x) && (size(x, 2)==3) && all(x(:) >= 0) && all(x(:) <= 1);
isDoseIsoLevels = @(x) isnumeric(x) && isvector(x);
isVOIselection = @(x) all(x(:)==1 | x(:)==0);
isDoseIsoLevels = @(x) isnumeric(x) && isvector(x)|| isempty(x);
isVOIselection = @(x) isnumeric(x) || isempty(x); %all(x(:)==1 | x(:)==0) || isempty(x);
isContourColorMap = @(x) isnumeric(x) && (size(x, 2)==3) && size(x, 1)>=2 && all(x(:) >= 0) && all(x(:) <= 1);
isBoolPlotLegend = @(x) x==0 || x ==1;
isColorBarLabel = @(x) isstring(x) || ischar(x);
isColorBarLabel = @(x) isstring(x) || ischar(x) || isempty(x);
isShowCt = @(x) isscalar(x) && (x==0) || (x==1);

p = inputParser;
Expand Down Expand Up @@ -133,15 +133,15 @@
%% Plot dose
if ~isempty(p.Results.dose)
if ~isempty(p.Results.doseWindow) && p.Results.doseWindow(2) - p.Results.doseWindow(1) <= 0
p.Results.doseWindow = [0 2];

Check warning on line 136 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L136

Added line #L136 was not covered by tests
end

[hDose,doseColorMap,doseWindow] = matRad_plotDoseSlice(p.Results.axesHandle, p.Results.dose, p.Results.plane, p.Results.slice, p.Results.thresh, p.Results.alpha, p.Results.doseColorMap, p.Results.doseWindow);

%% Plot iso dose lines
if ~isempty(p.Results.doseIsoLevels)
hIsoDose = matRad_plotIsoDoseLines(p.Results.axesHandle,p.Results.dose,[],p.Results.doseIsoLevels,false,p.Results.plane,p.Results.slice,p.Results.doseColorMap,p.Results.doseWindow, lineVarargin{:});
hold on;

Check warning on line 144 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L143-L144

Added lines #L143 - L144 were not covered by tests
else
hIsoDose = [];
end
Expand All @@ -150,30 +150,30 @@
hCMap = matRad_plotColorbar(p.Results.axesHandle,doseColorMap,doseWindow,'Location','EastOutside');
set(hCMap,'Color',matRad_cfg.gui.textColor);
if ~isempty(p.Results.colorBarLabel)
set(get(hCMap,'YLabel'),'String', p.Results.colorBarLabel,'FontSize',matRad_cfg.gui.fontSize);

Check warning on line 153 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L153

Added line #L153 was not covered by tests
end
set(get(hCMap,'YLabel'),'String', p.Results.colorBarLabel, textVarargin{:});
end
%% Plot VOI contours & Legend

if ~isempty(p.Results.cst)
[hContour,~] = matRad_plotVoiContourSlice(p.Results.axesHandle, p.Results.cst, p.Results.ct, p.Results.cubeIdx, p.Results.voiSelection, p.Results.plane, p.Results.slice, p.Results.contourColorMap, lineVarargin{:});

Check warning on line 160 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L160

Added line #L160 was not covered by tests

if p.Results.boolPlotLegend
visibleOnSlice = (~cellfun(@isempty,hContour));
ixLegend = find(p.Results.voiSelection);
hContourTmp = cellfun(@(X) X(1),hContour(visibleOnSlice),'UniformOutput',false);
if ~isempty(p.Results.voiSelection)
hLegend = legend(p.Results.axesHandle,[hContourTmp{:}],[p.Results.cst(ixLegend(visibleOnSlice),2)],'AutoUpdate','off','TextColor',matRad_cfg.gui.textColor);

Check warning on line 167 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L162-L167

Added lines #L162 - L167 were not covered by tests
else
hLegend = legend(p.Results.axesHandle,[hContourTmp{:}],[p.Results.cst(visibleOnSlice,2)],'AutoUpdate','off','TextColor',matRad_cfg.gui.textColor);

Check warning on line 169 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L169

Added line #L169 was not covered by tests
end
set(hLegend,'Box','On');
set(hLegend,'TextColor',matRad_cfg.gui.textColor);
if ~isempty(textVarargin)
set(hLegend, textVarargin{:});

Check warning on line 174 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L171-L174

Added lines #L171 - L174 were not covered by tests
else
set(hLegend,'FontSize',matRad_cfg.gui.fontSize);

Check warning on line 176 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L176

Added line #L176 was not covered by tests
end
end
else
Expand All @@ -186,7 +186,7 @@
colormap(p.Results.axesHandle,p.Results.doseColorMap);

if isfield(p.Unmatched, 'FontSize')
matRad_plotAxisLabels(p.Results.axesHandle,p.Results.ct,p.Results.plane,p.Results.slice, p.Unmatched.FontSize, [])

Check warning on line 189 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L189

Added line #L189 was not covered by tests
else
matRad_plotAxisLabels(p.Results.axesHandle,p.Results.ct,p.Results.plane,p.Results.slice, [], [])
end
Expand All @@ -208,7 +208,7 @@

%% Set text properties
if ~isempty(textVarargin)
set(p.Results.axesHandle, textVarargin{:})
set(p.Results.axesHandle.Title, textVarargin{:})

Check warning on line 212 in matRad/util/matRad_plotSlice.m

View check run for this annotation

Codecov / codecov/patch

matRad/util/matRad_plotSlice.m#L211-L212

Added lines #L211 - L212 were not covered by tests
end

Expand Down
9 changes: 8 additions & 1 deletion matRad/util/matRad_plotSliceWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

warning('Deprecation warning: matRad_plotSliceWrapper is deprecated. Using matRad_plot_Slice instead');
Copy link
Contributor

Choose a reason for hiding this comment

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

we have a dedicated matRad_cfg.dispDeprecationWarning(...) for this


% Handle the argument list
if ~exist('thresh','var') || isempty(thresh)
thresh = [];
Expand Down Expand Up @@ -101,6 +103,11 @@

matRad_cfg = MatRad_Config.instance();

warning('Deprecation warning: matRad_plotSliceWrapper is deprecated. Using matRad_plot_Slice instead');

[hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSlice(ct, 'axesHandle', axesHandle, 'cst', cst, 'cubeIdx', cubeIdx, 'dose', dose, 'plane', plane, 'slice', slice,'thresh', thresh, 'alpha', alpha, 'contourColorMap', contourColorMap, 'doseColorMap', doseColorMap, 'doseWindow', doseWindow, 'doseIsoLevels', doseIsoLevels, 'voiSelection', voiSelection, 'colorBarLabel', colorBarLabel, 'boolPlotLegend', boolPlotLegend, 'others', varargin);

%{
set(axesHandle,'YDir','Reverse');
% plot ct slice
hCt = matRad_plotCtSlice(axesHandle,ct.cubeHU,cubeIdx,plane,slice);
Expand Down Expand Up @@ -171,6 +178,6 @@
if ~isempty(colorBarLabel)
set(get(hCMap,'YLabel'),'String', colorBarLabel,'FontSize',matRad_cfg.gui.fontSize);
end

%}
end

Loading