Skip to content

Commit f1379a3

Browse files
committed
better handling of load-settings and figure setup
1 parent 6be1e6d commit f1379a3

File tree

6 files changed

+90
-19
lines changed

6 files changed

+90
-19
lines changed

util/@PostProBackEnd/Apply_Vessel_Processing.m

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ function Apply_Vessel_Processing(PPA)
99

1010
PPA.Start_Wait_Bar(PPA.VesselGUI, 'Vessel Analysis');
1111

12-
if isempty(PPA.VesselFigs) ||~ishandle(PPA.VesselFigs.MainFig)
12+
if isempty(PPA.VesselFigs) || ~ishandle(PPA.VesselFigs.MainFig)
1313
PPA.Setup_Vessel_Figures();
1414
end
15+
16+
wasEmptyImage = isempty(PPA.VesselFigs.InIm.CData);
17+
1518
% bring the figures we use to the front
1619
figure(PPA.VesselFigs.MainFig);
1720
figure(PPA.VesselFigs.ResultsFig);
@@ -43,10 +46,22 @@ function Apply_Vessel_Processing(PPA)
4346
% plot final image with fitted splines, widths and branch points
4447
PPA.Update_Vessel_Results_Plot();
4548

46-
% bring the figures we use to the front
47-
figure(PPA.VesselFigs.MainFig);
48-
figure(PPA.VesselFigs.ResultsFig);
49-
figure(PPA.VesselGUI.UIFigure);
49+
50+
51+
% bring the figures we use to the front, if image was empty, also
52+
% scale axis to show full image
53+
if wasEmptyImage
54+
figure(PPA.VesselFigs.MainFig);
55+
axis tight;
56+
figure(PPA.VesselFigs.ResultsFig);
57+
axis tight;
58+
figure(PPA.VesselGUI.UIFigure);
59+
axis tight;
60+
else
61+
figure(PPA.VesselFigs.MainFig);
62+
figure(PPA.VesselFigs.ResultsFig);
63+
figure(PPA.VesselGUI.UIFigure);
64+
end
5065

5166
catch me
5267
PPA.ProgBar = [];

util/@PostProBackEnd/Handle_Master_Gui_State.m

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ function Handle_Master_Gui_State(PPA, stateString)
3535
else
3636
% update volume info status ------------------------------------------------
3737
control_vol_size_elements(PPA, false); % local function, see below
38-
39-
% auto load next step in processing...
38+
PPA.MasterGUI.MapProcessingButton.Enable = true;
39+
PPA.MasterGUI.VolumeProcessingButton.Enable = false;
40+
41+
% close map if it's empty, not sure why we need this
4042
if ~isempty(PPA.MapFig) && ishandle(PPA.MapFig.MainFig)
4143
close(PPA.MapFig.MainFig);
4244
PPA.MapFig = [];
4345
end
46+
% auto load next step in processing...
4447
PPA.MasterGUI.Open_Map_Gui();
45-
PPA.MasterGUI.VolumeProcessingButton.Enable = false;
46-
PPA.MasterGUI.MapProcessingButton.Enable = true;
4748

4849
if PPA.Is_Visible(PPA.MapGUI)
4950
figure(PPA.MapGUI.UIFigure);
@@ -55,6 +56,9 @@ function Handle_Master_Gui_State(PPA, stateString)
5556
PPA.ExportGUI.expFileName.Value = PPA.fileName;
5657
end
5758

59+
% make sure all images are displayed fully -> axis tight on all axis
60+
make_axis_tight(PPA); % see below
61+
5862
case 'vol_processing_complete'
5963
% after volume processing, we can do map processing
6064
PPA.MasterGUI.MapProcessingButton.Enable = true;
@@ -142,3 +146,34 @@ function update_map_size_display(PPA)
142146
PPA.MasterGUI.MapMemory.Value = ...
143147
[num2sip(mapBytes, 3, false, true) 'B'];
144148
end
149+
150+
% update map info data --------------------------------------------------
151+
function make_axis_tight(PPA)
152+
% make map images tight
153+
if ~isempty(PPA.MapFig) && ishandle(PPA.MapFig.MainFig)
154+
figure(PPA.MapFig.MainFig);
155+
axis tight;
156+
end
157+
% make frangi images tight for map processing
158+
if ~isempty(PPA.MapFrangi) && ishandle(PPA.MapFrangi.FigHandles.MainFig)
159+
figure(PPA.MapFrangi.FigHandles.MainFig);
160+
axis tight;
161+
end
162+
163+
% make vessel analysis images tight
164+
if ~isempty(PPA.VesselFigs) && ishandle(PPA.VesselFigs.MainFig)
165+
figure(PPA.VesselFigs.MainFig);
166+
axis tight;
167+
end
168+
if ~isempty(PPA.VesselFigs) && ishandle(PPA.VesselFigs.ResultsFig)
169+
figure(PPA.VesselFigs.ResultsFig);
170+
axis tight;
171+
end
172+
173+
% make frangi images tight for vessel analysis
174+
if ~isempty(PPA.VesselFrangi) && ishandle(PPA.VesselFrangi.FigHandles.MainFig)
175+
figure(PPA.VesselFrangi.FigHandles.MainFig);
176+
axis tight;
177+
end
178+
179+
end

util/@PostProBackEnd/PostProBackEnd.m

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,14 @@ function Update_Status(PPA, statusText, append)
436436

437437
%---------------------------------------------------------------
438438
function xPlotIm = get.xPlotIm(PPA)
439-
440-
if PPA.imInterpFct
441-
xPlotIm = linspace(PPA.xPlot(1), PPA.xPlot(end), PPA.nXIm);
442-
else
443-
xPlotIm = PPA.xPlot;
439+
if ~isempty(PPA.xPlot)
440+
if PPA.imInterpFct
441+
xPlotIm = linspace(PPA.xPlot(1), PPA.xPlot(end), PPA.nXIm);
442+
else
443+
xPlotIm = PPA.xPlot;
444+
end
445+
else
446+
xPlotIm = [];
444447
end
445448

446449
end
@@ -487,13 +490,15 @@ function Update_Status(PPA, statusText, append)
487490

488491
%---------------------------------------------------------------
489492
function yPlotIm = get.yPlotIm(PPA)
490-
491-
if PPA.imInterpFct
492-
yPlotIm = linspace(PPA.yPlot(1), PPA.yPlot(end), PPA.nYIm);
493+
if ~isempty(PPA.xPlot)
494+
if PPA.imInterpFct
495+
yPlotIm = linspace(PPA.yPlot(1), PPA.yPlot(end), PPA.nYIm);
496+
else
497+
yPlotIm = PPA.yPlot;
498+
end
493499
else
494-
yPlotIm = PPA.yPlot;
500+
yPlotIm = [];
495501
end
496-
497502
end
498503

499504
%---------------------------------------------------------------

util/@PostProBackEnd/Setup_Vessel_Figures.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
function Setup_Vessel_Figures(PPA)
2+
% creates two main vessels analysis figures
3+
% VesselFigs.MainFig
4+
% VesselFigs.ResultsFig
5+
%
6+
% with subplots:
7+
% VesselFigs.TileLayout
8+
% VesselFigs.InPlot
9+
% VesselFigs.BinPlot
10+
% ....
11+
%
12+
% containing images:
13+
% VesselFigs.InIm
14+
% VesselFigs.BinIm
15+
% ...
16+
% TODO complete list?
17+
218
PPA.Start_Wait_Bar(PPA.VesselGUI, 'Setting up figures...');
319
PPA.Update_Status('Setting up vessel figures');
420
ProgHandle = progressbar('Setting up vessel figures', {Colors.GuiLightOrange});

util/guis/ExportGui.mlapp

-87 Bytes
Binary file not shown.

util/guis/MasterGui.mlapp

-38 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)