00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 """
00055 DESCRIPTION:
00056 Pad image adiabatically (Neumann conditions)
00057
00058 PARAMETERS:
00059 A: The image to be padded
00060
00061 REQUIREMENTS:
00062 - Python
00063
00064 Author:
00065 Reza Shahidi
00066 Seismic Laboratory for Imaging and Modeling (SLIM)
00067 Department of Earth & Ocean Sciences (EOS)
00068 University of British Columbia (UBC)
00069
00070 You may use this code only under the conditions and terms of the
00071 license contained in the file LICENSE provided with this source
00072 code. If you do not agree to these terms you may not use this
00073 software.
00074 """
00075
00076 import numpy as np
00077 from numpy import *
00078
00079 def PadAdiabatic(A):
00080 """
00081 @param A The input image which we wish to pad
00082 """
00083
00084
00085
00086
00087
00088
00089
00090 (n, m) = A.shape
00091 Ae = np.zeros((n+2, m+2), 'f')
00092
00093
00094 for i in range(1,n+1):
00095 for j in range(1,m+1):
00096 Ae[i][j] = A[i-1][j-1]
00097
00098
00099 for j in range(1,m+1):
00100 Ae[0][j] = A[0][j-1]
00101 Ae[n+1,j] = A[n-1][j-1]
00102
00103 for i in range(1,n+1):
00104 Ae[i][0]=A[i-1][0]
00105 Ae[i][m+1]=A[i-1][m-1]
00106
00107
00108 Ae[0][0]=A[0][0]
00109 Ae[0][m+1]=A[0][m-1]
00110 Ae[n+1][0]=A[n-1][0]
00111 Ae[n+1][m+1]=A[n-1][m-1]
00112
00113 return Ae