Commit 69bd7ae6 authored by Andrey Filippov's avatar Andrey Filippov

Target analysis

parent 869ec232
...@@ -211,6 +211,16 @@ public class CuasMotion { ...@@ -211,6 +211,16 @@ public class CuasMotion {
public static final String ANNOTS = "IR+"; // Image pane, Radar pane, clean mask public static final String ANNOTS = "IR+"; // Image pane, Radar pane, clean mask
public static final String ANNOT_TIP = "\"I\" - show in image pane, \"R\" - show in radar pane, \"+\" - show in clean view (mask for both panes)"; public static final String ANNOT_TIP = "\"I\" - show in image pane, \"R\" - show in radar pane, \"+\" - show in clean view (mask for both panes)";
// target data files analysis (GUI and future MCP)
public static final String [] ANLZ_MODES = {"section","non-empty","non_NaN","==",">=","<="};
public static final int ANLZ_SECT = 0; // generate section
public static final int ANLZ_NEMPTY = 1; // list tiles with targets
public static final int ANLZ_DEFINED = 2; // list tiles with targets with non-NaN parameter
public static final int ANLZ_EQ = 3; // list tiles with targets with parameter equal (such as FAILURE==0)
public static final int ANLZ_GE = 4; // list tiles with targets with parameter >= value (such as AMPLITUDE >= 1.0)
public static final int ANLZ_LE = 5; // list tiles with targets with parameter <= value (such as RMSE <= 0.5)
public static void setCuasAnnots( public static void setCuasAnnots(
String annot, String annot,
int indx, int indx,
...@@ -1057,7 +1067,6 @@ public class CuasMotion { ...@@ -1057,7 +1067,6 @@ public class CuasMotion {
} }
public static void targetsAnalyze() { // not yet used public static void targetsAnalyze() { // not yet used
String [] modes = {"section","non-empty","non_NaN","==",">=","<="};
int mode = 0; int mode = 0;
double par_val = 0.0; double par_val = 0.0;
int max_targets = 50; int max_targets = 50;
...@@ -1081,6 +1090,7 @@ public class CuasMotion { ...@@ -1081,6 +1090,7 @@ public class CuasMotion {
System.out.println("targetsAnalyze() -> err="+err_num[0]); System.out.println("targetsAnalyze() -> err="+err_num[0]);
return; return;
} }
int num_tiles = wh[0]*wh[1];
boolean skip_empty = true; boolean skip_empty = true;
int nseq0 = 0; int nseq0 = 0;
int nseq1 = multi_targets.length -1; int nseq1 = multi_targets.length -1;
...@@ -1114,7 +1124,7 @@ public class CuasMotion { ...@@ -1114,7 +1124,7 @@ public class CuasMotion {
"Parameter index to display"); "Parameter index to display");
gd1.addCheckbox("Skip empty", skip_empty, "Do not show tiles with no targets"); gd1.addCheckbox("Skip empty", skip_empty, "Do not show tiles with no targets");
gd1.addChoice("Report mode", modes, modes[mode], "Select one of the report modes."); gd1.addChoice("Report mode", ANLZ_MODES, ANLZ_MODES[mode], "Select one of the analysis modes.");
gd1.addNumericField("Parameter value", par_val, 4, 10, "", gd1.addNumericField("Parameter value", par_val, 4, 10, "",
"Parameter value to compare"); "Parameter value to compare");
gd1.addNumericField("Number of tiles to show", max_targets, 0, 3, "", gd1.addNumericField("Number of tiles to show", max_targets, 0, 3, "",
...@@ -1143,6 +1153,9 @@ public class CuasMotion { ...@@ -1143,6 +1153,9 @@ public class CuasMotion {
nseq1 = Math.max(Math.min(nseq1, multi_targets.length -1), nseq0); nseq1 = Math.max(Math.min(nseq1, multi_targets.length -1), nseq0);
npar = Math.max(Math.min(npar, num_pars -1), -extra_choices.length); npar = Math.max(Math.min(npar, num_pars -1), -extra_choices.length);
switch (mode) {
case ANLZ_SECT:
System.out.println("\nDisplaying scenes from "+nseq0+" to "+nseq1+", parameter: "+choices[npar+extra_choices.length]); // CuasMotionLMA.LMA_TITLES System.out.println("\nDisplaying scenes from "+nseq0+" to "+nseq1+", parameter: "+choices[npar+extra_choices.length]); // CuasMotionLMA.LMA_TITLES
System.out.println("tx="+tx+", ty="+ty); System.out.println("tx="+tx+", ty="+ty);
int ntile = tx + ty * wh[0]; int ntile = tx + ty * wh[0];
...@@ -1169,6 +1182,94 @@ public class CuasMotion { ...@@ -1169,6 +1182,94 @@ public class CuasMotion {
} }
} }
System.out.println(); System.out.println();
break;
case ANLZ_NEMPTY: // list tiles with targets
case ANLZ_DEFINED: // list tiles with targets with non-NaN parameter
case ANLZ_EQ: // list tiles with targets with parameter equal (such as FAILURE==0)
case ANLZ_GE: // list tiles with targets with parameter >= value (such as AMPLITUDE >= 1.0)
case ANLZ_LE: // list tiles with targets with parameter <= value (such as RMSE <= 0.5)
System.out.print("\nLooking for tiles in each scene from "+nseq0+" to "+nseq1);
switch (mode) {
case ANLZ_NEMPTY: System.out.print(" that contain at least one target"); break;
case ANLZ_DEFINED: System.out.print(" that contain at least one target with non-NaN "+choices[npar+extra_choices.length]+" value"); break;
case ANLZ_EQ: // list tiles with targets with parameter equal (such as FAILURE==0)
case ANLZ_GE: // list tiles with targets with parameter >= value (such as AMPLITUDE >= 1.0)
case ANLZ_LE: // list tiles with targets with parameter <= value (such as RMSE <= 0.5)
System.out.print(" that contain at least one target with "+choices[npar+extra_choices.length]+
" "+ANLZ_MODES[mode]+" "+par_val+"."); break;
}
if (npar <0) {
npar = 0; // use x instead of pseudo -1 (pX/pY)
}
if (max_targets > 0) {
System.out.println(" Number of reported tiles is limited to "+max_targets);
} else {
System.out.println(" Unlimited number of reported tiles");
}
for (int nseq = nseq0; nseq <= nseq1; nseq++) {
ArrayList<Integer> tiles_list = new ArrayList<Integer>();
for (ntile = 0; ntile < num_tiles; ntile++){
boolean has_targets = (multi_targets[nseq] != null) &&
(multi_targets[nseq][ntile] != null) &&
(multi_targets[nseq][ntile].length > 0);
if (has_targets) {
search_targets: {
if (mode == ANLZ_NEMPTY) {
tiles_list.add(ntile);
break search_targets;
} else {
int num_targ = multi_targets[nseq][ntile].length;
for (int ntarg = 0; ntarg < num_targ; ntarg++) if (multi_targets[nseq][ntile][ntarg] != null){
switch (mode) {
case ANLZ_DEFINED:
if (!Double.isNaN(multi_targets[nseq][ntile][ntarg][npar])){
tiles_list.add(ntile);
break search_targets;
}
break;
case ANLZ_EQ: // list tiles with targets with parameter equal (such as FAILURE==0)
if (multi_targets[nseq][ntile][ntarg][npar] == par_val){
tiles_list.add(ntile);
break search_targets;
}
break;
case ANLZ_GE: // list tiles with targets with parameter >= value (such as AMPLITUDE >= 1.0)
if (multi_targets[nseq][ntile][ntarg][npar] >= par_val){
tiles_list.add(ntile);
break search_targets;
}
break;
case ANLZ_LE: // list tiles with targets with parameter <= value (such as RMSE <= 0.5)
if (multi_targets[nseq][ntile][ntarg][npar] <= par_val){
tiles_list.add(ntile);
break search_targets;
}
break;
}
}
}
}
}
}
if (!tiles_list.isEmpty() || !skip_empty) {
System.out.print(String.format("%17s, %4d, targets:%5d",pvf_titles[0][nseq],nseq, tiles_list.size()));
if (!tiles_list.isEmpty()) {
int ntiles = tiles_list.size();
if (max_targets > 0) {
ntiles = Math.min(ntiles, max_targets);
System.out.print(" [");
for (int tile: tiles_list) {
System.out.print(String.format("%5d (%3d:%3d), ",tile,tile%wh[0],tile/wh[0]));
}
System.out.print(" ]");
}
}
System.out.println();
}
}
break;
} // switch (mode)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment