Skip to content

Commit 089ebe2

Browse files
SimonaFawahln
andauthored
plotSlice function: minor fix for empty variables option (#859)
* Plot Slice function: title implemented * Plot Slice function bug fixed * Some changes from branch update * Fix title usage and some plotSlice cleanup * PlotSlice function fix for empty variables for consistency * small fix regarding dose window in plot slice * revert changes on axis call (use the sanitized axesHandle) * Update matRad_plotSlice.m dose window check in validation --------- Co-authored-by: Niklas Wahl <[email protected]>
1 parent 57817d7 commit 089ebe2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

matRad/util/matRad_plotSlice.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
isAxes = @(x) strcmp(get(x, 'type'), 'axes') || isempty(x);
6969
isCubeIdx = @(x) isscalar(x);
7070
isPlane = @(x) isscalar(x) && (sum(x==[1, 2, 3])==1);
71-
isDoseWindow = @(x) (length(x) == 2 && isvector(x));
71+
isDoseWindow = @(x) (length(x) == 2 && isvector(x) && diff(x) > 0);
7272
isThresh = @(x) (isscalar(x) && (x>=0) && (x<=1)) || isempty(x);
7373
isAlpha = @(x) isscalar(x) && (x>=0) && (x<=1) || isempty(x);
74-
isDoseColorMap = @(x) isnumeric(x) && (size(x, 2)==3) && all(x(:) >= 0) && all(x(:) <= 1);
74+
isDoseColorMap = @(x) (isnumeric(x) && (size(x, 2)==3) && all(x(:) >= 0) && all(x(:) <= 1)) || isempty(x);
7575
isDoseIsoLevels = @(x) isnumeric(x) && isvector(x)|| isempty(x);
7676
isVOIselection = @(x) isnumeric(x) || isempty(x); %all(x(:)==1 | x(:)==0) || isempty(x);
77-
isContourColorMap = @(x) isnumeric(x) && (size(x, 2)==3) && size(x, 1)>=2 && all(x(:) >= 0) && all(x(:) <= 1);
77+
isContourColorMap = @(x) (isnumeric(x) && (size(x, 2)==3) && size(x, 1)>=2 && all(x(:) >= 0) && all(x(:) <= 1)) || isempty(x);
7878
isBoolPlotLegend = @(x) x==0 || x ==1;
7979
isColorBarLabel = @(x) isstring(x) || ischar(x) || isempty(x);
8080
isShowCt = @(x) isscalar(x) && (x==0) || (x==1);
@@ -128,7 +128,8 @@
128128
textValues = struct2cell(p.Unmatched);
129129
textValues = textValues(ismember(unmParamNames, textFieldNames));
130130
textVarargin = reshape([textFields, textValues]', 1, []);
131-
%
131+
132+
% Filter axes properties from Unmatched
132133
axesFields = unmParamNames(ismember(unmParamNames, axesFieldNames));
133134
axesValues = struct2cell(p.Unmatched);
134135
axesValues = axesValues(ismember(unmParamNames, axesFieldNames));
@@ -158,7 +159,7 @@
158159
%% Plot dose
159160
if ~isempty(p.Results.dose)
160161
doseWindow = [min(p.Results.dose(:)) max(p.Results.dose(:))];
161-
if ~isempty(p.Results.doseWindow) && p.Results.doseWindow(2) - p.Results.doseWindow(1) <= 0
162+
if ~isempty(p.Results.doseWindow)
162163
doseWindow = p.Results.doseWindow;
163164
end
164165
[hDose,doseColorMap,doseWindow] = matRad_plotDoseSlice(axesHandle, p.Results.dose, p.Results.plane, p.Results.slice, p.Results.thresh, p.Results.alpha, p.Results.doseColorMap, doseWindow);
@@ -206,7 +207,7 @@
206207
%% Adjust axes
207208
axis(axesHandle,'tight');
208209
set(axesHandle,'xtick',[],'ytick',[]);
209-
colormap(axesHandle,p.Results.doseColorMap);
210+
%colormap(p.Results.axesHandle,p.Results.doseColorMap);
210211
fontSize = [];
211212
if isfield(p.Unmatched, 'FontSize')
212213
fontSize = p.Unmatched.FontSize;
@@ -255,4 +256,4 @@
255256
hIsoDose = [];
256257
end
257258

258-
end
259+
end

0 commit comments

Comments
 (0)