I thought that this would not be so difficult, but I think there is a small bug in iImage, which limits the options for how to do this. The strange iImage behavior is this: You can reverse the display of the YRANGE (probably any axis range) when you initialize iTools, but you cannot seem to reverse it afterward. That is, if I call IIMAGE with this syntax:
iimage, myImage, YRANGE=[148,0]
then the 0 coordinate of the Y-axis will print at the top of the Y-axis. However, if I simply call "iimage, myImage" I cannot later "Get" the vertical axis objects and have them reverse their tick value display ... not by modifying their default "[0,148]" RANGE property to "[148,0]", not by giving an explicit TICKVALUES value that is descending in magnitude.
I would not care, if there were not a logical, but unfortunate, side-effect from setting IIMAGE's YRANGE keyword to a descending range ... namely, it flips the 'myImage' array in the initial display. Setting YRANGE has another weakness: the effect of this call is not immediately visilble on the new IIMAGE window (a known bug).
In any case, there are both user interface and programmatic steps that can work around these weaknesses. The solution in both cases is to a) change one property setting of the 'Axes' Container object, and b) flip the Image visualization vertically. Luckily, the Image object flips by itself without automatically simultaneously flipping its vertical axis. I show the programmatic steps here.
Here are the code steps demonstrating IDL's built-in example image, 'rose.jpg':
iimage, image, YRANGE=[148,0]
; Whoops, the rose image is upside down!
idTool = itgetcurrent(TOOL=oTool)
idAxesContainer = oTool->FindIdentifiers('*AXES', /CONTAINER)
; This is all that is needed to bring the axes into view. I should warn that,
; although YRANGE from my IIMAGE call DOES get set properly, it is a
; known bug that some of the other [XYZ]... axis keywords for IIMAGE
; are ignored because the axes container STYLE property is set to 0
; when IIMAGE initializes. THOSE keywords would have to be replaced
; by subsequent 'DoSetProperty' calls after this one right below:
void = oTool->DoSetProperty(idAxesContainer, 'STYLE', 2)
idImage = (oTool->FindIdentifiers('*IMAGE', /VISUALIZATION))[0]
oImage = oTool->GetByIdentifier(idImage)
idFlipOp = (oTool->FindIdentifiers('*FLIPVERTICAL*', /OPERATION))[0]
; Image object must be in focus before we execute the flip operation.
oImage->Select
success = oTool->DoAction(idFlipOp)
oTool->CommitActions
James Jones
ITT Technical Support
|