Download the example image test_grid_512.tif, then start up giplt.
First load the image:
im = ost.io.LoadImage("test_grid_512.tif")
The image has now been loaded and is available via the python variable im. In order to display the image, a viewer must be opened:
v=Viewer(im)
The viewer will open as a separate widget (figure 1); it is nevertheless also accessible via the variable v, and the importance of this will become clear further below. (From the Window menu of the viewer, the Info, Zoom and Overlay helper windows may be turned on).
The manual lattice fitting needs to be performed on the Fourier-transform if this image, and this is most conveniently done with a quick in-place application of the FFT algorithm from the alg module.
im.ApplyIP(ost.img.alg.FFT())
The viewer will change to reflect the new content, but since the normalization and centering needs to be updated, the key shortcuts C (for Centering) and N (for Normalization) should be pressed while the focus is in the viewer.
Using the mouse-wheel or the keys K/L to zoom, the contrast of the Fourier transform is still somewhat bad, this can be fixed by selecting a small region around a peak (using the left mouse button), and then pressing N again - the viewer will maximize contrast for the pixels contained within the selected subregion.
Now its time to add the lattice overlay, which is a 2-step process: a lattice overlay object is first created and then added to the viewer. Since the code that will be used from this point on uses the iplt module and its GUI components, we need to import the proper modules before anything else:
# import the iplt module and the iplt.gui
import iplt
import iplt.gui
# create lattice overlay
lov=iplt.gui.LatticeOverlay()
# add newly created overlay to viewer
v.AddOverlay(lov)
The result is shown on the left side of the figure 3. Note that upon editing the lattice, a new one appears in a different color (as shown on the right), while the old one remains as it is. In order to fix the new lattice, use CTRL F, and to revert back to the old one use CTRL R.
The following functionality is now available to to fit the lattice to the underlying pattern: