Perhaps chapter 6 of the following document can help:
http://www.exelisvis.com/docs/pdf/ima...
Note that this document hasn't been updated since 2010. However, the concepts and approaches discussed are still valid.
Note also the example code provided on page 100 of the document has some errors and should actually appear as follows:
; Select the file, read the data and load the image’s color table.
imgFile = FILEPATH('earth.jpg', $
SUBDIRECTORY = ['examples', 'demo', 'demodata'])
image = READ_IMAGE(imgFile, /ORDER)
; Display the image using XROI. Specify a variable for REGIONS_OUT
; to save the ROI information.
XROI, image, REGIONS_OUT = oROIAfrica, /BLOCK
I hope this will help.