Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions user/chenyk/Mdipln.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ int main(int argc, char*argv[])
sf_file in, out;
int m, n, n1, n2, n3, niter, liter;
int i3;
bool verb, slope;
bool verb, slope, sft_float[SF_MAX_DIM] = {false};
float **wav, **dip, radius, eta, dip0;
char *interp;

/*added for non-stationary regularization*/
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
float *rct[SF_MAX_DIM]; /* storing non-stationary smoothing radii */
int i, j, b, n123, dim;
float eps;
Expand Down Expand Up @@ -100,7 +101,10 @@ int main(int argc, char*argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand All @@ -115,14 +119,20 @@ int main(int argc, char*argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n123);
sft[i] = sf_intalloc (n123);
sft[i] = sf_floatalloc (n123);
/* non-stationary dip smoothness on 1st/2nd/3rd axis */

sf_floatread(rct[i],n123,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n123,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n123,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n123);
sf_intread(sft_read,n123,shift[i]);
for (j=0; j < n123; j++) sft[i][j] = (float)sft_read[j];
}
sf_fileclose(shift[i]);
} else {
for (j=0; j < n123; j++) {
Expand Down Expand Up @@ -165,6 +175,3 @@ int main(int argc, char*argv[])
free(wav);
return 0;
}



20 changes: 15 additions & 5 deletions user/chenyk/Mdipn.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ also see sfdip

int main (int argc, char *argv[])
{
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
bool sft_float[SF_MAX_DIM] = {false};
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
float *rct[SF_MAX_DIM]; /* storing non-stationary smoothing radii */
int n123, niter, order, nj1,nj2, i, j, liter, dim, b;
int n[SF_MAX_DIM], n4, nr, ir;
Expand Down Expand Up @@ -94,7 +96,10 @@ int main (int argc, char *argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand All @@ -109,14 +114,20 @@ int main (int argc, char *argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n123);
sft[i] = sf_intalloc (n123);
sft[i] = sf_floatalloc (n123);
/* non-stationary dip smoothness on 1st/2nd/3rd axis */

sf_floatread(rct[i],n123,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n123,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n123,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n123);
sf_intread(sft_read,n123,shift[i]);
for (j=0; j < n123; j++) sft[i][j] = (float)sft_read[j];
}
sf_fileclose(shift[i]);
} else {
for (j=0; j < n123; j++) {
Expand Down Expand Up @@ -299,4 +310,3 @@ int main (int argc, char *argv[])

exit (0);
}

20 changes: 15 additions & 5 deletions user/chenyk/Mdipn_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ also see sfdip

int main (int argc, char *argv[])
{
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
bool sft_float[SF_MAX_DIM] = {false};
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
float *rct[SF_MAX_DIM]; /* storing non-stationary smoothing radii */
int n123, niter, order, nj1,nj2, i, j, liter, dim, b;
int n[SF_MAX_DIM], n4, nr, ir;
Expand Down Expand Up @@ -94,7 +96,10 @@ int main (int argc, char *argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand All @@ -109,14 +114,20 @@ int main (int argc, char *argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n123);
sft[i] = sf_intalloc (n123);
sft[i] = sf_floatalloc (n123);
/* non-stationary dip smoothness on 1st/2nd/3rd axis */

sf_floatread(rct[i],n123,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n123,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n123,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n123);
sf_intread(sft_read,n123,shift[i]);
for (j=0; j < n123; j++) sft[i][j] = (float)sft_read[j];
}
sf_fileclose(shift[i]);
} else {
for (j=0; j < n123; j++) {
Expand Down Expand Up @@ -299,4 +310,3 @@ int main (int argc, char *argv[])

exit (0);
}

20 changes: 15 additions & 5 deletions user/chenyk/Mltftn.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

int main(int argc, char* argv[])
{
bool inv, verb;
bool inv, verb, sft_float[SF_MAX_DIM] = {false};
int i1, n1, iw, nt, nw, i2, n2, rect0, rectf, niter, n12, n1w;
int m[SF_MAX_DIM], *rect;
float t, d1, w, w0, dw, mean=0.0f, alpha;
Expand Down Expand Up @@ -122,7 +122,8 @@ int main(int argc, char* argv[])

/*box means maximum (edge) padding for triangle smoothing, box[i]=max(rect[i])*/
sf_file rects[SF_MAX_DIM], shift[SF_MAX_DIM];
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
float *rct[SF_MAX_DIM]; /* storing non-stationary smoothing radii */


Expand All @@ -148,7 +149,10 @@ int main(int argc, char* argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand Down Expand Up @@ -191,13 +195,19 @@ int main(int argc, char* argv[])
}
box[ii] = 1;
rct[ii] = sf_floatalloc (n21*nw*2);
sft[ii] = sf_intalloc (n21*nw*2);
sft[ii] = sf_floatalloc (n21*nw*2);

sf_floatread(rct[ii],n21*nw*2,rects[i]);
sf_fileclose(rects[i]);

if (NULL != shift[i]) {
sf_intread(sft[ii],n21*nw*2,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[ii],n21*nw*2,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n21*nw*2);
sf_intread(sft_read,n21*nw*2,shift[i]);
for (i1=0; i1 < n21*nw*2; i1++) sft[ii][i1] = (float)sft_read[i1];
}
sf_fileclose(shift[i]);
} else {
for (i1=0; i1 < n21*nw*2; i1++) {
Expand Down
20 changes: 15 additions & 5 deletions user/chenyk/Morthoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

int main(int argc, char* argv[])
{
bool verb, ifsm, ifnm, ifns;
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
bool verb, ifsm, ifnm, ifns, sft_float[SF_MAX_DIM] = {false};
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
int i, id, dim, n[SF_MAX_DIM], dim1, nd, i1, i2, i3, n1, n2,n3, b, nrad;
float *noi, *sig, *rat, *rat1, *noi2, *sig2, remove, alpha, beta, gamma;
char key[8];
Expand Down Expand Up @@ -69,7 +70,10 @@ int main(int argc, char* argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand Down Expand Up @@ -105,13 +109,19 @@ int main(int argc, char* argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n1);
sft[i] = sf_intalloc (n1);
sft[i] = sf_floatalloc (n1);

sf_floatread(rct[i],n1,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n1,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n1,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n1);
sf_intread(sft_read,n1,shift[i]);
for (i1=0; i1 < n1; i1++) sft[i][i1] = (float)sft_read[i1];
}
sf_fileclose(shift[i]);
} else {
for (i1=0; i1 < n1; i1++) {
Expand Down
20 changes: 15 additions & 5 deletions user/chenyk/Morthon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

int main(int argc, char* argv[])
{
bool verb;
int *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
bool verb, sft_float[SF_MAX_DIM] = {false};
int *sft_read=NULL;
float *sft[SF_MAX_DIM]; /* storing non-stationary shifting size */
float *rct[SF_MAX_DIM]; /* storing non-stationary smoothing radii */
int i, id, dim, n[SF_MAX_DIM], dim1, nd, niter, n1, n2, i1, b;
float *noi, *sig, *rat, *noi2, *sig2, eps, remove;
Expand Down Expand Up @@ -62,7 +63,10 @@ int main(int argc, char* argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand Down Expand Up @@ -94,13 +98,19 @@ int main(int argc, char* argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n1);
sft[i] = sf_intalloc (n1);
sft[i] = sf_floatalloc (n1);

sf_floatread(rct[i],n1,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n1,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n1,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n1);
sf_intread(sft_read,n1,shift[i]);
for (i1=0; i1 < n1; i1++) sft[i][i1] = (float)sft_read[i1];
}
sf_fileclose(shift[i]);
} else {
for (i1=0; i1 < n1; i1++) {
Expand Down
20 changes: 14 additions & 6 deletions user/chenyk/Msmoothn.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Example: chenyk/ortho_non/nsmooth

int main (int argc, char* argv[])
{
int *sft[SF_MAX_DIM];
bool sft_float[SF_MAX_DIM] = {false}; int *sft_read=NULL;
float *sft[SF_MAX_DIM];
int box[SF_MAX_DIM], n[SF_MAX_DIM];
int dim, dim1, i, n1, n2, i1, i2, b, nrep;
float *data, *smoo, *rct[SF_MAX_DIM];
Expand Down Expand Up @@ -56,7 +57,10 @@ int main (int argc, char* argv[])
if (NULL != sf_getstring(key)) {
/*( shift# shifting of the smoothing stencil in #-th dimension /auxiliary input file/ )*/
shift[i] = sf_input(key);
if (SF_INT != sf_gettype(shift[i])) sf_error("Need int %s",key);
if (SF_INT != sf_gettype(shift[i])) {
sft_float[i] = true;
if (SF_FLOAT != sf_gettype(shift[i])) sf_error("Need int or float %s",key);
}
} else {
shift[i] = NULL;
}
Expand All @@ -82,13 +86,19 @@ int main (int argc, char* argv[])
box[i] = 1;
if (NULL != rect[i]) {
rct[i] = sf_floatalloc (n1);
sft[i] = sf_intalloc (n1);
sft[i] = sf_floatalloc (n1);

sf_floatread(rct[i],n1,rect[i]);
sf_fileclose(rect[i]);

if (NULL != shift[i]) {
sf_intread(sft[i],n1,shift[i]);
if (sft_float[i]) {
sf_floatread(sft[i],n1,shift[i]);
} else {
if (NULL == sft_read) sft_read = sf_intalloc(n1);
sf_intread(sft_read,n1,shift[i]);
for (i1=0; i1 < n1; i1++) sft[i][i1] = (float)sft_read[i1];
}
sf_fileclose(shift[i]);
} else {
for (i1=0; i1 < n1; i1++) {
Expand Down Expand Up @@ -120,5 +130,3 @@ int main (int argc, char* argv[])

exit (0);
}


Loading