function hh = basicImageDisplay(fig_handle,ax_handle,...
                                cdata, cdatamapping, clim, map, ...
                                xdata, ydata)
%basicImageDisplay Display image for IMSHOW and IMVIEW.

%   Copyright 1993-2004 The MathWorks, Inc.  
%   $Revision: 1.1.8.1 $  $Date: 2004/08/10 01:49:58 $
  
hh = image(xdata,ydata,cdata, ...
           'BusyAction', 'cancel', ...
           'Parent', ax_handle, ...
           'CDataMapping', cdatamapping, ...
           'Interruptible', 'off');

% Set axes and figure properties if necessary to display the 
% image object correctly.
show_axes = iptgetpref('ImshowAxesVisible');
set(ax_handle, ...
    'YDir','reverse',...
    'TickDir', 'out', ...
    'XGrid', 'off', ...
    'YGrid', 'off', ...
    'DataAspectRatio', [1 1 1], ...
    'PlotBoxAspectRatioMode', 'auto', ...
    'Visible', show_axes);

if (~isempty(map))
    set(fig_handle, 'Colormap', map);
end

if (~isempty(clim))
    set(ax_handle, 'CLim', clim);
end

%store original cdata class in the image's appdata
setappdata(hh,'OriginalClass',class(cdata));

isIndexedUint16Image = strcmpi(get(hh,'CDataMapping'),'direct') && size(map,1) > 256;

% This is to workaround the problem of indexed image showing up black on
% windows.  G208494
if isIndexedUint16Image && ispc
  set(fig_handle,'Renderer','Zbuffer');
end
