ENVIView::PixelLink
The PixelLink method links views by pixel for use with tools such as Pan, Fly, and Zoom, so that all linked views update locations at the same time. The PixelLink method is useful when georeferencing information is not available for use with ENVIView::GeoLink. You can have more than one linked set of views at a time (example: views 1 and 2 are one linked set, views 3 and 4 are a second linked set). A view may be a member of only one linked set at a time.
The specific ENVIView where you issue the PixelLink method becomes the lead (or anchor) view that determines the pixel location from which all linked views are centered. To specify a different ENVIView as the anchor, execute the PixelLink method on that view.
If you do not specify the Views argument and set the LINK_ALL keyword, then all existing views will be pixel linked. If you specify the Views argument when using the PixelLink method, then those views will be pixel linked.
Example
This is an interactive example that shows how to perform pixel linking with four images. Views are organized as follows:
Display Layers in Multiple Views
Copy and paste the following code into the IDL command line.
; Launch the application
e = ENVI()
; Open two ENVIRasters
file1 = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster1 = e.OpenRaster(file1)
; Display the rasters in four views
view1 = e.GetView()
layer1 = view1.CreateLayer(raster1)
view2 = e.CreateView()
layer2 = view2.CreateLayer(raster1)
view3 = e.CreateView()
layer3 = view3.CreateLayer(raster1, BANDS = [3, 1, 2])
view4 = e.CreateView()
layer4 = view4.CreateLayer(raster1, BANDS = [0, 2, 3])
Create a Pixel Link
- Pixel-link Views 1 (anchor) and 3.
- Pan View 3. View 1 pans with it.
- Pan View 2. No other views pan with it.
view1.PixelLink, view3
view3.Pan, 50, 50
view2.Pan, 50, 50
Create a Second Pixel Link
- Link Views 2 (anchor) and 4.
- Pan View 2. View 4 pans with it.
- Pan View 1. Views 1 and 3 pan, while 2 and 4 do not.
- Remove the link set of Views 2 and 4.
- Link View 4 to View 1. View 3 is no longer in the linked group.
- Add View 2 to the linked group (Views 1 and 4).
- Pan View 1. Views 2 and 4 also pan.
- Remove View 1 from the linked group.
view2.PixelLink, view4
view2.Pan, 50, 50
view1.Pan, 50, 50
view2.PixelLink, /REMOVE
view1.PixelLink, view4
view1.PixelLink, view2, /ADD
view1.Pan, 100, -100
view1.PixelLink, /REMOVE
Remove All Views from the Pixel Link
- Remove all views.
- Pan each view. Each one pans individually.
view2.PixelLink, /UNLINK_ALL
view1.Pan, 20, 20
view2.Pan, 30, -50
view3.Pan, 10, -20
view4.Pan, -20, 5
Syntax
ENVIView.PixelLink [, Keywords=value]
Arguments
Views
Specify an ENVIView, or an array of ENVIViews, to link by pixel with the current view.
Keywords
Keywords are applied only during the initial creation of the object.
ADD
Set this keyword to add views to an existing pixel-linked group of views. If you set this keyword on an ENVIView that is not part of an existing pixel-linked group, then a new pixel-linked group will be created.
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''
). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
LINK_ALL
Set this keyword to link all views by pixel. This keyword takes precedence over the optional Views argument.
REMOVE
Set this keyword to remove the view from the pixel link. If the view to remove is the anchor view and is linked to two or more views, the anchor is reassigned to the first remaining view. If the view to remove is one of only two views, then the linked set is dissolved.
ROTATE_LINK
Use this keyword to establish a new rotate link by specifying which views will rotate together. Use the UPDATE_ROTATE_LINK thereafter to link or unlink views from the rotate link. Here are the options for using this keyword:
-
Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that rotate linking is enabled for the corresponding view. Suppose you have five pixel-linked views where View 1 is the anchor view, and you want Views 1, 2 and 5 to rotate together. View 1 is automatically included in the rotate link, so you do not need to explicitly specify that view with ROTATE_LINK. Use the following code:
-
Set the keyword as follows when adding a new view to an existing pixel link. This example adds View 4 to the rotate link:
-
Set the keyword in combination with LINK_ALL to enable rotate linking on all views.
-
If you subsequently set the REMOVE or UNLINK_ALL keywords, the rotate link setting is also removed.
view1.PixelLink, [view2, view3, view5], ROTATE_LINK=[1, 0, 1]
view1.PixelLink, view4, /ADD, /ROTATE_LINK
view1.PixelLink, /LINK_ALL, /ROTATE_LINK
UNLINK_ALL
Set this keyword to unlink all of the views. This keyword takes precedence over the optional Views argument.
UPDATE_ROTATE_LINK
Use this keyword to update an existing rotate link (set with the ROTATE_LINK keyword) for the views specified by the Views argument. The views must be already linked to the anchor view on which the PixelLink method was invoked. Here are the options for using this keyword:
- Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that rotate linking is enabled for the corresponding view. Suppose you have four pixel-linked views that all rotate together (rotate linking is enabled for all views), and you want to disable rotate linking for views 2 and 4. Use the following code:
- Set the keyword as follows to include View 2 with the existing rotate link:
view1.PixelLink, [view2, view3, view4], UPDATE_ROTATE_LINK=[0, 1, 0]
view1.PixelLink, view2, UPDATE_ROTATE_LINK=1
UPDATE_ZOOM_LINK
Use this keyword to update an existing zoom link (set with the ZOOM_LINK keyword) for the views specified by the Views argument. The views must be already linked to the anchor view on which the PixelLink method was invoked. Here are the options for using this keyword:
- Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that zoom linking is enabled for the corresponding view. Suppose you have four pixel-linked views that all zoom together (zoom linking is enabled for all views), and you want to disable zoom linking for views 2 and 4. Use the following code:
- Set the keyword as follows to include View 2 with the existing zoom link:
view1.PixelLink, [view2, view3, view4], UPDATE_ZOOM_LINK=[0, 1, 0]
view1.PixelLink, view2, UPDATE_ZOOM_LINK=1
ZOOM_LINK
Use this keyword to establish a new zoom link, by specifying which views will zoom together. Use the UPDATE_ZOOM_LINK thereafter to link or unlink views from the zoom link. Here are the options for using this keyword:
- Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that zoom linking is enabled for the corresponding view. Suppose you have five pixel-linked views where View 1 is the anchor view, and you want Views 1, 2 and 5 to zoom together. View 1 is automatically included in the zoom link, so you do not need to explicitly specify that view with ZOOM_LINK. Use the following code:
- Set the keyword as follows when adding a new view to an existing pixel link. This example adds View 4 to the zoom link:
- Set the keyword in combination with LINK_ALL to enable zoom linking on all views.
- If you subsequently set the REMOVE or UNLINK_ALL keywords, the zoom link setting is also removed.
view1.PixelLink, [view2, view3, view5], ZOOM_LINK=[1, 0, 1]
view1.PixelLink, view4, /ADD, /ZOOM_LINK
view1.PixelLink, /LINK_ALL, /ZOOM_LINK
Version History
ENVI 5.2 |
Introduced |
ENVI 5.6 |
Added ROTATE_LINK and UPDATE_ROTATE_LINK keywords |
API Version
4.2