previous up next print clean
Next: WEIGHTING AND RECONSTRUCTING Up: Claerbout: Patch utilities Previous: INTRODUCTION

PARCELING

A plane of information, either data or an image, say wall(n1,n2) will be parcelled up into an array of overlapping windows each of size (w1,w2). You choose the number of windows by specifying (k1,k2). The fraction (w1*k1)/n1 measures overlap on the 1-axis. We can traverse all the windows, grabbing them from the wall, or putting them back, using subroutine patch() [*]. To run this traverse, we need only looping variables (j1,j2) to run from (1,1) to (k1,k2).

# patch -- copy a patch of information from a wall into a window.
#
subroutine patch(          conj,add, j1,j2, k1,k2, wall, n1,n2, wind, w1,w2)
integer i1,i2,s1,s2,d1,d2, conj,add, j1,j2, k1,k2,       n1,n2,       w1,w2
real                                               wall( n1,n2),wind( w1,w2)
call conjnull(             conj,add,               wall, n1*n2, wind, w1*w2)

if( k2 != 1) { s2 = 1.5 + (n2 - w2) * (j2-1.)/(k2-1.)} else { s2= 1} if( k1 != 1) { s1 = 1.5 + (n1 - w1) * (j1-1.)/(k1-1.)} else { s1= 1}

do i2= 1, w2 { d2= i2 + s2 - 1 do i1= 1, w1 { d1= i1 + s1 - 1 if( conj == 0 ) wind( i1,i2) = wind( i1,i2) + wall( d1,d2) else wall( d1,d2) = wall( d1,d2) + wind( i1,i2) }} return; end

In subroutine patch() [*] I redesigned the looping structure used in PVI. Now the patches are assured of abutting all edges of the given data plane even when n1/w1 and n2/w2 are not integers. With noninteger ratios, spacing of patches is slightly uneven but you will realize it does not matter after you see how easy it is to reassemble seamlessly the full plane from the patches.

The start (s1,s2) of the first window on the wall of data is at (1,1) and the last start is at the end of the wall (n1,n2) less the window width plus one. An exceptional case arises when the user specifies k1=1 which means the 1-axis contains only one window. Then unless w1==n1, the window cannot fit both the beginning and the end of the wall so it is arbitrarily fit only at the beginning. As in any code mixing integers with floats, to guard against having a floating point number, say 99.9999, rounding down to 99 instead of up to 100, the rule is to always add .5 to a floating point number the moment before converting it to an integer.

We should always use subroutine patch() for parceling and avoid copying any of its messy internals into our application code. Thus when a better method of parceling comes along, we have it all in one place and can change it all at once. Figure 1 shows an example.

 
parcel
Figure 1
A plane of identical values after parceling into patches and then adding all the patches. Results are shown for n1=100 w1=17 k1=5 n2=30 w2=6 k2=11 . For these parameters, there is gapping on the horizontal axis and overlap on the depth axis.

parcel
view burn build edit restore


previous up next print clean
Next: WEIGHTING AND RECONSTRUCTING Up: Claerbout: Patch utilities Previous: INTRODUCTION
Stanford Exploration Project
11/18/1997