Commit 3711a65e authored by Andrey Filippov's avatar Andrey Filippov

debugging

parent b56ba447
......@@ -936,6 +936,7 @@ public class CuasMotion {
double lma_mink, // = 0.0; // Minimal K (overshoot) = 0.0
double lma_maxk, // = 5.0; // Minimal K (overshoot) = 5.0
double lma_a2a,
double lma_horizon, // horizon as maximal pixel Y
String [] slice_titles, //
String title_targets_filt,
double [][][] failures_debug,
......@@ -959,6 +960,7 @@ public class CuasMotion {
lma_mink, // final double lma_mink, // = 0.0; // Minimal K (overshoot) = 1.0
lma_maxk, // final double lma_maxk, // = 5.0; // Minimal K (overshoot) = 3.0// final double lma_a2a,
lma_a2a, // final double lma_a2a,
lma_horizon, // final double lma_horizon, // horizon as maximal pixel Y
lma_minxy, // final double lma_minxy, // 0.8
tilesX, // final int tilesX,
failures_debug, // final double failures_debug,
......@@ -1633,6 +1635,7 @@ public class CuasMotion {
final double lma_mink, // = 0.0; // Minimal K (overshoot) = 1.0
final double lma_maxk, // = 5.0; // Minimal K (overshoot) = 3.0
final double lma_a2a,
final double lma_horizon, // horizon as maximal pixel Y
final double lma_minxy, // 0.8
final int tilesX,
final double [][][] failures_debug, // if not null, should be [num_scenes][][], fill contain a copy of original target_coords with failure reason
......@@ -1672,6 +1675,7 @@ public class CuasMotion {
double RMSE_A = lma_rslts[CuasMotionLMA.RSLT_RMS_A];
double R1 = lma_rslts[CuasMotionLMA.RSLT_R1];
double MAX2A = lma_rslts[CuasMotionLMA.RSLT_MAX2A];
double Y = (ntile/tilesX +0.5) * GPUTileProcessor.DTT_SIZE + lma_rslts[CuasMotionLMA.RSLT_Y];
if (A < lma_mina) {
if (failures_debug != null) failures_debug[nSeq][ntile][CuasMotionLMA.RSLT_FAIL] = CuasMotionLMA.FAIL_A_LOW;
continue; // too weak
......@@ -1716,6 +1720,11 @@ public class CuasMotion {
if (failures_debug != null) failures_debug[nSeq][ntile][CuasMotionLMA.RSLT_FAIL] = CuasMotionLMA.FAIL_FAR;
continue; // center outside of allowed range (on the very edges)
}
if ((lma_horizon >0) && (Y > lma_horizon)) {
if (failures_debug != null) failures_debug[nSeq][ntile][CuasMotionLMA.RSLT_FAIL] = CuasMotionLMA.FAIL_HORIZON;
continue; // below horizon line
}
// filter_target[nSeq][ntile] = true;
// Now calculate overall quality
double [] quality_factors = new double [IMPORTANCE_LENGTH];
......@@ -1797,6 +1806,7 @@ public class CuasMotion {
public static boolean [][] filterMotionScanTarget( // should work for motion vectors and target coordinates
double [][] confidence,
double min_confidence,
final double lma_horizon, // target below horizon
final int tilesX,
final int range, // 1 or 2
final int [] remain,
......@@ -1808,6 +1818,7 @@ public class CuasMotion {
final boolean [][] filter5 = new boolean [num_seq][num_tiles];
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final int ihorizon = (lma_horizon > 0) ?( (int) Math.ceil(lma_horizon/GPUTileProcessor.DTT_SIZE)) : -1; // tiles with tileY >= ihorizon are removed
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
......@@ -1816,6 +1827,9 @@ public class CuasMotion {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
int num_total = 0;
Arrays.fill(prohibit, false);
if ((ihorizon > 0) && (ihorizon < tilesY)) {
Arrays.fill(prohibit, ihorizon*tilesX, num_tiles, true);
}
double [] conf = confidence[nSeq];
int num_this_pass = 0;
int npass = 0;
......@@ -3738,7 +3752,7 @@ public class CuasMotion {
double lma_mink = clt_parameters.imp.cuas_lma_mink; // = 0.0; // Minimal K (overshoot) <0.007
double lma_maxk = clt_parameters.imp.cuas_lma_maxk; // = 5.0; // Minimal K (overshoot) > 3.8
double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
double target_horizon= clt_parameters.imp.cuas_horizon;
// Handling overall target scores
double min_score_mv = clt_parameters.imp.cuas_score_mv;
......@@ -3986,6 +4000,16 @@ public class CuasMotion {
motion_scan, // double [][][] scan0, // all tried for targets
targets_bad, // double [][][] scan1) // good targets
remain);
// remove known good (already processed)
motion_scan = subtractMotionScans( // motion vectors
motion_scan, // double [][][] scan0, // all tried for targets
targets_good, // double [][][] scan1) // good targets (lma-vect)
remain);
if (debugLevel > -4) printRemain(remain, "filtered wo good", true);
if (save_filtered_low) {
//title_vf_all
ImagePlus imp_ms1 = showVectorFieldsSequence(
......@@ -3994,7 +4018,8 @@ public class CuasMotion {
speed_pref, // double speed_pref,
speed_boost, // double speed_boost,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"MS1-NOBAD-n"+niter,// String title,
// model_prefix+"MS1-NOBAD-n"+niter,// String title,
model_prefix+"MS1-NOBAD-NOGOOD-n"+niter,// String title,
false, // boolean nan_effective_strength,
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -4030,6 +4055,7 @@ public class CuasMotion {
boolean[][] filter5 = filterMotionScanTarget(
effective_strength, // double [][] confidence,
min_score_mv, // double min_confidence,
target_horizon, // final double lma_horizon, // target below horizon
cuasMotion.tilesX, // final int tilesX,
max_range, // final int range, // 1 or 2
remain, // final int [] remain){
......@@ -4065,12 +4091,14 @@ public class CuasMotion {
double [][][] motion_scan_filtered = applyFilter( // motion vectors
motion_scan, // double [][][] motion_scan,
filter5); // boolean [][] filter5)
/*
// remove known good (already processed)
motion_scan_filtered = subtractMotionScans( // motion vectors
motion_scan_filtered, // double [][][] scan0, // all tried for targets
targets_good, // double [][][] scan1) // good targets (lma-vect)
remain);
if (debugLevel > -4) printRemain(remain, "filtered wo good", true);
*/
// Anything remains? we'll see after extension
double [][][] extended_scan = extendMotionScan(
motion_scan_filtered, // final double [][][] motion_scan,
......@@ -4293,6 +4321,7 @@ public class CuasMotion {
lma_mink, // double lma_mink, // = 1.0; // Minimal K (overshoot) = 1.0
lma_maxk, // double lma_maxk, // = 1.0; // Minimal K (overshoot) = 3.0
lma_a2a, // double lma_a2a,
target_horizon, // double lma_horizon, // horizon as maximal pixel Y
slice_titles, // String [] slice_titles, //
model_prefix+"-TARGETS-FILTERED-LMA-n"+niter, // String title_targets_filt, // empty
failures_debug, // double [][][] failures_debug,
......@@ -4368,6 +4397,7 @@ public class CuasMotion {
double lma_minxy = 0.8;
double [][][] failures_debug = (intermed_low) ? (new double [targets_good.length][][]) : null;
System.out.println("\nUsing horizon cutoff at "+target_horizon);
double [][] target_scores = getEffectiveStrengthLMA(
targets_good, // final double [][][] target_coords, // LMA
factor_lim, // final double importance_limit,
......@@ -4382,6 +4412,8 @@ public class CuasMotion {
lma_mink, // final double lma_mink, // = 0.0; // Minimal K (overshoot) = 1.0
lma_maxk, // final double lma_maxk, // = 5.0; // Minimal K (overshoot) = 3.0
lma_a2a, // final double lma_a2a,
target_horizon, // final double lma_horizon, // target below horizon
lma_minxy, // final double lma_minxy, // 0.8
cuasMotion.tilesX, // final int tilesX,
failures_debug, // final double [][][] failures_debug,
......@@ -4414,6 +4446,7 @@ public class CuasMotion {
boolean[][] filter5 = filterMotionScanTarget(
target_scores, // double [][] confidence,
min_score_lma, // min_mv_strength, // double min_confidence,
target_horizon, // final double lma_horizon, // target below horizon
cuasMotion.tilesX, // final int tilesX,
max_range, // final int range, // 1 or 2
remain, // final int [] remain){
......@@ -4708,6 +4741,7 @@ public class CuasMotion {
lma_mink, // double lma_mink, // = 1.0; // Minimal K (overshoot) = 1.0
lma_maxk, // double lma_maxk, // = 1.0; // Minimal K (overshoot) = 3.0
lma_a2a, // double lma_a2a,
target_horizon, // double lma_horizon, // horizon as maximal pixel Y
slice_titles, // String [] slice_titles, //
model_prefix+"-LMA-FILTERED", // String title_targets_filt,
null, // double [][][] failures_debug,
......
......@@ -60,6 +60,7 @@ public class CuasMotionLMA {
public static final int FAIL_K_LOW = 7; // Overshoot is too low (not used, it can be down to 0)
public static final int FAIL_K_HIGH = 8; // Overshoot is too high
public static final int FAIL_FAR = 9; // Peak is too far from the center
public static final int FAIL_HORIZON = 10; // Peak is below horizon
private int width;
private double [][] window;
......
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