Using sliceViewer function in App Designer

Hi,
I am using the following syntax to try to display a sliceViewer element inside a GUI of App Designer:
% Button pushed function: LoadCT
function LoadCTButtonPushed(app, event)
dir = uigetdir;
oCT=cPETRUS_loadCT(dir);
sliceViewer(oCT.Image,'parent',app.UIAxes2)
end
however I get the following error:
Error using images.stacks.browser.internal.SliceViewer/set.Parent
The Parent property must be a figure or uipanel.
Error in sliceViewer/parseInputs
Error in sliceViewer
It's weird because I can display other things in this axis using other functions that use and dont use the 'parent' atribute, but I cant with sliceViewer.
Any thoughts on this?

回答 (1 件)

Raj Tummala
Raj Tummala 2021 年 8 月 13 日
編集済み: Raj Tummala 2021 年 8 月 13 日

0 投票

Use a panel instead of a figure:
sliceViewer(oCT.Image,'parent',app.Panel)
You can see it in a figure, but it's needs to UIFigure not UIAxes:
sliceViewer(oCT.Image,'parent',app.UIFigure2)
However, the problem with this approach is that the size is not constrained (it takes up the entire screen).

1 件のコメント

Omar Zenteno
Omar Zenteno 2021 年 9 月 14 日
Hello Raj,
Thank you for your answer; I was aware I can use a panel instead of a figure. However since the error says the parent needs to "be a figure or uipanel" I was hoping to be able to present it as an independant figure with all figure properties.
... unless I am missing something

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2020a

質問済み:

2021 年 5 月 6 日

コメント済み:

2021 年 9 月 14 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by