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 #include "matrixbk.hh"
00053 #include "orbitbk.hh"
00054 #include "slcimage.hh"
00055 #include "productinfo.hh"
00056 #include "constants.hh"
00057 #include "utilities.hh"
00058 #include "ioroutines.hh"
00059 #include "step1routines.hh"
00060 #include "coregistration.hh"
00061 #include "referencephase.hh"
00062 #include "products.hh"
00063 #include "geocode.hh"
00064 #include "unwrap.hh"
00065 #include "filtering.hh"
00066 #include "conversion.hh"
00067 #include "exceptions.hh"
00068
00069 #include "bk_baseline.hh"
00070
00071 #include <iostream>
00072 #include <fstream>
00073 #include <ctime>
00074 #include <cstdlib>
00075 #include <cctype>
00076 #include <algorithm>
00077 #include <cstring>
00078 #include <csignal>
00079
00080
00081
00082
00083
00084
00085
00086 bk_messages TRACE;
00087 bk_messages DEBUG;
00088 bk_messages INFO;
00089 bk_messages PROGRESS;
00090 bk_messages WARNING;
00091 bk_messages ERROR;
00092 bk_messages matDEBUG;
00093 bk_messages matERROR;
00094
00095
00096 #ifdef __DEBUGMAT2 // use index checking, alloc
00097 uint totalallocated=0;
00098 #endif
00099
00100
00101
00102
00103 void initmessages();
00104 void usage(char *programname);
00105 void handleinput(int argc, char* argv[], input_gen &for_inputfilename);
00106 void quote();
00107 void copyright();
00108 void preview(int32 previewflag, int32 width, int32 informat, char *infile, char *outfile, char *opts);
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 int main(
00125 int argc,
00126 char* argv[])
00127 {
00128
00129 CatchSignals(handle_signal);
00130
00131 try{
00132
00133 initmessages();
00134
00135
00136 char ident[] = "@(#)Doris InSAR software, $Revision: 3.43 $, $Author: kampes $";
00137 cerr << endl;
00138 INFO.print(ident);
00139
00140
00141 input_gen input_general;
00142
00143 input_ell input_ellips;
00144 input_pr_orbits input_porbits;
00145 input_readfiles input_m_readfiles;
00146 input_crop input_m_crop;
00147 input_oversample input_m_oversample;
00148
00149 input_readfiles input_s_readfiles;
00150 input_crop input_s_crop;
00151 input_oversample input_s_oversample;
00152 input_filtazi input_ms_filtazi;
00153 input_resample input_s_resample;
00154
00155 input_coarsecorr input_i_coarsecorr;
00156 input_fine input_i_fine;
00157 input_coregpm input_i_coregpm;
00158 input_filtrange input_ms_filtrange;
00159 input_interfero input_i_interfero;
00160 input_coherence input_i_coherence;
00161 input_comprefpha input_i_comprefpha;
00162 input_subtrrefpha input_i_subtrrefpha;
00163 input_comprefdem input_i_comprefdem;
00164 input_subtrrefdem input_i_subtrrefdem;
00165 input_filtphase input_i_filtphase;
00166 input_dinsar input_i_dinsar;
00167 input_unwrap input_i_unwrap;
00168 input_slant2h input_i_slant2h;
00169 input_geocode input_i_geocode;
00170
00171
00172
00173 slcimage master;
00174 slcimage slave;
00175 productinfo interferogram;
00176 productinfo unwrappedinterf;
00177
00178 productinfo radarcodedrefdem;
00179 productinfo coherence;
00180 productinfo heightinradarsystem;
00181
00182
00183
00184 orbit masterorbit;
00185 orbit slaveorbit;
00186
00187
00188
00189 matrix<real8> coeff_cpmL;
00190 matrix<real8> coeff_cpmP;
00191 matrix<real8> coeff_flat;
00192
00193
00194
00195
00196 handleinput(argc,argv,input_general);
00197 printcpu(1);
00198 readinput(input_general,
00199 input_ellips,
00200 input_porbits,
00201 input_m_readfiles,
00202 input_m_crop,
00203 input_m_oversample,
00204 input_s_readfiles,
00205 input_s_crop,
00206 input_s_oversample,
00207 input_ms_filtazi,
00208 input_i_coarsecorr,
00209 input_i_fine,
00210 input_i_coregpm,
00211 input_s_resample,
00212 input_ms_filtrange,
00213 input_i_interfero,
00214 input_i_coherence,
00215 input_i_comprefpha,
00216 input_i_subtrrefpha,
00217 input_i_comprefdem,
00218 input_i_subtrrefdem,
00219 input_i_filtphase,
00220 input_i_dinsar,
00221 input_i_unwrap,
00222 input_i_slant2h,
00223 input_i_geocode);
00224
00225 inittest();
00226
00227 masterorbit.set_interp_method(input_general.orb_interp);
00228 slaveorbit.set_interp_method(input_general.orb_interp);
00229
00230 TRACE_FUNCTION("main");
00231
00232
00233
00234
00235 initwrite(input_general.logfile, LOGID);
00236 bool processmaster = doinitwrite(input_general, MASTERID);
00237 bool processlave = doinitwrite(input_general, SLAVEID);
00238 bool processinterf = doinitwrite(input_general, INTERFID);
00239 if (processmaster)
00240 initwrite(input_general.m_resfile, MASTERID);
00241 if (processlave)
00242 initwrite(input_general.s_resfile, SLAVEID);
00243 if (processinterf)
00244 initwrite(input_general.i_resfile, INTERFID);
00245 updatefile("scratchreadinput",input_general.logfile);
00246
00247
00248
00249
00250 int16 alreadyprocessed[NUMPROCESSES];
00251 checkprocessing(input_general,alreadyprocessed);
00252
00253 DEBUG.print("Time spent for initialization:");
00254 printcpu();
00255 PROGRESS.print("Finished initialization");
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 if (input_general.process[pr_m_readfiles])
00266 {
00267 PROGRESS.print("Start M_READFILES.");
00268 alreadyprocessed[pr_m_readfiles]=1;
00269 if (input_general.interactive)
00270 {
00271 cerr << "\nProcessing readfiles for master.";
00272 getanswer();
00273 }
00274
00275
00276 switch (input_m_readfiles.sensor_id)
00277 {
00278
00279 case SLC_JERS:
00280 INFO.print("JERS: Under development: is JERS really CEOS like ERS?");
00281
00282 case SLC_RSAT:
00283 WARNING.print("RSAT: for orbit highest polyfit recommended.");
00284 WARNING.print("RSAT: Under development: CEOS reader seems to work.");
00285
00286 case SLC_ERS:
00287
00288 char c16checkvol1[17];
00289 char c16checkvol2[17];
00290 char c16checkvol3[17];
00291 if (alreadyprocessed[pr_s_readfiles])
00292 {
00293 readres(c16checkvol1,sizeof(c16checkvol1),
00294 input_general.s_resfile,"Volume_ID:");
00295 readres(c16checkvol2,sizeof(c16checkvol2),
00296 input_general.s_resfile,"Volume_identifier:");
00297 readres(c16checkvol3,sizeof(c16checkvol3),
00298 input_general.s_resfile,"Volume_set_identifier:");
00299 }
00300
00301 readvolume(input_m_readfiles,
00302 c16checkvol1, c16checkvol2, c16checkvol3);
00303
00304 updatefile("scratchresvol",input_general.m_resfile);
00305
00306 updatefile("scratchlogvol",input_general.logfile);
00307
00308 char c8checkleadat[9];
00309 readres(c8checkleadat,sizeof(c8checkleadat),
00310 input_general.m_resfile,"(Check)Number",5);
00311
00312
00313 readleader(input_m_readfiles, atoi(c8checkleadat)-1);
00314
00315 updatefile("scratchreslea",input_general.m_resfile);
00316
00317 updatefile("scratchloglea",input_general.logfile);
00318
00319
00320
00321
00322
00323
00324 readdat(input_m_readfiles, atoi(c8checkleadat)-1);
00325
00326 updatefile("scratchresdat",input_general.m_resfile);
00327
00328 updatefile("scratchlogdat",input_general.logfile);
00329 break;
00330
00331 case SLC_ASAR:
00332 INFO.reset();
00333 INFO << "envisat_dump_header2doris.csh "
00334 << input_m_readfiles.datfile
00335 << " > scratchres_envisat" << endl << ends;
00336 char cmd[512];
00337 strcpy(cmd, INFO.get_str());
00338 INFO.print("With following command the envisat header was read.");
00339 INFO.print(cmd);
00340 PROGRESS.print("Making system call to envisat_dump_header2doris.csh");
00341 PROGRESS.print("(also requires envisat_dump_header program)");
00342 system(cmd);
00343 INFO.reset();
00344 PROGRESS.print("Finished system call to envisat_dump_header2doris.csh");
00345
00346 updatefile("scratchres_envisat",input_general.m_resfile);
00347
00348 updatefile("envisat_dump_header.log",input_general.logfile);
00349 break;
00350 default:
00351 PRINT_ERROR("impossible error for checked input.")
00352 throw(input_error);
00353 }
00354 PROGRESS.print("Finished M_READFILES.");
00355 DEBUG.print("Time spent for reading files master:");
00356 printcpu();
00357 }
00358
00359
00360 if (existed(input_general.m_resfile))
00361 {
00362 master.fillslcimage(input_general.m_resfile);
00363 interferogram.win = master.currentwindow;
00364 }
00365
00366
00367 DEBUG.print("Correction for master image timing errors if specified");
00368 DEBUG << "rg_timing_error: " << input_m_readfiles.rg_timing_error;
00369 DEBUG.print();
00370 DEBUG << "az_timing_error: " << input_m_readfiles.az_timing_error;
00371 DEBUG.print();
00372 master.add_rg_t_error(input_m_readfiles.rg_timing_error);
00373 master.add_az_t_error(input_m_readfiles.az_timing_error);
00374
00375
00376
00377
00378 if (input_general.process[pr_m_porbits])
00379 {
00380 PROGRESS.print("Start M_PORBITS.");
00381 alreadyprocessed[pr_m_porbits]=1;
00382 if (input_general.interactive)
00383 {
00384 cerr << "\nProcessing get precise orbits for master.";
00385 getanswer();
00386 }
00387
00388 getorb(master,input_porbits,MASTERID);
00389 convertgetorbout(MASTERID);
00390
00391 updatefile("scratchdatapoints",input_general.m_resfile);
00392
00393 removedatleader(input_general.m_resfile);
00394 PROGRESS.print("Finished M_PORBITS.");
00395 DEBUG.print("Time spent for obtaining precise orbits master:");
00396 printcpu();
00397 }
00398
00399
00400 if (alreadyprocessed[pr_m_porbits] ||
00401 alreadyprocessed[pr_m_readfiles])
00402 masterorbit.initialize(input_general.m_resfile);
00403
00404
00405
00406
00407 masterorbit.dumporbit(input_porbits,MASTERID);
00408
00409
00410
00411
00412 if (input_general.process[pr_m_crop])
00413 {
00414 PROGRESS.print("Start M_CROP.");
00415 alreadyprocessed[pr_m_crop]=1;
00416 if (input_general.interactive)
00417 {
00418 cerr << "\nProcessing crop for master.";
00419 getanswer();
00420 }
00421
00422
00423 if (input_m_crop.dbow_geo.pixhi != 0)
00424 {
00425 PROGRESS.print("Computing crop based on center lat/lon/height/width.");
00426 real8 centerline, centerpix;
00427 real8 centerphi = deg2rad(input_m_crop.dbow_geo.linelo/1e6-360.0);
00428 real8 centerlambda = deg2rad(input_m_crop.dbow_geo.linehi/1e6-360.0);
00429
00430 real8 centerheight = input_general.terrain_height;
00431 DEBUG.print("Using height of HEIGHT card");
00432 DEBUG << "CROP: center lat/lon/hei: "
00433 << centerphi << " " << centerlambda << " " << centerheight;
00434 DEBUG.print();
00435 cn centerpos;
00436 ell2xyz(input_ellips,centerpos,centerphi,centerlambda,centerheight);
00437 DEBUG << "Converted M_DBOW_GEO phi,lambda --> x,y,z: "
00438 << centerphi << ", " << centerlambda << ", " << " --> "
00439 << centerpos.x << " " << centerpos.y << " " << centerpos.z;
00440 DEBUG.print();
00441 DEBUG << "Center master SLC: x,y,z: "
00442 << master.approxcentreoriginal.x << " "
00443 << master.approxcentreoriginal.y << " "
00444 << master.approxcentreoriginal.z;
00445 DEBUG.print();
00446 if (abs(master.approxcentreoriginal.x-centerpos.x)>50000.0)
00447 WARNING.print("M_DBOW_GEO: coordinates seem to be outside SLC area? (X)");
00448 if (abs(master.approxcentreoriginal.y-centerpos.y)>50000.0)
00449 WARNING.print("M_DBOW_GEO: coordinates seem to be outside SLC area? (Y)");
00450 if (abs(master.approxcentreoriginal.z-centerpos.z)>50000.0)
00451 WARNING.print("M_DBOW_GEO: coordinates seem to be outside SLC area? (Z)");
00452 int32 n_iter = xyz2lp(centerline, centerpix,
00453 master, masterorbit, centerpos,
00454 10, 1e-3);
00455
00456
00457
00458
00459 DEBUG << "CROP: center line/pix: " << centerline << " " << centerpix;
00460 DEBUG.print();
00461 int32 l0 = int32(centerline+0.5) - input_m_crop.dbow_geo.pixlo/2;
00462 int32 lN = l0 + input_m_crop.dbow_geo.pixlo - 1;
00463 int32 p0 = int32(centerpix+0.5) - input_m_crop.dbow_geo.pixhi/2;
00464 int32 pN = p0 + input_m_crop.dbow_geo.pixhi - 1;
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475 if (l0 < int32(master.currentwindow.linelo)) l0 = master.currentwindow.linelo;
00476 if (lN > int32(master.currentwindow.linehi)) lN = master.currentwindow.linehi;
00477 if (p0 < int32(master.currentwindow.pixlo)) p0 = master.currentwindow.pixlo;
00478 if (pN > int32(master.currentwindow.pixhi)) pN = master.currentwindow.pixhi;
00479 INFO << "DBOW from GEO: " << l0 << " " << lN << " " << p0 << " " << pN;
00480 INFO.print();
00481
00482 input_m_crop.dbow.linelo = uint(l0);
00483 input_m_crop.dbow.linehi = uint(lN);
00484 input_m_crop.dbow.pixlo = uint(p0);
00485 input_m_crop.dbow.pixhi = uint(pN);
00486 }
00487
00488
00489
00490 switch (master.sensor)
00491 {
00492
00493 case SLC_JERS:
00494 WARNING.print("JERS: Under development: is JERS really CEOS like ERS?");
00495
00496 case SLC_ERS:
00497 switch (master.sar_processor)
00498 {
00499 case SARPR_VMP:
00500
00501
00502 char c8checkleadat[9];
00503 readres(c8checkleadat,sizeof(c8checkleadat),
00504 input_general.m_resfile,"(Check)Number",5);
00505 writeslc(input_general,input_m_crop, atoi(c8checkleadat)-1);
00506 updatefile("scratchres2raw",input_general.m_resfile);
00507 break;
00508 case SARPR_ATL:
00509
00510 radarsat_dump_data(input_general,input_m_crop);
00511 updatefile("scratchres2raw",input_general.m_resfile);
00512 WARNING.print("ATLANTIS data cropping not fully checked yet.");
00513 break;
00514 case SARPR_TUD:
00515
00516 default:
00517 PRINT_ERROR("unrecognized sar_processor.")
00518 throw(input_error);
00519 }
00520 break;
00521
00522 case SLC_ASAR:
00523 PROGRESS.print("System call to get ASAR SLC data (requires envisat_dump_data program)");
00524
00525 if (input_m_crop.dbow.linelo == 0 || input_m_crop.dbow.linehi == 0 ||
00526 input_m_crop.dbow.pixlo == 0 || input_m_crop.dbow.pixhi == 0)
00527 {
00528 input_m_crop.dbow = master.currentwindow;
00529 }
00530 envisat_dump_data(input_m_crop);
00531 PROGRESS.print("Finished system call to envisat_dump_data");
00532 updatefile("scratchres2raw",input_general.m_resfile);
00533 break;
00534
00535 case SLC_RSAT:
00536 radarsat_dump_data(input_general,input_m_crop);
00537 updatefile("scratchres2raw",input_general.m_resfile);
00538 WARNING.print("RSAT (Atlantis) not fully checked yet.");
00539 break;
00540 default:
00541 PRINT_ERROR("impossible error (sensor not ERS JERS RSAT nor ASAR).")
00542 throw(input_error);
00543 }
00544 PROGRESS.print("Finished M_CROP.");
00545 DEBUG.print("Time spent for writing raw format master:");
00546 printcpu();
00547 }
00548
00549
00550 if (alreadyprocessed[pr_m_crop])
00551 {
00552 INFO.print("master: latest known processing stage: crop");
00553 char SECTIONID[ONE27];
00554 strcpy(SECTIONID,"*_Start_");
00555 strcat(SECTIONID,processcontrol[pr_m_crop]);
00556 master.updateslcimage(input_general.m_resfile,SECTIONID);
00557 }
00558
00559
00560 if (input_general.process[pr_m_crop])
00561 {
00562 PROGRESS.print("calling preview for cropped master");
00563 if (master.sensor!=SLC_RSAT)
00564 preview(input_general.preview,
00565 master.currentwindow.pixels(), master.formatflag,
00566 master.file, "master_mag.ras",
00567 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 2/10");
00568 else
00569 preview(input_general.preview,
00570 master.currentwindow.pixels(), master.formatflag,
00571 master.file, "master_mag.ras",
00572 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 5/6");
00573 }
00574
00575
00576
00577
00578
00579
00580 if (input_general.process[pr_m_oversample])
00581 {
00582 PROGRESS.print("Start M_OVS.");
00583 alreadyprocessed[pr_m_oversample]=1;
00584 if (input_general.interactive)
00585 {
00586 cerr << "\nProcessing oversample for master.";
00587 getanswer();
00588 }
00589
00590 if (alreadyprocessed[pr_s_oversample])
00591 {
00592 char checkmultilook [20];
00593 int32 checkOsrRange;
00594 readres(checkmultilook,sizeof(checkmultilook),
00595 input_general.s_resfile,"Multilookfactor_range_direction:");
00596 checkOsrRange = int32(1.0/atof(checkmultilook)+.5);
00597 if (input_m_oversample.OsrRange != checkOsrRange)
00598 WARNING.print("Master and Slave range oversampling factors should be identical!!!");
00599 }
00600 if (alreadyprocessed[pr_s_oversample])
00601 {
00602 char checkmultilook[20];
00603 int32 checkOsrAzimuth;
00604 readres(checkmultilook,sizeof(checkmultilook),
00605 input_general.s_resfile,"Multilookfactor_azimuth_direction:");
00606 checkOsrAzimuth = int32(1.0/atof(checkmultilook)+.5);
00607 if (input_m_oversample.OsrAzimuth != checkOsrAzimuth)
00608 WARNING.print("Master and Slave azimuth oversampling factors should be identical!!!");
00609 }
00610
00611
00612
00613 OversampleSLC(input_general,master,input_m_oversample,MASTERID);
00614 updatefile("scratchoversample",input_general.m_resfile);
00615
00616 PROGRESS.print("Finished M_OVS.");
00617 DEBUG.print("Time spent for oversampling master:");
00618 printcpu();
00619 }
00620
00621
00622 if (alreadyprocessed[pr_m_oversample])
00623 {
00624 INFO.print("master: latest known processing stage: oversample");
00625 char SECTIONID[ONE27];
00626 strcpy(SECTIONID,"*_Start_");
00627 strcat(SECTIONID,processcontrol[pr_m_oversample]);
00628 master.updateslcimageML(input_general.m_resfile,SECTIONID);
00629 interferogram.win = master.currentwindow;
00630 }
00631
00632
00633
00634 if (input_general.process[pr_m_oversample])
00635 {
00636 PROGRESS.print("calling preview for oversampled master");
00637 preview(input_general.preview,
00638 master.currentwindow.pixels(), master.formatflag,
00639 master.file, "master_ovs_mag.ras",
00640 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
00641 }
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651 if (input_general.process[pr_s_readfiles])
00652 {
00653 PROGRESS.print("Start S_READFILES.");
00654
00655 alreadyprocessed[pr_s_readfiles]=1;
00656 if (input_general.interactive)
00657 {
00658 cerr << "\nProcessing readfiles for slave.";
00659 getanswer();
00660 }
00661
00662
00663 switch (input_s_readfiles.sensor_id)
00664 {
00665
00666 case SLC_JERS:
00667 INFO.print("JERS: Under development: is JERS really CEOS like ERS?");
00668
00669 case SLC_RSAT:
00670 WARNING.print("RSAT: Under development: CEOS reader seems to work.");
00671
00672 case SLC_ERS:
00673
00674 char c16checkvol1[17];
00675 char c16checkvol2[17];
00676 char c16checkvol3[17];
00677 if (alreadyprocessed[pr_m_readfiles])
00678 {
00679 readres(c16checkvol1,sizeof(c16checkvol1),
00680 input_general.m_resfile,"Volume_ID:");
00681 readres(c16checkvol2,sizeof(c16checkvol2),
00682 input_general.m_resfile,"Volume_identifier:");
00683 readres(c16checkvol3,sizeof(c16checkvol3),
00684 input_general.m_resfile,"Volume_set_identifier:");
00685 }
00686
00687
00688 readvolume(input_s_readfiles, c16checkvol1, c16checkvol2, c16checkvol3);
00689
00690 updatefile("scratchresvol",input_general.s_resfile);
00691
00692 updatefile("scratchlogvol",input_general.logfile);
00693
00694
00695 char c8checkleadat[9];
00696 readres(c8checkleadat,sizeof(c8checkleadat),
00697 input_general.s_resfile,"(Check)Number",5);
00698
00699
00700 readleader(input_s_readfiles, atoi(c8checkleadat)-1);
00701
00702 updatefile("scratchreslea",input_general.s_resfile);
00703
00704 updatefile("scratchloglea",input_general.logfile);
00705
00706
00707
00708
00709
00710
00711 readdat(input_s_readfiles, atoi(c8checkleadat)-1);
00712
00713 updatefile("scratchresdat",input_general.s_resfile);
00714
00715 updatefile("scratchlogdat",input_general.logfile);
00716 break;
00717
00718 case SLC_ASAR:
00719
00720 INFO.reset();
00721 INFO << "envisat_dump_header2doris.csh "
00722 << input_s_readfiles.datfile
00723 << " > scratchres_envisat" << endl << ends;
00724 char cmd[512];
00725 strcpy(cmd, INFO.get_str());
00726 INFO.print("With following command the envisat header was read.");
00727 INFO.print(cmd);
00728 PROGRESS.print("Making system call to envisat_dump_header2doris.csh");
00729 PROGRESS.print("(also requires envisat_dump_header program)");
00730 system(cmd);
00731 INFO.reset();
00732 PROGRESS.print("Finished system call to envisat_dump_header2doris.csh");
00733
00734 updatefile("scratchres_envisat",input_general.s_resfile);
00735
00736 updatefile("envisat_dump_header.log",input_general.logfile);
00737 break;
00738 default:
00739 PRINT_ERROR("impossible error (sensor not ERS nor ASAR).")
00740 throw(input_error);
00741 }
00742
00743 PROGRESS.print("Finished S_READFILES.");
00744 DEBUG.print("Time spent for reading files slave:");
00745 printcpu();
00746 }
00747
00748
00749 if (existed(input_general.s_resfile))
00750 slave.fillslcimage(input_general.s_resfile);
00751
00752
00753 if (alreadyprocessed[pr_m_readfiles] && alreadyprocessed[pr_s_readfiles])
00754 if (master.sensor != slave.sensor)
00755 WARNING.print("master.sensor not same as slave.sensor (ERS-ERS, ASAR-ASAR only)");
00756
00757
00758
00759 DEBUG.print("Correction for slave image timing errors if specified");
00760 DEBUG << "rg_timing_error: " << input_s_readfiles.rg_timing_error;
00761 DEBUG.print();
00762 DEBUG << "az_timing_error: " << input_s_readfiles.az_timing_error;
00763 DEBUG.print();
00764 slave.add_rg_t_error(input_s_readfiles.rg_timing_error);
00765 slave.add_az_t_error(input_s_readfiles.az_timing_error);
00766
00767
00768
00769
00770
00771 if (input_general.process[pr_s_porbits])
00772 {
00773 PROGRESS.print("Start S_PORBITS.");
00774 alreadyprocessed[pr_s_porbits]=1;
00775 if (input_general.interactive)
00776 {
00777 cerr << "\nProcessing get precise orbits for slave.";
00778 getanswer();
00779 }
00780
00781
00782 getorb(slave,input_porbits,SLAVEID);
00783 convertgetorbout(SLAVEID);
00784 updatefile("scratchdatapoints",input_general.s_resfile);
00785 removedatleader(input_general.s_resfile);
00786 PROGRESS.print("Finished S_PORBITS.");
00787 DEBUG.print("Time spent for obtaining precise orbits slave:");
00788 printcpu();
00789 }
00790
00791
00792 if (alreadyprocessed[pr_s_porbits] ||
00793 alreadyprocessed[pr_s_readfiles])
00794 slaveorbit.initialize(input_general.s_resfile);
00795
00796
00797
00798
00799
00800 slaveorbit.dumporbit(input_porbits,SLAVEID);
00801
00802
00803
00804
00805 BASELINE baseline;
00806 baseline.model_parameters(master,slave,masterorbit,slaveorbit,input_ellips);
00807
00808
00809
00810
00811
00812
00813 for (register int32 i=0; i<input_general.dumpbaselineL; ++i)
00814 {
00815 const real8 line = (input_general.dumpbaselineL==1) ?
00816 master.currentwindow.linelo + master.currentwindow.lines()/2.0 :
00817 master.currentwindow.linelo + i*master.currentwindow.lines()/
00818 (input_general.dumpbaselineL-1.0);
00819 for (register int32 j=0; j<input_general.dumpbaselineP; ++j)
00820 {
00821 const real8 pixel = (input_general.dumpbaselineP==1) ?
00822 master.currentwindow.pixlo + master.currentwindow.pixels()/2.0 :
00823 master.currentwindow.pixlo + j*master.currentwindow.pixels()/
00824 (input_general.dumpbaselineP-1.0);
00825 for (register int32 height=0; height<1001; height=height+1000)
00826 baseline.dump(line,pixel,height);
00827 }
00828 }
00829
00830
00831
00832 PROGRESS.print("Computating integration constant based on tiepoint");
00833 tiepoint(input_general, master, slave, masterorbit, slaveorbit, input_ellips);
00834
00835
00836
00837
00838 if (input_general.process[pr_s_crop])
00839 {
00840 PROGRESS.print("Start S_CROP.");
00841
00842 alreadyprocessed[pr_s_crop]=1;
00843 if (input_general.interactive)
00844 {
00845 cerr << "\nProcessing crop for slave.";
00846 getanswer();
00847 }
00848
00849
00850 if (input_s_crop.dbow_geo.pixhi != 0)
00851 {
00852 PROGRESS.print("Computing crop based on center lat/lon/height/width.");
00853 real8 centerline, centerpix;
00854 real8 centerphi = deg2rad(input_s_crop.dbow_geo.linelo/1e6-360.0);
00855 real8 centerlambda = deg2rad(input_s_crop.dbow_geo.linehi/1e6-360.0);
00856 real8 centerheight = input_general.terrain_height;
00857 DEBUG.print("Using height of HEIGHT card");
00858 DEBUG << "CROP: center lat/lon/hei: "
00859 << centerphi << " " << centerlambda << " " << centerheight;
00860 DEBUG.print();
00861 cn centerpos;
00862 ell2xyz(input_ellips,centerpos,centerphi,centerlambda,centerheight);
00863 DEBUG << "convert S_DBOW_GEO phi,lambda --> x,y,z: "
00864 << centerphi << ", " << centerlambda << ", " << " --> "
00865 << centerpos.x << " " << centerpos.y << " " << centerpos.z;
00866 DEBUG.print();
00867 DEBUG << "Center slave SLC: x,y,z: "
00868 << slave.approxcentreoriginal.x << " "
00869 << slave.approxcentreoriginal.y << " "
00870 << slave.approxcentreoriginal.z;
00871 DEBUG.print();
00872 if (abs(slave.approxcentreoriginal.x-centerpos.x)>50000.0)
00873 WARNING.print("S_DBOW_GEO: coordinates seem to be outside SLC area? (X)");
00874 if (abs(slave.approxcentreoriginal.y-centerpos.y)>50000.0)
00875 WARNING.print("S_DBOW_GEO: coordinates seem to be outside SLC area? (Y)");
00876 if (abs(slave.approxcentreoriginal.z-centerpos.z)>50000.0)
00877 WARNING.print("S_DBOW_GEO: coordinates seem to be outside SLC area? (Z)");
00878 int32 n_iter = xyz2lp(centerline, centerpix,
00879 slave, slaveorbit, centerpos,
00880 10, 1e-3);
00881
00882
00883
00884 DEBUG << "CROP: center line/pix: " << centerline << " " << centerpix;
00885 DEBUG.print();
00886 int32 l0 = int32(centerline+0.5) - input_s_crop.dbow_geo.pixlo/2;
00887 int32 lN = l0 + input_s_crop.dbow_geo.pixlo - 1;
00888 int32 p0 = int32(centerpix+0.5) - input_s_crop.dbow_geo.pixhi/2;
00889 int32 pN = p0 + input_s_crop.dbow_geo.pixhi - 1;
00890 if (l0 < int32(slave.currentwindow.linelo)) l0 = slave.currentwindow.linelo;
00891 if (lN > int32(slave.currentwindow.linehi)) lN = slave.currentwindow.linehi;
00892 if (p0 < int32(slave.currentwindow.pixlo)) p0 = slave.currentwindow.pixlo;
00893 if (pN > int32(slave.currentwindow.pixhi)) pN = slave.currentwindow.pixhi;
00894 INFO << "DBOW from GEO: " << l0 << " " << lN << " " << p0 << " " << pN;
00895 INFO.print();
00896
00897 input_s_crop.dbow.linelo = uint(l0);
00898 input_s_crop.dbow.linehi = uint(lN);
00899 input_s_crop.dbow.pixlo = uint(p0);
00900 input_s_crop.dbow.pixhi = uint(pN);
00901 }
00902
00903
00904 switch (slave.sensor)
00905 {
00906
00907 case SLC_JERS:
00908 WARNING.print("JERS: Under development: is JERS really CEOS like ERS?");
00909
00910 case SLC_ERS:
00911 switch (slave.sar_processor)
00912 {
00913 case SARPR_VMP:
00914
00915
00916 char c8checkleadat[9];
00917 readres(c8checkleadat,sizeof(c8checkleadat),
00918 input_general.s_resfile,"(Check)Number",5);
00919 writeslc(input_general,input_s_crop, atoi(c8checkleadat)-1);
00920 updatefile("scratchres2raw",input_general.s_resfile);
00921 break;
00922 case SARPR_ATL:
00923
00924 radarsat_dump_data(input_general,input_s_crop);
00925 updatefile("scratchres2raw",input_general.s_resfile);
00926 WARNING.print("ATLANTIS data cropping not fully checked yet.");
00927 break;
00928 case SARPR_TUD:
00929
00930 default:
00931 PRINT_ERROR("unrecognized sar_processor.")
00932 throw(input_error);
00933 }
00934 break;
00935
00936 case SLC_ASAR:
00937 PROGRESS.print("System call to get ASAR SLC data (requires envisat_dump_data program)");
00938
00939 if (input_s_crop.dbow.linelo == 0 || input_s_crop.dbow.linehi == 0 ||
00940 input_s_crop.dbow.pixlo == 0 || input_s_crop.dbow.pixhi == 0)
00941 input_s_crop.dbow = slave.currentwindow;
00942 envisat_dump_data(input_s_crop);
00943 PROGRESS.print("Finished system call to envisat_dump_data");
00944 updatefile("scratchres2raw",input_general.s_resfile);
00945 break;
00946
00947 case SLC_RSAT:
00948 radarsat_dump_data(input_general,input_s_crop);
00949 updatefile("scratchres2raw",input_general.s_resfile);
00950 WARNING.print("RSAT (Atlantis) not fully checked yet.");
00951 break;
00952 default:
00953 PRINT_ERROR("impossible error (sensor not (J)ERS or ASAR).")
00954 throw(input_error);
00955 }
00956 PROGRESS.print("Finished S_CROP.");
00957 DEBUG.print("Time spent for writing raw format slave:");
00958 printcpu();
00959 }
00960
00961
00962 if (alreadyprocessed[pr_s_crop])
00963 {
00964 INFO.print("slave: latest known processing stage: crop");
00965 char SECTIONID[ONE27];
00966 strcpy(SECTIONID,"*_Start_");
00967 strcat(SECTIONID,processcontrol[pr_s_crop]);
00968
00969 slave.updateslcimage(input_general.s_resfile,SECTIONID);
00970 }
00971
00972
00973 if (alreadyprocessed[pr_m_crop] && alreadyprocessed[pr_s_crop])
00974 {
00975 if (abs(master.wavelength-slave.wavelength) > EPS)
00976 WARNING.print("wavelength master not equal to wavelength slave.");
00977 }
00978
00979
00980
00981 if (input_general.process[pr_s_crop])
00982 {
00983 PROGRESS.print("calling preview for cropped slave");
00984 if (master.sensor!=SLC_RSAT)
00985 preview(input_general.preview,
00986 slave.currentwindow.pixels(), slave.formatflag,
00987 slave.file, "slave_mag.ras",
00988 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 2/10");
00989 else
00990 preview(input_general.preview,
00991 slave.currentwindow.pixels(), slave.formatflag,
00992 slave.file, "slave_mag.ras",
00993 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 5/6");
00994 }
00995
00996
00997
00998
00999
01000
01001 if (input_general.process[pr_s_oversample])
01002 {
01003 PROGRESS.print("Start S_OVS.");
01004 alreadyprocessed[pr_s_oversample]=1;
01005 if (input_general.interactive)
01006 {
01007 cerr << "\nProcessing oversample for slave.";
01008 getanswer();
01009 }
01010
01011 if (alreadyprocessed[pr_m_oversample])
01012 {
01013 char checkmultilook[20];
01014 int32 checkOsrRange;
01015 readres(checkmultilook,sizeof(checkmultilook),
01016 input_general.m_resfile,"Multilookfactor_range_direction:");
01017 checkOsrRange = int32(1.0/atof(checkmultilook)+.5);
01018 if (input_s_oversample.OsrRange != checkOsrRange)
01019 WARNING.print("Master and Slave range oversampling factors should be identical!!!");
01020 }
01021 if (alreadyprocessed[pr_m_oversample])
01022 {
01023 char checkmultilook[20];
01024 int32 checkOsrAzimuth;
01025 readres(checkmultilook,sizeof(checkmultilook),
01026 input_general.m_resfile,"Multilookfactor_azimuth_direction:");
01027 checkOsrAzimuth = int32(1.0/atof(checkmultilook)+.5);
01028 if (input_s_oversample.OsrAzimuth != checkOsrAzimuth)
01029 WARNING.print("Master and Slave azimuth oversampling factors should be identical!!!");
01030 }
01031
01032
01033
01034
01035 OversampleSLC(input_general,slave,input_s_oversample,SLAVEID);
01036 updatefile("scratchoversample",input_general.s_resfile);
01037
01038 PROGRESS.print("Finished S_OVS.");
01039 DEBUG.print("Time spent for oversampling slave:");
01040 printcpu();
01041 }
01042
01043
01044 if (alreadyprocessed[pr_s_oversample])
01045 {
01046 INFO.print("slave: latest known processing stage: oversample");
01047 char SECTIONID[ONE27];
01048 strcpy(SECTIONID,"*_Start_");
01049 strcat(SECTIONID,processcontrol[pr_s_oversample]);
01050 slave.updateslcimageML(input_general.s_resfile,SECTIONID);
01051 }
01052
01053
01054
01055 if (input_general.process[pr_s_oversample])
01056 {
01057 PROGRESS.print("calling preview for oversampled slave");
01058 preview(input_general.preview,
01059 slave.currentwindow.pixels(), slave.formatflag,
01060 slave.file, "slave_ovs_mag.ras",
01061 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
01062 }
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073 if (input_general.process[pr_i_coarse])
01074 {
01075 PROGRESS.print("Start COARSE_ORB.");
01076 alreadyprocessed[pr_i_coarse]=1;
01077 if (input_general.interactive)
01078 {
01079 cerr << "\nProcessing coarse co-registration based on orbits.";
01080 getanswer();
01081 }
01082 coarseporbit(input_ellips, master, slave, masterorbit, slaveorbit, baseline);
01083
01084
01085 updatefile("scratchlogcoarse",input_general.logfile);
01086 updatefile("scratchrescoarse",input_general.i_resfile);
01087 PROGRESS.print("Finished COARSE_ORB.");
01088 DEBUG.print("Time spent for coarse coregistration with orbits:");
01089 printcpu();
01090 }
01091
01092
01093 if (alreadyprocessed[pr_i_coarse])
01094 {
01095 INFO.print("latest known processing stage: coarse (orbits)");
01096 char c6initoffL[7];
01097 char c6initoffP[7];
01098 readres(c6initoffL,sizeof(c6initoffL),input_general.i_resfile,
01099 "Coarse_orbits_translation_lines:", 0);
01100 readres(c6initoffP,sizeof(c6initoffP),input_general.i_resfile,
01101 "Coarse_orbits_translation_pixels:", 0);
01102 slave.coarseoffsetL = atoi(c6initoffL);
01103 slave.coarseoffsetP = atoi(c6initoffP);
01104 master.coarseoffsetL = -slave.coarseoffsetL;
01105 master.coarseoffsetP = -slave.coarseoffsetP;
01106
01107
01108 const int32 sL0 = slave.currentwindow.linelo - slave.coarseoffsetL;
01109 const int32 sLN = slave.currentwindow.linehi - slave.coarseoffsetL;
01110 const int32 sP0 = slave.currentwindow.pixlo - slave.coarseoffsetP;
01111 const int32 sPN = slave.currentwindow.pixhi - slave.coarseoffsetP;
01112 interferogram.win.linelo = max(sL0,int32(master.currentwindow.linelo));
01113 interferogram.win.linehi = min(sLN,int32(master.currentwindow.linehi));
01114 interferogram.win.pixlo = max(sP0,int32(master.currentwindow.pixlo));
01115 interferogram.win.pixhi = min(sPN,int32(master.currentwindow.pixhi));
01116 }
01117
01118
01119
01120
01121 if (input_general.process[pr_i_coarse2])
01122 {
01123 PROGRESS.print("Start COARSE_CORR.");
01124 alreadyprocessed[pr_i_coarse2]=1;
01125 if (input_general.interactive)
01126 {
01127 cerr << "\nProcessing coarse co-registration with correlation.";
01128 getanswer();
01129 }
01130
01131
01132 if (input_i_coarsecorr.initoffsetL == NaN &&
01133 input_i_coarsecorr.initoffsetL == NaN)
01134 {
01135 input_i_coarsecorr.initoffsetL = slave.coarseoffsetL;
01136 input_i_coarsecorr.initoffsetP = slave.coarseoffsetP;
01137 }
01138
01139
01140 switch (input_i_coarsecorr.method)
01141 {
01142 case cc_magfft:
01143 coarsecorrelfft(input_i_coarsecorr, master, slave);
01144 break;
01145 case cc_magspace:
01146 coarsecorrel(input_i_coarsecorr, master, slave);
01147 break;
01148 default:
01149 PRINT_ERROR("impossible error for checked input.")
01150 throw(input_error);
01151 }
01152
01153
01154 updatefile("scratchlogcoarse2",input_general.logfile);
01155 updatefile("scratchrescoarse2",input_general.i_resfile);
01156 PROGRESS.print("Finished COARSE_CORR.");
01157 DEBUG.print("Time spent for coarse coregistration with correlation:");
01158 printcpu();
01159 }
01160
01161
01162 if (alreadyprocessed[pr_i_coarse2])
01163 {
01164 INFO.print("latest known processing stage: coarse (corr)");
01165 char c6initoffL[7];
01166 char c6initoffP[7];
01167 readres(c6initoffL,sizeof(c6initoffL),input_general.i_resfile,
01168 "Coarse_correlation_translation_lines:", 0);
01169 readres(c6initoffP,sizeof(c6initoffP),input_general.i_resfile,
01170 "Coarse_correlation_translation_pixels:", 0);
01171 slave.coarseoffsetL = atoi(c6initoffL);
01172 slave.coarseoffsetP = atoi(c6initoffP);
01173 master.coarseoffsetL = -slave.coarseoffsetL;
01174 master.coarseoffsetP = -slave.coarseoffsetP;
01175
01176
01177 const int32 sL0 = slave.currentwindow.linelo - slave.coarseoffsetL;
01178 const int32 sLN = slave.currentwindow.linehi - slave.coarseoffsetL;
01179 const int32 sP0 = slave.currentwindow.pixlo - slave.coarseoffsetP;
01180 const int32 sPN = slave.currentwindow.pixhi - slave.coarseoffsetP;
01181
01182
01183 interferogram.win.linelo = max(sL0,int32(master.currentwindow.linelo));
01184 interferogram.win.linehi = min(sLN,int32(master.currentwindow.linehi));
01185 interferogram.win.pixlo = max(sP0,int32(master.currentwindow.pixlo));
01186 interferogram.win.pixhi = min(sPN,int32(master.currentwindow.pixhi));
01187 }
01188
01189
01190
01191
01192
01193 if (input_general.process[pr_m_filtazi])
01194 {
01195 PROGRESS.print("Start FILTAZI (master).");
01196 alreadyprocessed[pr_m_filtazi]=1;
01197 if (input_general.interactive)
01198 {
01199 cerr << "\nProcessing filtering azimuth direction for master.";
01200 getanswer();
01201 }
01202
01203
01204 strcpy(input_ms_filtazi.foname,input_ms_filtazi.fomaster);
01205 azimuthfilter(input_general,input_ms_filtazi,master,slave);
01206 updatefile("scratchresfiltazi",input_general.m_resfile);
01207 updatefile("scratchlogfiltazi",input_general.logfile);
01208 PROGRESS.print("Finished FILTAZI for master.");
01209 DEBUG.print("Time spent for azimuth filtering master:");
01210 printcpu();
01211 }
01212
01213 if (alreadyprocessed[pr_m_filtazi])
01214 {
01215 INFO.print("master: latest known processing stage: azimuth filtered");
01216 char SECTIONID[ONE27];
01217 strcpy(SECTIONID,"*_Start_");
01218 strcat(SECTIONID,processcontrol[pr_m_filtazi]);
01219 master.updateslcimage(input_general.m_resfile,SECTIONID);
01220 }
01221
01222
01223
01224 if (input_general.process[pr_s_filtazi])
01225 {
01226 PROGRESS.print("Start FILTAZI (slave).");
01227 alreadyprocessed[pr_s_filtazi]=1;
01228 if (input_general.interactive)
01229 {
01230 cerr << "\nProcessing filtering azimuth direction for slave.";
01231 getanswer();
01232 }
01233
01234 strcpy(input_ms_filtazi.foname,input_ms_filtazi.foslave);
01235 azimuthfilter(input_general,input_ms_filtazi,slave,master);
01236 updatefile("scratchresfiltazi",input_general.s_resfile);
01237 updatefile("scratchlogfiltazi",input_general.logfile);
01238 PROGRESS.print("Finished FILTAZI slave.");
01239 DEBUG.print("Time spent for azimuth filtering slave:");
01240 printcpu();
01241 }
01242
01243
01244 if (alreadyprocessed[pr_s_filtazi])
01245 {
01246 INFO.print("slave: latest known processing stage: azimuth filtered");
01247 char SECTIONID[ONE27];
01248 strcpy(SECTIONID,"*_Start_");
01249 strcat(SECTIONID,processcontrol[pr_s_filtazi]);
01250 slave.updateslcimage(input_general.s_resfile,SECTIONID);
01251 }
01252
01253
01254
01255
01256
01257
01258
01259
01260 if (input_general.process[pr_m_filtrange] &&
01261 input_ms_filtrange.method==rf_porbits)
01262 {
01263 PROGRESS.print("Start FILTRANGE (porbits).");
01264 alreadyprocessed[pr_m_filtrange]=1;
01265 alreadyprocessed[pr_s_filtrange]=1;
01266 if (input_general.interactive)
01267 {
01268 cerr << "\nRange filtering based on orbits master and slave.";
01269 getanswer();
01270 }
01271
01272
01273 rangefiltporbits(input_general,input_ms_filtrange,input_ellips,
01274 master,slave,masterorbit,slaveorbit);
01275
01276
01277 updatefile("scratchlogfiltrange",input_general.logfile);
01278 updatefile("scratchresMfiltrange",input_general.m_resfile);
01279 updatefile("scratchresSfiltrange",input_general.s_resfile);
01280
01281 PROGRESS.print("Finished FILTRANGE.");
01282 DEBUG.print("Time spent for range filtering:");
01283 printcpu();
01284 }
01285
01286
01287
01288 if (alreadyprocessed[pr_m_filtrange])
01289 {
01290 char c10rfmethod[11];
01291 readres(c10rfmethod,sizeof(c10rfmethod),input_general.m_resfile,
01292 "Method_rangefilt:", 0);
01293 if (!strcmp(c10rfmethod,"porbits"))
01294 {
01295 INFO.print("master: latest known processing stage: filtrange (orbits)");
01296 char SECTIONID[ONE27];
01297 strcpy(SECTIONID,"*_Start_");
01298 strcat(SECTIONID,processcontrol[pr_m_filtrange]);
01299 master.updateslcimage(input_general.m_resfile,SECTIONID);
01300
01301 interferogram.win = master.currentwindow;
01302 }
01303 }
01304
01305
01306 if (alreadyprocessed[pr_s_filtrange])
01307 {
01308 char c10rfmethod[11];
01309 readres(c10rfmethod,sizeof(c10rfmethod),input_general.s_resfile,
01310 "Method_rangefilt:", 0);
01311 if (!strcmp(c10rfmethod,"porbits"))
01312 {
01313 INFO.print("slave: latest known processing stage: filtrange (orbits)");
01314 char SECTIONID[ONE27];
01315 strcpy(SECTIONID,"*_Start_");
01316 strcat(SECTIONID,processcontrol[pr_s_filtrange]);
01317 slave.updateslcimage(input_general.s_resfile,SECTIONID);
01318 }
01319 }
01320
01321
01322
01323
01324
01325 if (input_general.process[pr_i_fine])
01326 {
01327 PROGRESS.print("Start FINE.");
01328 alreadyprocessed[pr_i_fine]=1;
01329 if (input_general.interactive)
01330 {
01331 cerr << "\nProcessing fine co-registration.";
01332 getanswer();
01333 }
01334
01335
01336 if (input_i_fine.initoffsetL == NaN &&
01337 input_i_fine.initoffsetL == NaN)
01338 {
01339 input_i_fine.initoffsetL = slave.coarseoffsetL;
01340 input_i_fine.initoffsetP = slave.coarseoffsetP;
01341 }
01342
01343
01344 if (input_i_fine.method == fc_magfft ||
01345 input_i_fine.method == fc_magspace )
01346 finecoreg(input_i_fine, master, slave);
01347 else if (input_i_fine.method == fc_oversample)
01348
01349 ;
01350 else
01351 {
01352 PRINT_ERROR("Method FC not implemented.")
01353 throw(input_error);
01354 }
01355
01356
01357 updatefile("scratchlogfine",input_general.logfile);
01358 updatefile("scratchresfine",input_general.i_resfile);
01359 PROGRESS.print("Finished FINE.");
01360 DEBUG.print("Time spent for fine coregistration:");
01361 printcpu();
01362
01363
01364 INFO.reset();
01365 INFO << "plotoffsets " << input_general.i_resfile << " "
01366 << master.currentwindow.linelo << " "
01367 << master.currentwindow.linehi << " "
01368 << master.currentwindow.pixlo << " "
01369 << master.currentwindow.pixhi << " "
01370 << input_i_fine.plotthreshold << " ";
01371
01372 if (input_i_fine.plotmagbg) INFO << master.file;
01373 INFO << "&" << endl << ends;
01374 char cmd[512];
01375 strcpy(cmd, INFO.get_str());
01376 INFO.print("With following command the estimated offset vectors can be plotted.");
01377 INFO.print(cmd);
01378
01379 if (input_i_fine.plotoffsets) system(cmd);
01380 }
01381
01382
01383 uint osfactor = 8;
01384 if (alreadyprocessed[pr_i_fine])
01385 {
01386 INFO.print("latest known processing stage: fine");
01387 char c4osfactor[4];
01388 readres(c4osfactor,sizeof(c4osfactor),input_general.i_resfile,
01389 "Oversampling", 1);
01390 osfactor = uint(atoi(c4osfactor));
01391 }
01392
01393
01394
01395
01396 if (input_general.process[pr_i_coregpm])
01397 {
01398 PROGRESS.print("Start COREGPM.");
01399 alreadyprocessed[pr_i_coregpm]=1;
01400 if (input_general.interactive)
01401 {
01402 cerr << "\nProcessing computation of co-registration parameters.";
01403 getanswer();
01404 }
01405
01406 coregpm(master.originalwindow,
01407 input_general.i_resfile, input_i_coregpm, osfactor);
01408
01409
01410 updatefile("scratchlogcpm",input_general.logfile);
01411 updatefile("scratchrescpm",input_general.i_resfile);
01412
01413 PROGRESS.print("Finished COREGPM.");
01414 DEBUG.print("Time spent for computation of coregistration parameters:");
01415 printcpu();
01416
01417
01418 INFO.reset();
01419 INFO << "plotcpm CPM_Data "
01420 << master.currentwindow.linelo << " "
01421 << master.currentwindow.linehi << " "
01422 << master.currentwindow.pixlo << " "
01423 << master.currentwindow.pixhi << " ";
01424
01425 if (input_i_coregpm.plotmagbg) INFO << master.file;
01426
01427 INFO << "&" << endl << ends;
01428 char cmd[512];
01429 strcpy(cmd, INFO.get_str());
01430 INFO.print("Next command will plot solution:");
01431 INFO.print(cmd);
01432
01433 if (input_i_coregpm.plot) system(cmd);
01434 }
01435
01436
01437
01438 if (alreadyprocessed[pr_i_coregpm])
01439 {
01440 INFO.print("latest known processing stage: coregpm");
01441 char c10offL[11];
01442 readres(c10offL,sizeof(c10offL),input_general.i_resfile,"Degree_cpm:");
01443 int32 degreecpm = atoi(c10offL);
01444 coeff_cpmL = readcoeff(input_general.i_resfile,
01445 "Estimated_coefficientsL:",Ncoeffs(degreecpm));
01446 coeff_cpmP = readcoeff(input_general.i_resfile,
01447 "Estimated_coefficientsP:",Ncoeffs(degreecpm));
01448
01449
01450 }
01451
01452
01453
01454
01455 if (input_general.process[pr_s_resample])
01456 {
01457 PROGRESS.print("Start RESAMPLE.");
01458 alreadyprocessed[pr_s_resample]=1;
01459 if (input_general.interactive)
01460 {
01461 cerr << "\nProcessing resampling of slave image. (might take some time.)";
01462 getanswer();
01463 }
01464
01465 resample(input_general,input_s_resample,
01466 master,slave,coeff_cpmL,coeff_cpmP);
01467
01468
01469 updatefile("scratchlogresample",input_general.logfile);
01470 updatefile("scratchresresample",input_general.s_resfile);
01471
01472 PROGRESS.print("Finished RESAMPLE.");
01473 DEBUG.print("Time spent for resampling of slave image:");
01474 printcpu();
01475 }
01476
01477
01478 if (alreadyprocessed[pr_s_resample])
01479 {
01480 INFO.print("slave: latest known processing stage: resample");
01481 char SECTIONID[ONE27];
01482 strcpy(SECTIONID,"*_Start_");
01483 strcat(SECTIONID,processcontrol[pr_s_resample]);
01484 slave.updateslcimage(input_general.s_resfile,SECTIONID);
01485
01486
01487
01488 interferogram.win =
01489 getoverlap(master.currentwindow,slave.currentwindow);
01490 }
01491
01492 if (input_general.process[pr_s_resample])
01493 {
01494 PROGRESS.print("calling preview for resampled slave");
01495 if (master.sensor!=SLC_RSAT)
01496 preview(input_general.preview,
01497 slave.currentwindow.pixels(), slave.formatflag,
01498 slave.file, "slave_rs_mag.ras",
01499 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 2/10");
01500 else
01501 preview(input_general.preview,
01502 slave.currentwindow.pixels(), slave.formatflag,
01503 slave.file, "slave_rs_mag.ras",
01504 "-e 0.5 -s 1.0 -q mag -o sunraster -b -c gray -M 5/6");
01505 }
01506
01507
01508
01509
01510
01511
01512
01513 if (input_general.process[pr_m_filtrange] &&
01514 input_ms_filtrange.method==rf_adaptive)
01515 {
01516 PROGRESS.print("Start FILTRANGE (adaptive).");
01517 alreadyprocessed[pr_m_filtrange]=1;
01518 alreadyprocessed[pr_s_filtrange]=1;
01519 if (input_general.interactive)
01520 {
01521 cerr << "\nAdaptive range filtering master and slave.";
01522 getanswer();
01523 }
01524
01525
01526 rangefilter(input_general,master,slave,interferogram,input_ms_filtrange);
01527
01528
01529 updatefile("scratchlogfiltrange",input_general.logfile);
01530 updatefile("scratchresMfiltrange",input_general.m_resfile);
01531 updatefile("scratchresSfiltrange",input_general.s_resfile);
01532
01533 PROGRESS.print("Finished FILTRANGE.");
01534 DEBUG.print("Time spent for range filtering:");
01535 printcpu();
01536 }
01537
01538
01539 if (alreadyprocessed[pr_m_filtrange])
01540 {
01541 char c10rfmethod[11];
01542 readres(c10rfmethod,sizeof(c10rfmethod),input_general.m_resfile,
01543 "Method_rangefilt:", 0);
01544 if (!strcmp(c10rfmethod,"adaptive"))
01545 {
01546 INFO.print("master: latest known processing stage: adaptive range filtered");
01547 char SECTIONID[ONE27];
01548 strcpy(SECTIONID,"*_Start_");
01549 strcat(SECTIONID,processcontrol[pr_m_filtrange]);
01550 master.updateslcimage(input_general.m_resfile,SECTIONID);
01551
01552 interferogram.win = master.currentwindow;
01553 }
01554 }
01555
01556
01557 if (alreadyprocessed[pr_s_filtrange])
01558 {
01559 char c10rfmethod[11];
01560 readres(c10rfmethod,sizeof(c10rfmethod),input_general.s_resfile,
01561 "Method_rangefilt:", 0);
01562 if (!strcmp(c10rfmethod,"adaptive"))
01563 {
01564 INFO.print("slave: latest known processing stage: adaptive range filtered");
01565 char SECTIONID[ONE27];
01566 strcpy(SECTIONID,"*_Start_");
01567 strcat(SECTIONID,processcontrol[pr_s_filtrange]);
01568 slave.updateslcimage(input_general.s_resfile,SECTIONID);
01569
01570 if (slave.currentwindow.linelo != master.currentwindow.linelo ||
01571 slave.currentwindow.linehi != master.currentwindow.linehi ||
01572 slave.currentwindow.pixlo != master.currentwindow.pixlo ||
01573 slave.currentwindow.pixhi != master.currentwindow.pixhi )
01574 {
01575 WARNING.print("master/slave should overlap exactly after adaptive range filtering?");
01576 master.showdata();
01577 slave.showdata();
01578 }
01579 }
01580 }
01581
01582
01583
01584
01585
01586
01587
01588
01589 if (alreadyprocessed[pr_i_comprefpha])
01590 {
01591 INFO.print("latest known processing stage: comprefpha");
01592 char c10offL[11];
01593 readres(c10offL,sizeof(c10offL),input_general.i_resfile,"Degree_flat:");
01594 int32 degreeflat = atoi(c10offL);
01595 coeff_flat = readcoeff(input_general.i_resfile,
01596 "Estimated_coefficients_flatearth:",Ncoeffs(degreeflat));
01597 }
01598
01599
01600
01601 if (input_general.process[pr_i_interfero])
01602 {
01603 PROGRESS.print("Start INTERFERO.");
01604 alreadyprocessed[pr_i_interfero]=1;
01605 if (input_general.interactive)
01606 {
01607 cerr << "\nProcessing computation of interferogram.";
01608 getanswer();
01609 }
01610
01611
01612
01613 if (input_i_interfero.method==int_oldmethod)
01614 compinterfero(master,slave,
01615 input_general,input_i_interfero,coeff_flat);
01616 else if (input_i_interfero.method==int_oversample)
01617 {
01618 PRINT_ERROR("NOT IMPLEMENTED IN THIS VERSION.")
01619 throw(input_error);
01620 }
01621 else
01622 {
01623 PRINT_ERROR("unknown method interfero.")
01624 throw(input_error);
01625 }
01626
01627
01628 updatefile("scratchloginterfero",input_general.logfile);
01629 updatefile("scratchresinterfero",input_general.i_resfile);
01630
01631 PROGRESS.print("Finished INTERFERO.");
01632 DEBUG.print("Time spent for computation of interferogram:");
01633 printcpu();
01634 }
01635
01636
01637 if (alreadyprocessed[pr_i_interfero])
01638 {
01639 INFO.print("latest known processing stage: interfero");
01640 char SECTIONID[ONE27];
01641 strcpy(SECTIONID,"*_Start_");
01642 strcat(SECTIONID,processcontrol[pr_i_interfero]);
01643 interferogram.fillproductinfo(input_general.i_resfile,SECTIONID);
01644 }
01645
01646
01647 if (input_general.process[pr_i_interfero])
01648 {
01649
01650
01651 PROGRESS.print("calling preview for complex interferogram");
01652 preview(input_general.preview,
01653 int32((interferogram.win.pixels()/interferogram.multilookP)),
01654 interferogram.formatflag, interferogram.file,
01655 "interferogram_mag.ras", "-e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
01656 preview(input_general.preview,
01657 int32((interferogram.win.pixels()/interferogram.multilookP)),
01658 interferogram.formatflag, interferogram.file,
01659 "interferogram_pha.ras", "-q phase -o sunraster -b -c jet -M 2/2");
01660 preview(input_general.preview,
01661 int32((interferogram.win.pixels()/interferogram.multilookP)),
01662 interferogram.formatflag, interferogram.file,
01663 "interferogram_mix.ras", "-e 0.3 -s 1.2 -q mixed -o sunraster -b -c hsv -M 2/2");
01664 }
01665
01666
01667
01668
01669 if (input_general.process[pr_i_comprefpha])
01670 {
01671 PROGRESS.print("Start COMPREFPHA.");
01672 alreadyprocessed[pr_i_comprefpha]=1;
01673 if (input_general.interactive)
01674 {
01675 cerr << "\nProcessing computation of reference interferogram.";
01676 getanswer();
01677 }
01678
01679 if (input_i_comprefpha.method == fe_porbits)
01680 flatearth(input_i_comprefpha, input_ellips, master, slave, interferogram,
01681 masterorbit, slaveorbit);
01682
01683 else if (input_i_comprefpha.method == fe_method2)
01684 {
01685 PRINT_ERROR("NOT IMPLEMENTED IN THIS VERSION.")
01686 throw(input_error);
01687 }
01688
01689
01690 updatefile("scratchlogflat",input_general.logfile);
01691 updatefile("scratchresflat",input_general.i_resfile);
01692
01693 PROGRESS.print("Finished COMPREFPHA.");
01694 DEBUG.print("Time spent for computation of reference interferogram 'flat earth':");
01695 printcpu();
01696 }
01697
01698
01699 if (alreadyprocessed[pr_i_comprefpha])
01700 {
01701 INFO.print("latest known processing stage: comprefpha");
01702 char c10offL[11];
01703 readres(c10offL,sizeof(c10offL),input_general.i_resfile,"Degree_flat:");
01704 int32 degreeflat = atoi(c10offL);
01705
01706 coeff_flat = readcoeff(input_general.i_resfile,
01707 "Estimated_coefficients_flatearth:",Ncoeffs(degreeflat));
01708 }
01709
01710
01711
01712
01713 if (input_general.process[pr_i_subtrrefpha])
01714 {
01715 PROGRESS.print("Start SUBTRREFPHA.");
01716 alreadyprocessed[pr_i_subtrrefpha]=1;
01717 if (input_general.interactive)
01718 {
01719 cerr << "\nProcessing subtraction of reference phase from interferogram.\n";
01720 getanswer();
01721 }
01722
01723
01724 switch (input_i_subtrrefpha.method)
01725 {
01726 case srp_polynomial:
01727 subtrrefpha(master,interferogram,
01728 input_general,input_i_subtrrefpha,
01729 coeff_flat);
01730 break;
01731 case srp_exact:
01732 subtrrefpha(input_ellips, master, slave, interferogram,
01733 input_general, input_i_subtrrefpha,
01734 masterorbit, slaveorbit);
01735 break;
01736 default:
01737 PRINT_ERROR("PANIC: not possible, bert.")
01738 throw(unhandled_case_error);
01739 }
01740
01741
01742 updatefile("scratchlogsubtrrefpha",input_general.logfile);
01743 updatefile("scratchressubtrrefpha",input_general.i_resfile);
01744
01745 PROGRESS.print("Finished SUBTRREFPHA.");
01746 DEBUG.print("Time spent for subtraction of reference phase:");
01747 printcpu();
01748 }
01749
01750
01751 if (alreadyprocessed[pr_i_subtrrefpha])
01752 {
01753 INFO.print("latest known processing stage: subtrrefpha");
01754 char SECTIONID[ONE27];
01755 strcpy(SECTIONID,"*_Start_");
01756 strcat(SECTIONID,processcontrol[pr_i_subtrrefpha]);
01757 interferogram.fillproductinfo(input_general.i_resfile,SECTIONID);
01758 }
01759
01760
01761 if (input_general.process[pr_i_subtrrefpha])
01762 {
01763 PROGRESS.print("calling preview for refpha corrected image");
01764
01765
01766 if (input_i_subtrrefpha.dumponlyrefpha==true)
01767 strcpy(interferogram.file,input_i_subtrrefpha.forefpha);
01768 preview(input_general.preview,
01769 int32((interferogram.win.pixels()/interferogram.multilookP)),
01770 interferogram.formatflag, interferogram.file,
01771 "interferogram_srp_mag.ras", "-e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
01772 preview(input_general.preview,
01773 int32((interferogram.win.pixels()/interferogram.multilookP)),
01774 interferogram.formatflag, interferogram.file,
01775 "interferogram_srp_pha.ras", "-q phase -o sunraster -b -c jet -M 2/2");
01776 preview(input_general.preview,
01777 int32((interferogram.win.pixels()/interferogram.multilookP)),
01778 interferogram.formatflag, interferogram.file,
01779 "interferogram_srp_mix.ras", "-e 0.3 -s 1.2 -q mixed -o sunraster -b -c cool -M 2/2");
01780 if (input_i_subtrrefpha.dumponlyrefpha==true)
01781 {INFO.print("exiting, only dumped refpha"); exit(1);}
01782 }
01783
01784
01785
01786
01787
01788 if (input_general.process[pr_i_coherence])
01789 {
01790 PROGRESS.print("Start COHERENCE.");
01791 alreadyprocessed[pr_i_coherence]=1;
01792 if (input_general.interactive)
01793 {
01794 cerr << "\nProcessing computation of coherence.";
01795 getanswer();
01796 }
01797
01798
01799 switch (input_i_coherence.method)
01800 {
01801 case coh_oldmethod:
01802
01803
01804 compcoherence(master, slave,
01805 input_general, input_i_coherence, coeff_flat);
01806 break;
01807 case coh_newmethod:
01808
01809 PRINT_ERROR("NOT IMPLEMENTED IN THIS VERSION.")
01810 throw(unhandled_case_error);
01811 break;
01812 default:
01813 PRINT_ERROR("unknown method coherence.")
01814 throw(unhandled_case_error);
01815 }
01816
01817
01818 updatefile("scratchlogcoherence",input_general.logfile);
01819 updatefile("scratchrescoherence",input_general.i_resfile);
01820
01821 PROGRESS.print("Finished COHERENCE.");
01822 DEBUG.print("Time spent for computation of coherence:");
01823 printcpu();
01824 }
01825
01826
01827 if (alreadyprocessed[pr_i_coherence])
01828 {
01829 INFO.print("latest known processing stage: coherence");
01830 char SECTIONID[ONE27];
01831 strcpy(SECTIONID,"*_Start_");
01832 strcat(SECTIONID,processcontrol[pr_i_coherence]);
01833 coherence.fillproductinfo(input_general.i_resfile,SECTIONID);
01834 }
01835
01836 if (input_general.process[pr_i_coherence])
01837 {
01838
01839
01840 PROGRESS.print("calling preview for coherence");
01841 preview(input_general.preview,
01842 int32((coherence.win.pixels()/coherence.multilookP)),
01843 coherence.formatflag, coherence.file,
01844 "coherence.ras",
01845 "-q normal -o sunraster -b -c gray -M 2/2");
01846 }
01847
01848
01849
01850
01851 if (input_general.process[pr_i_comprefdem])
01852 {
01853 PROGRESS.print("Start COMPREFDEM.");
01854 alreadyprocessed[pr_i_comprefdem]=1;
01855 if (input_general.interactive)
01856 {
01857 cerr << "\nProcessing computation of reference phase from DEM.\n";
01858 getanswer();
01859 }
01860
01861 radarcodedem(input_general, input_ellips, input_i_comprefdem,
01862 master, slave, interferogram,
01863 masterorbit, slaveorbit);
01864
01865
01866 updatefile("scratchlogcomprefdem",input_general.logfile);
01867 updatefile("scratchrescomprefdem",input_general.i_resfile);
01868
01869
01870 PROGRESS.print("Finished COMPREFDEM.");
01871 DEBUG.print("Time spent for computation of reference DEM:");
01872 printcpu();
01873 }
01874
01875
01876 if (alreadyprocessed[pr_i_comprefdem])
01877 {
01878 INFO.print("latest known processing stage: comprefdem");
01879 char SECTIONID[ONE27];
01880 strcpy(SECTIONID,"*_Start_");
01881 strcat(SECTIONID,processcontrol[pr_i_comprefdem]);
01882 radarcodedrefdem.fillproductinfo(input_general.i_resfile,SECTIONID);
01883 }
01884
01885 if (input_general.process[pr_i_comprefdem])
01886 {
01887
01888
01889 PROGRESS.print("calling preview for comprefdem (phase)");
01890 preview(input_general.preview,
01891 int32((radarcodedrefdem.win.pixels()/radarcodedrefdem.multilookP)),
01892 radarcodedrefdem.formatflag, radarcodedrefdem.file,
01893 "comprefdem_phase.ras",
01894 "-q normal -o sunraster -b -c jet -M 2/2");
01895 if (specified(input_i_comprefdem.forefdemhei))
01896 {
01897 PROGRESS.print("calling preview for comprefdem (height)");
01898 preview(input_general.preview,
01899 int32((radarcodedrefdem.win.pixels()/radarcodedrefdem.multilookP)),
01900 FORMATR4, input_i_comprefdem.forefdemhei,
01901 "comprefdem_height.ras",
01902 "-q normal -o sunraster -b -c jet -M 2/2");
01903 }
01904 }
01905
01906
01907
01908
01909 if (input_general.process[pr_i_subtrrefdem])
01910 {
01911 PROGRESS.print("Start SUBTRREFDEM.");
01912 alreadyprocessed[pr_i_subtrrefdem]=1;
01913 if (input_general.interactive)
01914 {
01915 cerr << "\nProcessing subtraction of reference DEM from interferogram.\n";
01916 getanswer();
01917 }
01918 subtrrefdem(interferogram,radarcodedrefdem,input_general,input_i_subtrrefdem);
01919
01920
01921 updatefile("scratchlogsubtrrefdem",input_general.logfile);
01922 updatefile("scratchressubtrrefdem",input_general.i_resfile);
01923
01924 PROGRESS.print("Finished SUBTRREFDEM.");
01925 DEBUG.print("Time spent for subtraction of reference DEM:");
01926 printcpu();
01927 }
01928
01929
01930 if (alreadyprocessed[pr_i_subtrrefdem])
01931 {
01932 INFO.print("latest known processing stage: subtrrefdem");
01933
01934 char SECTIONID[ONE27];
01935 strcpy(SECTIONID,"*_Start_");
01936 strcat(SECTIONID,processcontrol[pr_i_subtrrefdem]);
01937 interferogram.fillproductinfo(input_general.i_resfile,SECTIONID);
01938 }
01939
01940
01941 if (input_general.process[pr_i_subtrrefdem])
01942 {
01943 PROGRESS.print("calling preview for refdem corrected interferogram");
01944 preview(input_general.preview,
01945 int32((interferogram.win.pixels()/interferogram.multilookP)),
01946 interferogram.formatflag, interferogram.file,
01947 "interferogram_srd_mag.ras", "-e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
01948 preview(input_general.preview,
01949 int32((interferogram.win.pixels()/interferogram.multilookP)),
01950 interferogram.formatflag, interferogram.file,
01951 "interferogram_srd_pha.ras", "-q phase -o sunraster -b -c jet -M 2/2");
01952 preview(input_general.preview,
01953 int32((interferogram.win.pixels()/interferogram.multilookP)),
01954 interferogram.formatflag, interferogram.file,
01955 "interferogram_srd_mix.ras", "-e 0.3 -s 1.2 -q mixed -o sunraster -b -c hot -M 2/2");
01956 }
01957
01958
01959
01960 if (input_general.process[pr_i_filtphase])
01961 {
01962 PROGRESS.print("Start FILTPHASE.");
01963 alreadyprocessed[pr_i_filtphase]=1;
01964 if (input_general.interactive)
01965 {
01966 cerr << "\nProcessing phase filtering.";
01967 getanswer();
01968 }
01969
01970 switch (input_i_filtphase.method)
01971 {
01972 case fp_goldstein:
01973 phasefilter(input_general,interferogram,input_i_filtphase);
01974 break;
01975 case fp_spatialconv:
01976 spatialphasefilt(input_general,interferogram,input_i_filtphase);
01977 break;
01978 case fp_spectral:
01979 phasefilterspectral(input_general,interferogram,input_i_filtphase);
01980 break;
01981 default:
01982 PRINT_ERROR("PANIC: not possible.")
01983 throw(unhandled_case_error);
01984 }
01985
01986
01987 updatefile("scratchlogfiltphase",input_general.logfile);
01988 updatefile("scratchresfiltphase",input_general.i_resfile);
01989
01990 PROGRESS.print("Finished FILTPHASE.");
01991 DEBUG.print("Time spent for phase filtering:");
01992 printcpu();
01993 }
01994
01995
01996 if (alreadyprocessed[pr_i_filtphase])
01997 {
01998 INFO.print("latest known processing stage: filtphase");
01999 char SECTIONID[ONE27];
02000 strcpy(SECTIONID,"*_Start_");
02001 strcat(SECTIONID,processcontrol[pr_i_filtphase]);
02002 interferogram.fillproductinfo(input_general.i_resfile,SECTIONID);
02003 }
02004
02005
02006 if (input_general.process[pr_i_filtphase])
02007 {
02008 PROGRESS.print("calling preview for phase filtered corrected interferogram");
02009 preview(input_general.preview,
02010 int32((interferogram.win.pixels()/interferogram.multilookP)),
02011 interferogram.formatflag, interferogram.file,
02012 "interferogram_filt_mag.ras", "-e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
02013 preview(input_general.preview,
02014 int32((interferogram.win.pixels()/interferogram.multilookP)),
02015 interferogram.formatflag, interferogram.file,
02016 "interferogram_filt_pha.ras", "-q phase -o sunraster -b -c jet -M 2/2");
02017 preview(input_general.preview,
02018 int32((interferogram.win.pixels()/interferogram.multilookP)),
02019 interferogram.formatflag, interferogram.file,
02020 "interferogram_filt_mix.ras", "-e 0.3 -s 1.2 -q mixed -o sunraster -b -c hsv -M 2/2");
02021 }
02022
02023
02024
02025
02026 if (input_general.process[pr_i_dinsar])
02027 {
02028 PROGRESS.print("Start DINSAR.");
02029 alreadyprocessed[pr_i_dinsar]=1;
02030 if (input_general.interactive)
02031 {
02032 cerr << "\nProcessing differential interferometry.";
02033 getanswer();
02034 }
02035 dinsar(input_general,input_i_dinsar,input_ellips,
02036 master,masterorbit,
02037 slave,slaveorbit,interferogram);
02038
02039
02040 updatefile("scratchlogdinsar",input_general.logfile);
02041 updatefile("scratchresdinsar",input_general.i_resfile);
02042
02043 PROGRESS.print("Finished DINSAR.");
02044 DEBUG.print("Time spent for 3 pass differential interferometry:");
02045 printcpu();
02046 }
02047
02048
02049
02050 if (alreadyprocessed[pr_i_dinsar])
02051 {
02052 INFO.print("latest known processing stage: dinsar");
02053 char SECTIONID[ONE27];
02054 strcpy(SECTIONID,"*_Start_");
02055 strcat(SECTIONID,processcontrol[pr_i_dinsar]);
02056 interferogram.fillproductinfo(input_general.i_resfile,SECTIONID);
02057 }
02058
02059
02060 if (input_general.process[pr_i_dinsar])
02061 {
02062 PROGRESS.print("calling preview for differential interferogram");
02063 preview(input_general.preview,
02064 int32((interferogram.win.pixels()/interferogram.multilookP)),
02065 interferogram.formatflag, interferogram.file,
02066 "interferogram_dinsar_mag.ras", "-e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2");
02067 preview(input_general.preview,
02068 int32((interferogram.win.pixels()/interferogram.multilookP)),
02069 interferogram.formatflag, interferogram.file,
02070 "interferogram_dinsar_pha.ras", "-q phase -o sunraster -b -c jet -M 2/2");
02071 preview(input_general.preview,
02072 int32((interferogram.win.pixels()/interferogram.multilookP)),
02073 interferogram.formatflag, interferogram.file,
02074 "interferogram_dinsar_mix.ras", "-e 0.3 -s 1.2 -q mixed -o sunraster -b -c jet -M 2/2");
02075 }
02076
02077
02078
02079
02080
02081 unwrappedinterf = interferogram;
02082 if (input_general.process[pr_i_unwrap])
02083 {
02084 PROGRESS.print("Start UNWRAP.");
02085 alreadyprocessed[pr_i_unwrap]=1;
02086 if (input_general.interactive)
02087 {
02088 cerr << "\nProcessing unwrapping of interferogram.";
02089 getanswer();
02090 }
02091
02092 switch (input_i_unwrap.method)
02093 {
02094
02095 case uw_method1:
02096 unwraptreeframon(
02097 input_general,
02098 input_i_unwrap,
02099 interferogram);
02100 break;
02101
02102
02103 case uw_method2:
02104 snaphu_unwrap(
02105 input_general,
02106 input_i_unwrap,
02107 interferogram,
02108 master, slave,
02109 masterorbit, slaveorbit,
02110 input_ellips);
02111 if (specified(input_i_unwrap.snaphu_log))
02112 updatefile(input_i_unwrap.snaphu_log,input_general.logfile);
02113 break;
02114
02115
02116 case uw_method3:
02117 PRINT_ERROR("NOT IMPLEMENTED IN THIS VERSION.")
02118 throw(unhandled_case_error);
02119 break;
02120
02121 default:
02122 PRINT_ERROR("PANIC: NOT POSSIBLE.")
02123 throw(unhandled_case_error);
02124 }
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145 updatefile("scratchlogunwrap",input_general.logfile);
02146 updatefile("scratchresunwrap",input_general.i_resfile);
02147
02148 PROGRESS.print("Finished UNWRAP.");
02149 DEBUG.print("Time spent for unwrapping:");
02150 printcpu();
02151 }
02152
02153
02154
02155 unwrappedinterf = interferogram;
02156 if (alreadyprocessed[pr_i_unwrap])
02157 {
02158 INFO.print("latest known processing stage: unwrap");
02159 char SECTIONID[ONE27];
02160 strcpy(SECTIONID,"*_Start_");
02161 strcat(SECTIONID,processcontrol[pr_i_unwrap]);
02162 unwrappedinterf.fillproductinfo(input_general.i_resfile,SECTIONID);
02163 }
02164
02165 if (input_general.process[pr_i_unwrap])
02166 {
02167
02168
02169
02170
02171 PROGRESS.print("calling preview for unwrapped interferogram");
02172 preview(input_general.preview,
02173 int32((unwrappedinterf.win.pixels()/unwrappedinterf.multilookP)),
02174 unwrappedinterf.formatflag, unwrappedinterf.file,
02175 "unwrapped_interferogram.ras",
02176 "-q normal -o sunraster -b -c jet -M 2/2");
02177 }
02178
02179
02180
02181 if (input_general.process[pr_i_slant2h])
02182 {
02183 PROGRESS.print("Start SLANT2H.");
02184 alreadyprocessed[pr_i_slant2h]=1;
02185 if (input_general.interactive)
02186 {
02187 cerr << "\nProcessing slant to height conversion.";
02188 getanswer();
02189 }
02190 if (!strcmp(input_i_slant2h.fohei,unwrappedinterf.file))
02191 {
02192 PRINT_ERROR("slant2h: same filename input/output")
02193 throw(input_error);
02194 }
02195
02196 switch (input_i_slant2h.method)
02197 {
02198 case s2h_schwabisch:
02199 slant2hschwabisch(
02200 input_general, input_i_slant2h, input_ellips,
02201 master, slave, unwrappedinterf,
02202 masterorbit, slaveorbit);
02203 break;
02204
02205 case s2h_rodriguez:
02206 slant2hrodriguez(
02207 input_general, input_i_slant2h, input_ellips,
02208 master, slave, unwrappedinterf,
02209 coeff_flat,
02210 masterorbit, slaveorbit,
02211 baseline);
02212 break;
02213
02214 case s2h_ambiguity:
02215 slant2hambiguity(
02216 input_general, input_i_slant2h, input_ellips,
02217 master, slave, unwrappedinterf,
02218 masterorbit, slaveorbit,
02219 baseline);
02220
02221 alreadyprocessed[pr_i_geocoding]=1;
02222 break;
02223
02224 default:
02225 PRINT_ERROR("slant2h: unknown method.")
02226 throw(unhandled_case_error);
02227 }
02228
02229
02230 updatefile("scratchlogslant2h",input_general.logfile);
02231 updatefile("scratchresslant2h",input_general.i_resfile);
02232
02233 PROGRESS.print("Finished SLANT2H.");
02234 DEBUG.print("Time spent for slant 2 height:");
02235 printcpu();
02236 }
02237
02238
02239 if (alreadyprocessed[pr_i_slant2h])
02240 {
02241 INFO.print("latest known processing stage: slant2h");
02242 char SECTIONID[ONE27];
02243 strcpy(SECTIONID,"*_Start_");
02244 strcat(SECTIONID,processcontrol[pr_i_slant2h]);
02245 heightinradarsystem.fillproductinfo(input_general.i_resfile,SECTIONID);
02246 }
02247
02248 if (input_general.process[pr_i_slant2h])
02249 {
02250
02251
02252
02253
02254
02255 PROGRESS.print("calling preview for slant to height");
02256 preview(input_general.preview,
02257 int32((heightinradarsystem.win.pixels()/heightinradarsystem.multilookP)),
02258 heightinradarsystem.formatflag, heightinradarsystem.file,
02259 "height_in_radarcoordinates.ras",
02260 "-q normal -o sunraster -b -c jet -M 2/2");
02261 }
02262
02263
02264
02265
02266 if (input_general.process[pr_i_geocoding])
02267 {
02268 PROGRESS.print("Start GEOCODE.");
02269 alreadyprocessed[pr_i_geocoding]=1;
02270 if (input_general.interactive)
02271 {
02272 cerr << "\nProcessing geocoding.";
02273 getanswer();
02274 }
02275 geocode(
02276 input_general, input_i_geocode, input_ellips, master,
02277 heightinradarsystem, masterorbit);
02278
02279
02280 updatefile("scratchloggeocode",input_general.logfile);
02281 updatefile("scratchresgeocode",input_general.i_resfile);
02282 PROGRESS.print("Finished GEOCODE.");
02283 DEBUG.print("Time spent for geocoding:");
02284 printcpu();
02285 }
02286
02287
02288
02289 if (alreadyprocessed[pr_i_geocoding])
02290 {
02291 INFO.print("latest known processing stage: geocoding");
02292 }
02293
02294
02295
02296
02297
02298 if (processmaster)
02299 updateprocesscontrol(input_general.m_resfile,MASTERID);
02300 if (processlave)
02301 updateprocesscontrol(input_general.s_resfile,SLAVEID);
02302 if (processinterf)
02303 updateprocesscontrol(input_general.i_resfile,INTERFID);
02304
02305 DEBUG.print("Time spent for tidying up:");
02306 printcpu();
02307
02308 cout << "\n\nProcessing results are in parameter file";
02309 if ((processmaster && processlave) ||
02310 (processmaster && processinterf) ||
02311 (processlave && processinterf))
02312 cout << "s:\n";
02313 else
02314 cout << ":\n";
02315 if (processmaster)
02316 cout << " " << input_general.m_resfile << endl;
02317 if (processlave)
02318 cout << " " << input_general.s_resfile << endl;
02319 if (processinterf)
02320 cout << " " << input_general.i_resfile << endl;
02321 quote();
02322 WARNING.summary();
02323
02324 }
02325 catch(USAGE_ERROR& usage_error)
02326 {
02327 exit(-1);
02328 }
02329 catch(EXCEPTION& error)
02330 {
02331 cerr << "Caught error of EXCEPTION class!" << endl;
02332 cerr << "It is: " << (const char*)error << endl;
02333 printcpu();
02334 WARNING.summary();
02335 exit(1);
02336 }
02337 catch(const char* error_string)
02338 {
02339 cerr << "Caught error!" << endl;
02340 cerr << "It is: " << error_string << endl;
02341 printcpu();
02342 WARNING.summary();
02343 exit(2);
02344 }
02345 catch(...)
02346 {
02347 cerr << "Caught an unhandled error!" << endl;
02348 printcpu();
02349 WARNING.summary();
02350 exit(3);
02351 }
02352
02353 cout << "\n\nNormal termination.\nThank you for using Doris.\n\n";
02354 return int32(0);
02355 }
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366 void initmessages()
02367 {
02368 TRACE.setidentifyer("TRACE");
02369 TRACE.dostderr(0);
02370 TRACE.doprint(0);
02371 TRACE.bellrings(0);
02372 DEBUG.setidentifyer("DEBUG");
02373 DEBUG.dostderr(0);
02374 DEBUG.doprint(0);
02375 DEBUG.bellrings(0);
02376 INFO.setidentifyer("INFO");
02377 INFO.dostderr(0);
02378 INFO.doprint(1);
02379 INFO.bellrings(0);
02380 PROGRESS.setidentifyer("PROGRESS");
02381 PROGRESS.dostderr(1);
02382 PROGRESS.doprint(1);
02383 PROGRESS.bellrings(1);
02384 WARNING.setidentifyer("WARNING");
02385 WARNING.dostderr(1);
02386 WARNING.doprint(1);
02387 WARNING.bellrings(2);
02388 ERROR.setidentifyer("ERROR");
02389 ERROR.dostderr(1);
02390 ERROR.doprint(1);
02391 ERROR.bellrings(3);
02392 ERROR.doexit(0);
02393 matDEBUG.setidentifyer("mtxDEBUG");
02394 matDEBUG.dostderr(0);
02395 matDEBUG.doprint(1);
02396 matERROR.setidentifyer("mtxERROR");
02397 matERROR.dostderr(1);
02398 matERROR.doprint(1);
02399 matERROR.bellrings(10);
02400 matERROR.doexit(1);
02401 }
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414 void handleinput(int argc, char* argv[], input_gen &input_general)
02415 {
02416 TRACE_FUNCTION("handleinput");
02417
02418 switch (argc)
02419 {
02420 case 3:
02421 ;
02422
02423 case 2:
02424 if (!strcmp(argv[1],"-ver") || !strcmp(argv[1],"-v") ||
02425 !strcmp(argv[1],"-VER") || !strcmp(argv[1],"-V"))
02426 {
02427 cerr << "Software name: " << SWNAME
02428 << "\nSoftware version: " << SWVERSION << endl;
02429 exit(0);
02430 }
02431
02432 else if (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-H") ||
02433 !strcmp(argv[1],"-help") || !strcmp(argv[1],"-HELP"))
02434 {
02435
02436 if (argc==2)
02437 {
02438 INFO.print("Making system call:");
02439 INFO.print("helpdoris");
02440 system("helpdoris");
02441 }
02442 else
02443 {
02444 INFO << "helpdoris " << argv[2] << ends;
02445 char cmd[512];
02446 strcpy(cmd, INFO.get_str());
02447 INFO.print("Making system call:");
02448 INFO.print(cmd);
02449 system(cmd);
02450 }
02451 exit(0);
02452 }
02453
02454 else if (!strcmp(argv[1],"-c") || !strcmp(argv[1],"-C"))
02455 {
02456 copyright();
02457 }
02458
02459 else if (!strcmp(argv[1],"-q") || !strcmp(argv[1],"-Q"))
02460 {
02461 quote();
02462 exit(0);
02463 }
02464
02465 else
02466 strcpy(input_general.logfile,argv[1]);
02467 break;
02468
02469
02470
02471
02472 default:
02473 usage(argv[0]);
02474 }
02475
02476
02477 if (existed(input_general.logfile)==true)
02478 {
02479 INFO << "input file: \"" << input_general.logfile << "\"";
02480 INFO.print();
02481 }
02482 else
02483 {
02484 ERROR << argv[0] << " input file: \"" << input_general.logfile
02485 << "\" not found.";
02486 ERROR.print();
02487 throw(input_error);
02488
02489 }
02490 }
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500 void usage(char *programname)
02501 {
02502 TRACE_FUNCTION("usage");
02503 cerr << "\n\t *** ** ** * **"
02504 << "\n\t * * * * * * *"
02505 << "\n\t * * * * * * *"
02506 << "\n\t * * * * * * *"
02507 << "\n\t *** ** * * **\n\n\n";
02508 cerr << "\n Program: \"" << programname << "\" " << SWVERSION
02509 << "\n\tInterferometric processor for SAR SLC data.\n"
02510 << "\n\t(c) Delft University of Technolgy, the Netherlands."
02511 << "\n\t Created by: Bert Kampes.\n\n"
02512 << " SYNOPSIS:\n\t" << programname
02513 << " infile | -h [searchterm] | -v | -c | -q\n\n"
02514 << "\t infile: input file for " << programname << endl
02515
02516 << "\t -h [term]: call \"helpdoris\" (script with searchable help)\n"
02517 << "\t -c: return copyright notice.\n"
02518 << "\t -q: return random quote (not so random).\n"
02519 << "\t -v: return version number.\n\n\n";
02520 throw(usage_error);
02521 }
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532 void quote()
02533 {
02534 TRACE_FUNCTION("quote");
02535
02536 const int32 largestquote = ONE27;
02537 const char QUOTES[][largestquote] = {
02538 "tip: Check out \"http://enterprise.geo.tudelft.nl/doris/\"",
02539 "tip: Check out \"http://enterprise.geo.tudelft.nl/dig/\"",
02540 "tip: See the online manual at \"http://enterprise.geo.tudelft.nl/doris/\"",
02541 "tip: Type: \"helpdoris\" for a synopsis of all input cards.",
02542 "tip: The \"run\" script can be used to generate template input files.",
02543 "tip: Get ASAR/ERS[12] precise orbits via \"http://www.deos.tudelft.nl/ers/precorbs/\"",
02544 "tip: For RADARSAT, use polyfit orbit interpolation, not approximation.",
02545 "tip: cpxfiddle is a nifty little utility.",
02546 "tip: dateconv is a nifty little utility.",
02547 "GMT is a great package.",
02548 "The only thing we have to fear is fear itself.",
02549 "2b || !2b = 1",
02550 "Sent me better quotes. Quick.",
02551 "The whole is more than the sum of its parts.",
02552 "To Thales the primary question was not what do we know,\n\tbut how do we know it.",
02553 "For the things of this world cannot be made known without\n\ta knowledge of mathematics.",
02554 "Life is a school of probability.",
02555 "\"Obvious\" is the most dangerous word in mathematics.",
02556 "An expert is a man who has made all the mistakes, which can be made,\n\tin a very narrow field.",
02557 "Structures are the weapons of the mathematician.",
02558 "A witty statesman said, you might prove anything by figures.",
02559 "Men pass away, but their deeds abide.",
02560 "It is a good thing for an uneducated man to read books of quotations.",
02561 "Mathematics is written for mathematicians.",
02562 "Revolutions never occur in mathematics.",
02563 "It is easier to square the circle than to get round a mathematician.",
02564 "Cognito ergo sum. \"I think, therefore I am.\"",
02565 "It is not enough to have a good mind. The main thing is to use it well.",
02566 "From a drop of water a logician could predict an Atlantic or a Niagara.",
02567 "I don't believe in mathematics.",
02568 "Imagination is more important than knowledge.",
02569 "A Mathematician is a machine for turning coffee into theorems.",
02570 "Whenever you can, count.",
02571 "Mathematics is a language.",
02572 "One should always generalize.",
02573 "Statistics: the mathematical theory of ignorance.",
02574 "When we ask advice, we are usually looking for an accomplice.",
02575 "What we know is not much. What we do not know is immense.",
02576 "Medicine makes people ill, mathematics make them sad and theology makes them sinful.",
02577 "A great truth is a truth whose opposite is also a great truth.",
02578 "I feign no hypotheses.",
02579 "It is not certain that everything is uncertain.",
02580 "Though this be madness, yet there is method in it.",
02581 "I have no faith in political arithmetic.",
02582 "Fourier is a mathematical poem.",
02583 "We think in generalities, but we live in details.",
02584 "I think that God in creating man somewhat overestimated his ability.",
02585 "Add little to little and there will be a big pile.",
02586 "Computers in the future may weigh no more than 1.5 tons. (1949)",
02587 "There is no reason anyone would want a computer in their home. (1977)",
02588 "Heavier-than-air flying machines are impossible. (1895)",
02589 "Everything that can be invented has been invented. (1899)",
02590 "640K ought to be enough for anybody. (1981)",
02591 "Pentiums melt in your PC, not in your hand.",
02592 "Always remember you're unique, just like everyone else.",
02593 "Ever notice how fast Windows runs? Neither did I.",
02594 "Double your drive space - delete Windows!",
02595 "Circular definition: see Definition, circular.",
02596 "43.3% of statistics are meaningless.",
02597 "Very funny, Scotty. Now beam down my clothes.",
02598 "I've got a problem. I say everything twice",
02599 "Don't insult the alligator till after you cross the river.",
02600 "Black holes are where God divided by zero.",
02601 "% make fire\n\tMake: Don't know how to make fire. Stop.",
02602 "% why not?\n\tNo match.",
02603 "% gotta light?\n\tNo match.",
02604 "% !1984\n\t 1984: Event not found. # (on some systems)",
02605 "% How's my lovemaking?\n\t Unmatched '.",
02606 "% \"How would you rate his incompetence?\n\tUnmatched \".",
02607 "% [Where is Jimmy Hoffa?\n\tMissing ].",
02608 "% [Where is my brain?\n\tMissing ].",
02609 "% ^How did the sex change^ operation go?\n\tModifier failed.",
02610 "% ar x \"my love life\"\n\tar: my love life does not exist",
02611 "This time it will surely run.",
02612 "Bug? That's not a bug, that's a feature.",
02613 "It's redundant! It's redundant!",
02614 "cpxfiddle is a great program.",
02615 "The shortest path between two truths in the real domain\n\tpasses through the complex domain.",
02616 "You have a tendency to feel you are superior to most computers.",
02617 "The first 90% of a project takes 90% of the time.",
02618 "The last 10% of a project takes 90% of the time.",
02619 "Any given program, when running, is obsolete.",
02620 "Any given program costs more and takes longer.",
02621 "If a program is useful, it will have to be changed.",
02622 "If a program is useless, it will have to be documented.",
02623 "Any given program will expand to fill all available memory.",
02624 "The value of a program is porportional to the weight of its output.",
02625 "Program complexity grows until it exceeds the capability\n\tof the programmer who must maintain it.",
02626 "Make it possible for programmers to write programs in English\n\tand you will find that programmers cannot write in English.",
02627 "On a helmet mounted mirror used by US cyclists:\n\t\"REMEMBER, OBJECTS IN THE MIRROR ARE ACTUALLY BEHIND YOU.\"",
02628 "On a New Zealand insect spray\n\t\"THIS PRODUCT NOT TESTED ON ANIMALS.\"",
02629 "In some countries, on the bottom of Coke bottles:\n\t\"OPEN OTHER END.\"",
02630 "On a Sears hairdryer:\n\t\"DO NOT USE WHILE SLEEPING.\"",
02631 "On a bar of Dial soap:\n\t\"DIRECTIONS - USE LIKE REGULAR SOAP.\"",
02632 "On a Korean kitchen knife:\n\t\"WARNING KEEP OUT OF CHILDREN.\"",
02633 "On an American Airlines packet of nuts:\n\t\"INSTRUCTIONS - OPEN PACKET, EAT NUTS.\"",
02634 "On a child's superman costume:\n\t\"WEARING OF THIS GARMENT DOES NOT ENABLE YOU TO FLY.\"",
02635 "Looking at wrapped interferograms is like running in circles.",
02636 "Conversation equals conservation (proposition with thesis Ramon Hanssen).",
02637 "Unlikely children's book title:\n\t\"Curios George and the High-Voltage Fence\".",
02638 "Unlikely children's book title:\n\t\"Controlling the Playground: Respect through Fear\".",
02639 "Unlikely children's book title:\n\t\"Mr Fork and Ms Electrical Outlet Become Friends\".",
02640 "Unlikely children's book title:\n\t\"Strangers Have the Best Candy\".",
02641 "Unlikely children's book title:\n\t\"Daddy Drinks Because You Cry\".",
02642 "Stanley looked quite bored and somewhat detached, but then penguins often do.",
02643 "Trouble with Windows? Reboot. Trouble with Unix? Be root.",
02644 "The good thing about standards is that there are so many to choose from.",
02645 "You can always count on Americans to do the right thing,\n\tafter they have exhausted all the alternatives.",
02646 "Where there is matter, there is geometry.",
02647 "The simplest schoolboy is now familiar with facts for which Archimedes\n\twould have sacrificed his life.",
02648 "Get the fastest fourier transform in the west at http://www.fftw.org/",
02649 "See http://www.gnu.org/ for compiler updates, etc.",
02650 "You can only find truth with logic if you have already found truth without it.",
02651 "Everything should be made as simple as possible, but not simpler.",
02652 "Seek simplicity, and distrust it.",
02653 "Descartes commanded the future from his study more\n\tthan Napoleon from the throne.",
02654 "Say what you know, do what you must, come what may.",
02655 "To the devil with those who published before us.",
02656 "The words figure and fictitious both derive from\n\tthe same Latin root, fingere. Beware!",
02657 "The best material model of a cat is another, or preferably the same, cat.",
02658 "He who loves practice without theory is like the sailor who boards ship\n\twithout a rudder and compass.",
02659 "Nature uses as little as possible of anything.",
02660 "Mathematics is not yet ready for such problems.",
02661 "You can only find truth with logic if you have already found truth without it.",
02662 "Natural selection is a mechanism for generating an exceedingly high\n\tdegree of improbability.",
02663 "Similar figures exist only in pure geometry.",
02664 "Writing briefly takes far more time than writing at length.",
02665 "Like the crest of a peacock so is mathematics at the head of all knowledge.",
02666 "The real danger is not that computers will begin to think like men,\n\tbut that men will begin to think like computers.",
02667 "Why did the blond stare at the orange juice?\n\tit said concentrate.",
02668 "Hofstadter's Law: It always takes longer than you expect,\neven when you take into account Hofstadter's Law.",
02669 "It can be of no practical use to know that Pi is irrational, but if we\n\tcan know, it surely would be intolerable not to know.",
02670 "Life is a complex, it has real and imaginary parts.",
02671 "Beauty can be perceived but not explained.",
02672 "Programming is like sex: one mistake and you have to\n\tsupport it for the rest of your life. [Michael Sinz]",
02673 "I wish you were here and I was there [me].",
02674 "In mathematics you dont understand things, you just get used to them [Neumann].",
02675 "A man is incomplete until he is married. After that, he is finished [Zsa Zsa Gabor].",
02676 "Unlikely children's book title:\n\t\"The Kids' Guide to Hitchhiking\".",
02677 "Unlikely children's book title:\n\t\"Whining, Kicking and Crying to Get Your Way\".",
02678 "Unlikely children's book title:\n\t\"Dads New Wife Robert\".",
02679 "Unlikely children's book title:\n\t\"The Little Sissy Who Snitched\".",
02680 ""};
02681
02682
02683 const int32 NUMQUOTES = 141;
02684 const int32 seed = time(NULL);
02685 const int32 quotenumber = seed%NUMQUOTES;
02686 cerr << "\n ..." << QUOTES[quotenumber] << "\n\n";
02687 }
02688
02689
02690
02691
02692
02693
02694
02695
02696 void copyright()
02697 {
02698 TRACE_FUNCTION("copyright");
02699 cerr << "\n\t *** ** ** * **"
02700 << "\n\t * * * * * * *"
02701 << "\n\t * * * * * * *"
02702 << "\n\t * * * * * * *"
02703 << "\n\t *** ** * * **\n"
02704 << "\n"
02705 << "\n"
02706 << "COPYRIGHT NOTICE:\n"
02707 << "-----------------\n"
02708 << " Doris program is free software; you can redistribute it and/or modify\n"
02709 << "it under the terms of the GNU General Public License as published by\n"
02710 << "the Free Software Foundation; either version 2 of the License, or\n"
02711 << "(at your option) any later version.\n"
02712 << "\n"
02713 << "Doris is distributed in the hope that it will be useful,\n"
02714 << "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
02715 << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
02716 << "GNU General Public License for more details.\n"
02717 << "\n"
02718 << "You should have received a copy of the GNU General Public License\n"
02719 << "along with this program; if not, write to the Free Software\n"
02720 << "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
02721 << "--- (END COPYRIGHT NOTICE) ---\n"
02722 << "\n"
02723 << "Publications that contain results produced by the Doris software should \n"
02724 << "contain an acknowledgment. (For example: The interferometric processing \n"
02725 << "was performed using the freely available Doris software package developed \n"
02726 << "by the Delft Institute for Earth-Oriented Space Research (DEOS), Delft \n"
02727 << "University of Technology, or include a reference to: Bert Kampes and \n"
02728 << "Stefania Usai. \"Doris: The Delft Object-oriented Radar Interferometric \n"
02729 << "software.\" In: proceedings 2nd ITC ORS symposium, August 1999. (cdrom)).\n"
02730 << "\n[Written by Bert Kampes, (c)1998-2003].\n\n";
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764 exit(0);
02765 }
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779 void preview(
02780 int32 previewflag,
02781 int32 width,
02782 int32 formatflag,
02783 char *infile,
02784 char *outfile,
02785 char *opts)
02786 {
02787 TRACE_FUNCTION("preview (BK 07-Feb-2002)");
02788 DEBUG << "previewflag: " << previewflag;
02789 DEBUG.print();
02790 if (previewflag==0)
02791 {
02792 DEBUG.print("NO preview requested.");
02793 return;
02794 }
02795 char scriptname[127];
02796
02797 strcpy(scriptname,"./");
02798 strcat(scriptname,outfile);
02799 strcat(scriptname,".sh");
02800 INFO.reset();
02801 if (previewflag<3)
02802 {
02803 PROGRESS.print("Start PREVIEW generation.");
02804
02805 switch (formatflag)
02806 {
02807 case FORMATCR4:
02808 {
02809 INFO << "cpxfiddle -w " << width << " " << opts;
02810 INFO << " -f cr4 -l1 -p1 -P" << width;
02811 break;
02812 }
02813 case FORMATCI2:
02814 {
02815 INFO << "cpxfiddle -w " << width << " " << opts;
02816 INFO << " -f ci2 -l1 -p1 -P" << width;
02817 break;
02818 }
02819
02820
02821
02822
02823 case FORMATHGT:
02824 {
02825 PROGRESS.print(
02826 "Trying to trick cpxfiddle for HGT format (should work)");
02827 int32 start_band_2 = int32(floor(width/2.0)+2.0);
02828 DEBUG << "start of second band for cpxfiddle: " << start_band_2;
02829 DEBUG.print();
02830 INFO << "cpxfiddle -w " << width << " " << opts;
02831 INFO << " -f cr4 -l1 -p" << start_band_2 << " -P" << width;
02832 break;
02833 }
02834
02835
02836
02837 case FORMATR4:
02838 {
02839
02840 PROGRESS.print(
02841 "Trying to trick cpxfiddle for REAL4 format (should work)");
02842 INFO << "cpxfiddle -w " << width << " " << opts;
02843 INFO << " -f r4 -l1 -p1 -P" << width;
02844 break;
02845 }
02846 default:
02847 PRINT_ERROR("PREVIEW generation: Unknown formatflag.")
02848 throw(unhandled_case_error);
02849 }
02850 INFO << " " << infile << " > " << outfile << ends;
02851 INFO.print("With following command the SUNraster image can be generated again.");
02852 INFO.print(INFO.get_str());
02853
02854 ofstream scriptfile;
02855 scriptfile.open(scriptname, ios::out);
02856 bk_assert(scriptfile,scriptname,__FILE__,__LINE__);
02857 scriptfile << "#!/bin/sh\n"
02858 << "# Doris software generated script to generate preview.\n"
02859 << "# Program cpxfiddle is used to create a SUNraster file\n"
02860 << "# from a complex input file. (For unwrapped interferograms\n"
02861 << "# we try to fool cpxfiddle.)\n"
02862 << "# Send comments to: Bert Kampes, b.m.kampes@lr.tudelft.nl\n"
02863 << "# to run, type at prompt: " << scriptname << endl
02864 << INFO.get_str() << endl;
02865 if (previewflag==2)
02866 {
02867 scriptfile << "xv " << outfile << endl;
02868 }
02869 scriptfile << "# EOF\n";
02870 scriptfile.close();
02871
02872
02873
02874 DEBUG << "chmod +x " << scriptname << endl << ends;
02875 DEBUG.print();
02876 system(DEBUG.get_str());
02877
02878
02879
02880
02881
02882 INFO.reset();
02883 INFO << scriptname << "&" << endl << ends;
02884 system(INFO.get_str());
02885 INFO.print();
02886 PROGRESS << "SUNraster file created of: " << infile
02887 << " (see also file: " << scriptname << ")";
02888 PROGRESS.print();
02889 }
02890 else
02891 {
02892 PRINT_ERROR("PREVIEW generation: Unknown option.")
02893 throw(unhandled_case_error);
02894 }
02895 }
02896
02897