メインコンテンツ

imscrollpanel

対話型イメージ ナビゲーション用のスクロール パネル

説明

関数 imscrollpanel を使用してイメージにスクロール パネルを追加します。サイズまたは倍率が、スクリーン上の Figure 内に表示するには大きすぎるイメージになる場合、スクロール パネルには 100% の倍率でイメージの一部が表示されます (1 スクリーン ピクセルは 1 イメージ ピクセルを表します)。スクロール パネルを作成すると、水平および垂直スクロール バーが追加され、イメージの周囲をナビゲーションすることができます。

hPanel = imscrollpanel(hParent,hImage) は、イメージ hImage のスクロールを有効にするスクロール パネル hPanel を作成します。このスクロール パネルは、親の Figure または Panel hParent に追加されます。

すべて折りたたむ

イメージを Figure に表示します。Figure ウィンドウの標準のツール バーとメニュー バーはスクロール パネルで動作しないため、この例では、それらを非表示にします。

hFig = figure(Toolbar="none",Menubar="none",Name="Saturn");
hIm = imshow("saturn.png");

Figure Saturn contains an axes object. The hidden axes object contains an object of type image.

イメージを表示するスクロール パネルを作成します。

hSP = imscrollpanel(hFig,hIm);
set(hSP,Units="normalized",Position=[0 .1 1 .9])

倍率ボックスと概要ツールを Figure に追加します。

hMagBox = immagbox(hFig,hIm);
pos = get(hMagBox,"Position");
set(hMagBox,Position=[0 0 pos(3) pos(4)])

Figure Saturn contains an axes object and other objects of type uipanel, uicontrol. The hidden axes object contains an object of type image.

imoverview(hIm)

Figure Overview (Saturn) contains an axes object and other objects of type uipanel, uitoolbar, uimenu. The hidden axes object contains 8 objects of type line, patch, image.

ビューをプログラム内で制御できるようにスクロール パネル API を取得します。

api = iptgetapi(hSP);

現在の倍率と位置を取得します。

mag = api.getMagnification()
mag = 
1
r = api.getVisibleImageRect()
r = 1×4

  218.0000  383.0500  765.0000  734.9000

スクロール パネル オブジェクトの API 関数 setVisibleLocation を使用してイメージの左上を表示します。

api.setVisibleLocation(0.5,0.5)

Figure Saturn contains an axes object and other objects of type uipanel, uicontrol. The hidden axes object contains an object of type image.

Figure Overview (Saturn) contains an axes object and other objects of type uipanel, uitoolbar, uimenu. The hidden axes object contains 8 objects of type line, patch, image.

イメージの倍率を変更してイメージ全体をスクロール パネルのウィンドウに合わせます。次の図では、スクロール バーが表示されなくなっています。

api.setMagnification(api.findFitMag())

Figure Saturn contains an axes object and other objects of type uipanel, uicontrol. The hidden axes object contains an object of type image.

Figure Overview (Saturn) contains an axes object and other objects of type uipanel, uitoolbar, uimenu. The hidden axes object contains 8 objects of type line, patch, image.

暗斑上で 1600% まで拡大します。

api.setMagnificationAndCenter(16,306,800)

Figure Saturn contains an axes object and other objects of type uipanel, uicontrol. The hidden axes object contains an object of type image.

Figure Overview (Saturn) contains an axes object and other objects of type uipanel, uitoolbar, uimenu. The hidden axes object contains 8 objects of type line, patch, image.

入力引数

すべて折りたたむ

スクロール パネルの親。Figure オブジェクトまたは Panel オブジェクトとして指定します。

イメージ。Image オブジェクトとして指定します。

出力引数

すべて折りたたむ

スクロール パネル。Panel オブジェクトとして返されます。

詳細

すべて折りたたむ

ヒント

  • imscrollpanel は、ターゲット イメージのオブジェクト階層を変更します。imscrollpanel は、通常の figure → axes → image というオブジェクト階層ではなく、figure および axes オブジェクト間に複数の uipanel および uicontrol オブジェクトを挿入します。

  • imscrollpanel で与えられるスクロールバー ナビゲーションは、既定で用意されている MATLAB® Figure ナビゲーション ボタン (パン、拡大、縮小) とは互換性がありません。対応するメニュー項目とツール バー ボタンは、カスタム GUI の中で削除され、imscrollpanel で作成されるスクロール可能な Unipanel を含んでいます。

  • imscrollpanel を実行すると、既定で uipanel オブジェクトによって 'Units''normalized' に設定され、'Position'[0 0 1 1] に設定されるため、Figure 全体がそのまま表示されます。新しいスクロール パネルを使用して他の hparent の子を表示する場合、hpanel'Position' プロパティを手動で設定しなければなりません。

バージョン履歴

R2006a より前に導入