MATLAB:implay 函数使用代码更改选项
MATLAB: implay function Changing Options with Code
我想在打开图之前更改一些播放选项。我要更改的选项是 "Maintain Fit to window"
和 "range for image pixel intensities" ,它们位于 Tools >Colormap
。答案 Matlab - implay's default size window 对开始很有帮助。但是我对 MATLAB 的 GUI 环境还很陌生。按照网站的说明进行操作后,下面的代码显示了颜色图菜单对象。
close all force
implay(zeros(100,100,100))
whole_objs = findall(0);
whole_objs (end-49)
但是我不知道应该更改哪些参数或如何更改。我该如何更改它们以及我应该更改哪些参数?除此之外,任何有助于理解 MATLAB 中的 GUI 的参考资料都将不胜感激。
可以通过相应的代码简单地改变:
h = implay(zeros(100,100,100)); % get object of the figure
h.Visual.ColorMap.Map = winter; % set the desired colormap
要在脚本中同时启用“保持适合 window”,您可以使用以下代码。这与 here 中描述的方法类似。可能有更优雅的解决方案,但这对我适用于 Matlab 2020b。
% From answer by toygan kılıç
h = implay(zeros(100,100,100)); % get object of the figure
h.Visual.ColorMap.Map = winter; % set the desired colormap
% To enable "Maintain Fit to window"
toolMenu = findall(0,'tag','uimgr.uimenugroup_Tools'); % get the tools menu object from implay
set(toolMenu(1).Children(1),'Checked', 'on'); % check the "Maintain Fit to window" in the tools menu (just happens to be the first child)
fcnHandle = toolMenu(1).Children(1).MenuSelectedFcn; % get the function handle to the callback for the "Maintain Fit to window"
fcnHandle(); % Run the callback function for "Maintain Fit to window"
我想在打开图之前更改一些播放选项。我要更改的选项是 "Maintain Fit to window"
和 "range for image pixel intensities" ,它们位于 Tools >Colormap
。答案 Matlab - implay's default size window 对开始很有帮助。但是我对 MATLAB 的 GUI 环境还很陌生。按照网站的说明进行操作后,下面的代码显示了颜色图菜单对象。
close all force
implay(zeros(100,100,100))
whole_objs = findall(0);
whole_objs (end-49)
但是我不知道应该更改哪些参数或如何更改。我该如何更改它们以及我应该更改哪些参数?除此之外,任何有助于理解 MATLAB 中的 GUI 的参考资料都将不胜感激。
可以通过相应的代码简单地改变:
h = implay(zeros(100,100,100)); % get object of the figure
h.Visual.ColorMap.Map = winter; % set the desired colormap
要在脚本中同时启用“保持适合 window”,您可以使用以下代码。这与 here 中描述的方法类似。可能有更优雅的解决方案,但这对我适用于 Matlab 2020b。
% From answer by toygan kılıç
h = implay(zeros(100,100,100)); % get object of the figure
h.Visual.ColorMap.Map = winter; % set the desired colormap
% To enable "Maintain Fit to window"
toolMenu = findall(0,'tag','uimgr.uimenugroup_Tools'); % get the tools menu object from implay
set(toolMenu(1).Children(1),'Checked', 'on'); % check the "Maintain Fit to window" in the tools menu (just happens to be the first child)
fcnHandle = toolMenu(1).Children(1).MenuSelectedFcn; % get the function handle to the callback for the "Maintain Fit to window"
fcnHandle(); % Run the callback function for "Maintain Fit to window"