Drawing on top of seismic data

1.3.4 Drawing on top of seismic data

Often it is useful to draw lines or even filled polygons on top of a seismic data display. This is quite easily done using MATLAB’s line and patch commands. Only line is discussed here.

Code Snippet 1.3.8 loads the small sample shot record and displays it. The command ginput halts execution of the script and transfers focus to the current figure. There, the cursor will be changed to a crosshairs and the user is expected to enter a sequence of mouse clicks to define a series of points. In the example shown in Figures 1.16 and 1.17, six points were entered along the first breaks. ginput expects the points to be selected by simple mouse clicks and then the “enter” key is hit to signal completion. The six points are returned as a vector of x coordinates, xpick, and a vector of t coordinates, tpick. Though it is a useful tool, ginput does note provide a picking facility such as that described previously. However, ginput works with any MATLAB graphics display while the picking facility is only available with plotimage .

The call to line plots the points on top of the seismic image. The return value from line is the graphics handle of the line. THe function line will accept vectors of the x, y, and possibly z

18 CHAPTER 1. INTRODUCTION coordinates of the nodes of the line to be drawn. If no z coordinates are given, they are assumed

zero which causes them to be drawn in the same z plane as the seismic (MATLAB graphics are always 3D even when they appear to be only 2D). Plotting the line at z = 0 usually works but if more mouse clicks are done on the figure, such as for zooming, then it can happen that the line may get re-drawn first with the seismic on top of it. This causes the line to “disappear”. Instead, it is more robust to give the line a vector of z coordinates of unity so that it is guaranteed to always be in front of the seismic.

In addition to (x, y, z) coordinates, line accepts an arbitrary length list of (attribute, property) pairs that define various features of the line. In this case, its color is set to red, its line thickness is set to twice normal, and markers are added to each point. There are many other possible attributes that can be set in this way. To see a list of them, issue the command get(h) where h is the handle of a line and MATLAB will display a complete property list. Once the line has been drawn, you can alter any of its properties with the set command. For example, set(h,’color’,’c’) changes the line color to cyan and set(h,’ydata’,get(h,’ydata’)+.1) shifts the line down .1 seconds.

Code Snippet 1.3.8. This example displays the small sample shot record using plotimage and then uses ginput to allow the user to enter points. These points are plotted on top of the seismic data using line. The results are in Figures 1.16 and 1.17.

1 load smallshot

2 global SCALE_OPT CLIP

3 SCALE_OPT=1;CLIP=1;

4 plotimage(seis,t,x)

5 axis([0 1000 0 1])

6 [xpick,tpick]=ginput;

7 h=line(xpick,tpick,ones(size(xpick)),’color’,’r’,...

8 ’linewidth’,2,’marker’,’*’);

End Code