Build App for Navigating Large Images

This example shows how to build an app for navigating large images using modular navigation tools. Because the toolbox scrollable navigation is incompatible with standard MATLAB® figure window navigation tools, the example suppresses the toolbar and menu bar in the figure window.

Create a function that accepts an image as an argument and displays the image in a figure window with scroll bars, an Overview tool, and a Magnification box.

function my_large_image_display(im)

% Create a figure without toolbar and menubar.
hfig = figure('Toolbar','none',...
              'Menubar', 'none',...
              'Name','My Large Image Display Tool',...

% Display the image in a figure with imshow.
himage = imshow(im);

% Add the scroll panel.
hpanel = imscrollpanel(hfig,himage);

% Position the scroll panel to accommodate the other tools.
set(hpanel,'Units','normalized','Position',[0 .1 1 .9]);

% Add the Magnification box.
hMagBox = immagbox(hfig,himage);

% Position the Magnification box
pos = get(hMagBox,'Position');
set(hMagBox,'Position',[0 0 pos(3) pos(4)]);

% Add the Overview tool.
hovervw = imoverview(himage);

Read an image into the workspace.

big_image = imread('peppers.png'); 

Use the app to display the image with navigation aids.