topimdisp
Picture
Parameters
IMAGE
in
required
Keywords
RANGE
type: vector
default: min and max array values
BOTTOM
default: 0
NCOLORS
default: !D.TABLE_SIZE - BOTTOM
MARGIN
default: 0.1 or 0.025 if !P.MULTI is set to display multiple images
INTERP
default: nearest neighbor sampling
DITHER
default: no dithering
ASPECT
default: maintain native aspect ratio
POSITION
default: [0.0,0.0,1.0,1.0]
OUT_POS
NOSCALE
default: to byte-scale the image
NORESIZE
default: To resize the image to fit the display
ORDER
default: To display the image from the bottom up
USEPOS
default: To honor ASPECT and MARGIN when POSITION vector is supplied
CHANNEL
BACKGROUND
ERASE
AXIS
NEGATIVE
Examples
;- Load test data
openr, lun, filepath('ctscan.dat', subdir='examples/data'), /get_lun
ctscan = bytarr(256, 256)
readu, lun, ctscan
free_lun, lun
openr, lun, filepath('hurric.dat', subdir='examples/data'), /get_lun
hurric = bytarr(440, 330)
readu, lun, hurric
free_lun, lun
read_jpeg, filepath('rose.jpg', subdir='examples/data'), rose
help, ctscan, hurric, rose
;- Display single images
!p.multi = 0
loadct, 0
imdisp, hurric, /erase
wait, 3.0
imdisp, rose, /interp, /erase
wait, 3.0
;- Display multiple images without color table splitting
;- (works on 24-bit displays only; top 2 images are garbled on 8-bit displays)
!p.multi = [0, 1, 3, 0, 0]
loadct, 0
imdisp, ctscan, margin=0.02
loadct, 13
imdisp, hurric, margin=0.02
imdisp, rose, margin=0.02
wait, 3.0
;- Display multiple images with color table splitting
;- (works on 8-bit or 24-bit displays)
!p.multi = [0, 1, 3, 0, 0]
loadct, 0, ncolors=64, bottom=0
imdisp, ctscan, margin=0.02, ncolors=64, bottom=0
loadct, 13, ncolors=64, bottom=64
imdisp, hurric, margin=0.02, ncolors=64, bottom=64
imdisp, rose, margin=0.02, ncolors=64, bottom=128
wait, 3.0
;- Display an image at a specific position, over-riding aspect and margin
!p.multi = 0
loadct, 0
imdisp, hurric, position=[0.0, 0.0, 1.0, 0.5], /usepos, /erase
wait, 3.0
;- Display an image with axis overlay
!p.multi = 0
loadct, 0
imdisp, rose, /axis, /erase
wait, 3.0
;- Display an image with contour plot overlay
!p.multi = 0
loadct, 0
imdisp, hurric, out_pos=out_pos, /erase
contour, smooth(hurric, 10, /edge), /noerase, position=out_pos, $
xstyle=1, ystyle=1, levels=findgen(5)*40.0, /follow
wait, 3.0
;- Display a small image with correct resizing
!p.multi = 0
loadct, 0
data = (dist(8))[1:7, 1:7]
imdisp, data, /erase
wait, 3.0
imdisp, data, /interp
wait, 3.0
;- Display a true color image without and with interpolation
!p.multi = 0
imdisp, rose, /erase
wait, 3.0
imdisp, rose, /interp
wait, 3.0
;- Display a true color image as a photographic negative
imdisp, rose, /negative, /erase
wait, 3.0
;- Display a true color image on PostScript output
;- (note that color table is handled automatically)
current_device = !d.name
set_plot, 'PS'
device, /color, bits_per_pixel=8, filename='imdisp_true.ps'
imdisp, rose, /axis, title='PostScript True Color Output'
device, /close
set_plot, current_device
;- Display a pseudo color image on PostScript output
current_device = !d.name
set_plot, 'PS'
device, /color, bits_per_pixel=8, filename='imdisp_pseudo.ps'
loadct, 0
imdisp, hurric, /axis, title='PostScript Pseudo Color Output'
device, /close
set_plot, current_device
;- Display an image where only the offset and size are known
;- Read world elevation data
file = filepath('worldelv.dat', subdir='examples/data')
openr, lun, file, /get_lun
data = bytarr(360, 360)
readu, lun, data
free_lun, lun
;- Reorganize array so it spans 180W to 180E
world = data
world[0:179, *] = data[180:*, *]
world[180:*, *] = data[0:179, *]
;- Create remapped image
map_set, /orthographic, /isotropic, /noborder
remap = map_image(world, x0, y0, xsize, ysize, compress=1)
;- Convert offset and size to position vector
pos = fltarr(4)
pos[0] = x0 / float(!d.x_vsize)
pos[1] = y0 / float(!d.y_vsize)
pos[2] = (x0 + xsize) / float(!d.x_vsize)
pos[3] = (y0 + ysize) / float(!d.y_vsize)
;- Display the image
loadct, 0
imdisp, remap, pos=pos, /usepos
map_continents
map_grid
Version history
Version
$Id: imdisp.pro 325 2007-12-06 10:04:53Z pinsard $
History
Known issues
Restrictions
The image is displayed on the current graphics device.
Requires IDL 5.0 or higher (square bracket array syntax).
Statistics
McCabe cyclic | 76 |
McCabe essential | 1 |
McCabe modular design | 1 |