bmiademoold.m
来自「beamlet变化的工具箱」· M 代码 · 共 331 行
M
331 行
%********************************************************
function BMIADemo(action)
%Usage: BMIADemo
%Description: Demo for Beamlets and Multiscale Image Analysis
%Version: 5
%Author: Sou Cheng CHOI
%Date: Mar 16, 2002
%********************************************************
global plotOffset
global FigureNumberList
global PaperName
global NumberOfFigures
global MakeFigureFilePrefix
global IfNewWindow
global StopPlot
global WLVERBOSE;
% -------------------------------------------------------
FigureNumberList = [8;9;11;16;18];
[m,n] = size(FigureNumberList);
NumberOfFigures = m;
PaperName = 'Beamlets and Multiscale Image Analysis';
MakeFigureFilePrefix = 'dBMIAfig';
%--------------------------------------------------------
WLVERBOSE='No';
%if nargin <= 1
IfNewWindow = '(1)';
%else
% IfNewWindow = ''; % empty string
%end
if nargin == 0,
Initialize_GUI;
c=get(gcf,'Children');
[m,n]=size(c);
plotOffset = m;
action = 'restart';
end
%set(findobj('tag','stop'),'userdata',0);
%drawnow;
if isequal(action,'restart'),
% Retrieve parameters from GUI
runAllfig = get(findobj('tag','RunAllFig'),'value');
elseif isequal(action,'ploteach'),
% edit1 = get(findobj('tag','edit1'),'value');
%checked = get(findobj('tag','newWindow'),'value')
% if checked
% IfNewWindow = '';
% else
IfNewWindow = '(1)';
% end
PlotFigure;
elseif isequal(action,'plotall'),
%checked = get(findobj('tag','newWindow'),'value');
%if checked
% IfNewWindow = '';
%else
IfNewWindow = '(1)';
%end
StopPlot = 0;
PlotAllFigures;
elseif isequal(action,'stop'),
StopPlot = 1;
%elseif isequal(action,'newDemo'),
% checked = get(findobj('tag','newWindow'),'value');
% if checked
% IfNewWindow = '';
% else
% IfNewWindow = (1);
% end
elseif isequal(action,'seecode'),
edit1 = get(findobj('tag','edit1'),'value');
s = ['edit', ' ', strcat(MakeFigureFilePrefix, num2str(FigureNumberList(edit1)))];
eval(s);
elseif isequal(action,'close'),
CloseDemoFigures;
end
%********************************************************
function Initialize_GUI
%********************************************************
% -------------------------------------------------------
fs = 9; %default font size
% -------------------------------------------------------
global FigureNumberList
global PaperName;
%CloseDemoFigures
close all
figure
figureNoList = FigureNumberList;
clf reset;
set(gcf,'pos', [50 55 560*1.45 420*1.45], 'Name', PaperName, 'NumberTitle','off');
set(gcf,'doublebuffer','on','userdata',1);
uicontrol( ...
'tag','text1', ...
'style','text', ...
'units','normal', ...
'position', [.85 .82, .12 .06], ...
'string','Figure', ...
'backgroundcolor', [0.8 0.8 0.8],...
'fontsize',fs);
uicontrol( ...
'tag','text2', ...
'style','text', ...
'units','normal', ...
'position', [.04 .93, .7 .04], ...
'string','', ...
'backgroundcolor', [0.8 0.8 0.8],...
'fontsize',fs);
uicontrol( ...
'tag','text3', ...
'style','text', ...
'units','normal', ...
'position', [.04 .01, .7 .04], ...
'string','', ...
'backgroundcolor', [0.8 0.8 0.8],...
'fontsize',fs);
uicontrol( ...
'tag','edit1', ...
'style','list', ...
'units','normal', ...
'position',[.85 .50 .12 .30], ...
'string',{num2str(figureNoList)}, ...%'value', 1,...
'backgroundcolor',[0.8 0.8 0.8], ...
'fontsize',fs, ...
'callback','BMIADemo(''ploteach'')');
if 0,
uicontrol( ...
'tag','newWindow', ...
'style','checkbox', ...
'units','normal', ...
'position',[.85 .40 .12 .07], ...
'string','New Window', ...
'fontsize',fs, ...
'userdata',0, ...
'backgroundcolor',[0.8 0.8 0.8], ...
'callback','BMIADemo(''newDemo'')');
end
uicontrol( ...
'tag','RunAllFig', ...
'style','pushbutton', ...
'units','normal', ...
'position',[.85 .32 .12 .07], ...
'string','Run All Fig' , ...
'fontsize',fs, ...
'interruptible','on',...
'callback','BMIADemo(''plotall'')');
uicontrol( ...
'tag','stop', ...
'style','pushbutton', ...
'units','normal', ...
'position',[.85 .24 .12 .07], ...
'string','Stop', ...
'fontsize',fs, ...
'userdata',0, ...
'callback','BMIADemo(''stop'');');
%'callback','set(gcbo,''userdata'',1)');
uicontrol( ...
'tag','SeeCode', ...
'style','pushbutton', ...
'units','normal', ...
'position',[.85 .16 .12 .07], ...
'string','See Code' , ...
'fontsize',fs, ...
'callback', 'BMIADemo(''seecode'')');
uicontrol( ...
'style','pushbutton', ...
'units','normal', ...
'position',[.85 .08 .12 .07], ...
'string','Close', ...
'fontsize',fs, ...
'callback','close all');
%********************************************************
function PlotFigure
%********************************************************
global FigureNumberList
global MakeFigureFilePrefix
global IfNewWindow
DeleteSubplots;
set(gcf,'Visible', 'off');
edit1 = get(findobj('tag','edit1'),'value');
s=num2str(FigureNumberList(edit1));
s=strcat(strcat(MakeFigureFilePrefix, s), IfNewWindow);
fprintf('\n\n\Loading Figure %d...\n', FigureNumberList(edit1));
% tic;
eval(s);
fprintf('\Figure %d loaded.\n', FigureNumberList(edit1));
% toc,
WriteCaptions(edit1);
AdjustSubplots;
titles= strcat('Figure ', num2Str(FigureNumberList(edit1)));
text1 = findobj('tag','text1');
set(text1,'string', titles);
set(gcf,'Visible', 'on');
%********************************************************
function PlotAllFigures
%********************************************************
global NumberOfFigures
global FigureNumberList
global StopPlot
for i=1:NumberOfFigures,
if StopPlot == 1,
break;
end
h=findobj('tag','edit1');
set(h,'Value',i);
PlotFigure;
pause(3);
%DeleteNonDemoFigures
end
%********************************************************
function WriteCaptions(edit1)
%********************************************************
global MakeFigureFilePrefix
global FigureNumberList
switch edit1
case 1
captions = 'Illustrating the nearly identical sensitivity of the maximum beam statistic and the maximum beamlet statistic';
case 2
captions = 'Picasso image: we plot the beamlets at each of several scales whose coefficients exceed a predetermined threshold.';
case 3
captions = 'The *scale-thickness graph* of three different *sets* at various scales. The left column gives the original curve(s). The right column gives the corresponding thickness--scale plots, which portray the sum of squares of all thicknesses at each given scale.';
case 4
captions = 'Extracting multiple line segments via Beamlet-Decorated Recursive Dyadic Partitioning.';
case 5
captions = 'Extracting multiple blobs. ';
end
text2 = findobj('tag','text2');
set(text2,'string', captions);
text3 = findobj('tag','text3');
set(text3,'string', ['This figure is produced by', ' ', strcat(MakeFigureFilePrefix, num2str(FigureNumberList(edit1))),'.m', '. To reproduce the figure without using precomputed data, run BMIAfig',num2str(FigureNumberList(edit1)), '.m. ', '(CR)']);
drawnow
%********************************************************
function AdjustSubplots2
%********************************************************
global plotOffset
MagnificationFactor = 0.92;
f = get(0,'Children');
[fm,fn]=size(f);
c = get(f(fm),'Children');
[m1,n1]=size(c);
m=m1-plotOffset;
p = zeros(m, 4);
for i=m:-1:1,
p(i,:) = get(c(i),'position');
REMAPFIG(p(i,:), p(i,:).* MagnificationFactor);
end
%********************************************************
function AdjustSubplots
%********************************************************
global plotOffset
set(gcf,'Visible', 'off');
MagnificationFactor = 0.92;
right = 0.85;
f = get(0,'Children');
[fm,fn]=size(f);
c = get(f(fm),'Children');
[m1,n1]=size(c);
m=m1-plotOffset;
p = zeros(m, 4);
for i=m:-1:1,
%get all suplots' positions
p(i,:) = get(c(i),'position');
end
% contract all subplots
p = p * MagnificationFactor;
col=length(unique(p(:,1)));
if col > 0,
row = m/col;
end
for i=m:-1:1
%Adjust spacing between subplots
width = p(i,3);
hshift = (right - col * width) / (col+1);
in_col = mod(i,col)+1;
p(i,1) = width * (in_col - 1) + hshift * (in_col);
set(c(i), 'position', p(i,:));
end
%********************************************************
function DeleteSubplots
%********************************************************
global plotOffset
c = get(gcf,'Children');
[m1,n1]=size(c);
m=m1-plotOffset;
for i=1:m,
delete(c(i));
end
%********************************************************
function DeleteNonDemoFigures
%********************************************************
h=findobj(0,'Type','figure');
[m,n]=size(h);
for i=1:m,
if h(i)~=1
close(h(i));
end
end
%********************************************************
function CloseDemoFigures
%********************************************************
global PaperName;
h=findobj(0,'Name', PaperName);
[m,n]=size(h);
for i=1:m,
close(h(i))
end
%% Part of BeamLab Version:200% Built:Friday,23-Aug-2002 00:00:00% This is Copyrighted Material% For Copying permissions see COPYING.m% Comments? e-mail beamlab@stat.stanford.edu%%% Part of BeamLab Version:200% Built:Saturday,14-Sep-2002 00:00:00% This is Copyrighted Material% For Copying permissions see COPYING.m% Comments? e-mail beamlab@stat.stanford.edu%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?