Commit 1b90adae authored by Andrey Filippov's avatar Andrey Filippov

Implemented fast/slow targets

parent 58388314
......@@ -327,13 +327,17 @@ public class Cuas {
tilesX, // int width, // only used if restored from tiff, ignored for .cuas
dts, // double dts, // time stamp as double, only used if restored from tiff, ignored for .cuas
debugLevel); // int debugLevel)
if (debugLevel > -3) {
if (debugLevel > -4) {
if (cuasData != null) {
System.out.println("createCenterClt(): read cumulative parent data from "+cumulative_parent_dir_path);
} else {
System.out.println("createCenterClt(): FAILED to read cumulative parent data from "+cumulative_parent_dir_path);
}
}
} else {
if (debugLevel > -4) {
System.out.println("createCenterClt(): using new average");
}
}
CuasData newCuasData = getTDComboSceneSequence(
......
......@@ -104,6 +104,8 @@ public class CuasMotion {
private int tilesY;
private double [] sky_mask = null;
public boolean slow_targets = false;
public CuasMotion (
CLTParameters clt_parameters,
QuadCLT parentCLT,
......@@ -3057,7 +3059,7 @@ public class CuasMotion {
public static float [][] runningGaussian(
final float [][] fpixels,
final int ra_length,
final double ra_length,
final int width){
final int num_scenes = fpixels.length;
final int num_pixels = fpixels[0].length;
......@@ -4068,7 +4070,7 @@ public class CuasMotion {
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
//fpixels, // final float [][] fpixels,
fpixels_tum, // float [][] fpixels_tum,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
......@@ -4245,7 +4247,7 @@ public class CuasMotion {
int [] num_bad = new int [num_corr_samples];
int [] totals = null;
int [] passes = new int [num_corr_samples]; // debugging filter5
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
for (int niter=0; niter < num_cycles; niter++) {
boolean save_filtered_low = intermed_low && (niter < iter_show);
boolean save_filtered_high = intermed_high && (niter < iter_show);
......@@ -4875,7 +4877,7 @@ public class CuasMotion {
// boolean remove_isolated= clt_parameters.imp.cuas_isolated;
boolean intermed_low = clt_parameters.imp.cuas_intermed_low; //true;
// boolean center_targ = clt_parameters.imp.cuas_center_targ;
boolean debug_more = true; // false;
boolean debug_more = clt_parameters.imp.cuas_debug_more;
for (int i = 0; i < target_frac.length; i++) {
if (clt_parameters.imp.cuas_target_frac[i].length >= 2) {
target_frac[i][0] = clt_parameters.imp.cuas_target_frac[i][0];
......@@ -4884,7 +4886,7 @@ public class CuasMotion {
System.out.println("testCuasScanMotion(): wrong format for a pair of strength, fraction values.");
}
}
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
......@@ -5100,7 +5102,8 @@ public class CuasMotion {
CuasMotion cuasMotion,
String [] slice_titles,
final int debugLevel) {
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
final int corr_offset = clt_parameters.imp.cuas_corr_offset;
final boolean half_step = clt_parameters.imp.cuas_half_step; // true;
......@@ -5338,7 +5341,7 @@ public class CuasMotion {
String [] scene_titles, // recreate slice_titles from scene titles?
String [] slice_titles,
final int debugLevel) {
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
final int corr_offset = clt_parameters.imp.cuas_corr_offset;
final int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
......@@ -5427,7 +5430,7 @@ public class CuasMotion {
float [][] background = fpixels;
String ra_bg_suffix=(ra_background? "-RABG":"");
String ra_bg_suffix=(ra_background? ("-RABG"+corr_pairs):"");
if (ra_background) {
if (cuas_gaussian_ra) {
background = runningGaussian(
......@@ -6512,7 +6515,7 @@ public class CuasMotion {
nSeq, // int dbg_seq,
ntile, // int dbg_tile,
indx, // int dbg_index,
debugLevel); // int debug_level)
debugLevel-3); // int debug_level)
target[CuasMotionLMA.RSLT_ITERS] = rslt; // will save -1 (failure) also
if (rslt >= 0) {
cuasMotionLMA.setResult(target);
......@@ -6664,7 +6667,11 @@ public class CuasMotion {
public static double [][][] convertFromMultiTarget(
final double [][][][] target_multi) {
final double [][][][] target_multi,
final double minimal_score,
final int min_seq, // minimal sequence length
final int enough_seq, // good regardless of scores
final int [] remain){
final int num_seq = target_multi.length;
final int num_tiles = target_multi[0].length;
final double [][][] target_sequence = new double[num_seq][num_tiles][];
......@@ -6675,11 +6682,23 @@ public class CuasMotion {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
if (remain != null) {
remain[nSeq] = 0;
}
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [][] targets = target_multi[nSeq][ntile];
if ((targets != null) && (targets.length > 0)) {
target_sequence[nSeq][ntile] = targets[0];
if (targets[0][CuasMotionLMA.RSLT_FAIL] == CuasMotionLMA.FAIL_NONE) {
if (targets[0][CuasMotionLMA.RSLT_MATCH_LENGTH] ==enough_seq) {
target_sequence[nSeq][ntile] = targets[0];
remain[nSeq]++;
} else if ((targets[0][CuasMotionLMA.RSLT_QSCORE] >= minimal_score) && (targets[0][CuasMotionLMA.RSLT_MATCH_LENGTH] >= (min_seq-1))) {
target_sequence[nSeq][ntile] = targets[0];
if (remain != null) {
remain[nSeq]++;
}
}
}
}
}
}
......@@ -6795,6 +6814,7 @@ public class CuasMotion {
}
targets[indx2] = null;
adup.getAndIncrement();
break; // for (int indx1 = 0; indx1 < indx2; indx1++) if (targets[indx1] != null){
}
}
}
......@@ -7130,7 +7150,7 @@ public class CuasMotion {
}
}
boolean debug_tum= true; // false;
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
float [][] fpixels_tum = fpixels;
if (temporal_um > 0) {
if (intermed_high && debug_tum) {
......@@ -7224,7 +7244,7 @@ public class CuasMotion {
fpixels_tum, // float[][] pixels,
cuasMotion.gpu_max_width, // int width,
cuasMotion.gpu_max_height, // int height,
model_prefix+"-SOURCE-DIFF", //String title,
model_prefix+"-FPIXELS_TUM"+temporal_um, //String title,
scene_titles); //String [] titles)
imp_diff.getProcessor().setMinAndMax(-input_range/2, input_range/2);
if (!batch_mode) {
......@@ -7242,7 +7262,7 @@ public class CuasMotion {
CLTParameters clt_parameters,
final boolean batch_mode,
QuadCLT parentCLT, //
float [][] fpixels,
// float [][] fpixels,
float [][] fpixels_tum,
final CuasMotion cuasMotion,
String [] scene_titles, // recreate slice_titles from scene titles?
......@@ -7277,7 +7297,7 @@ public class CuasMotion {
}
}
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int num_scenes = fpixels_tum.length; // .length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
int corr_inc = half_step ? (corr_offset/2) : corr_offset;
int num_corr_samples = (num_scenes - seq_length - start_frame) / corr_inc;
......@@ -7285,7 +7305,22 @@ public class CuasMotion {
int [] num_undef = new int [num_corr_samples];
int [] num_good = new int [num_corr_samples];
int [] num_bad = new int [num_corr_samples];
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
if (intermed_high) {
ImagePlus imp_tum = ShowDoubleFloatArrays.makeArrays(
fpixels_tum, // float[][] pixels,
cuasMotion.gpu_max_width, // int width,
cuasMotion.gpu_max_height, // int height,
model_prefix+"-SOURCE", //String title,
scene_titles); //String [] titles)
imp_tum.getProcessor().setMinAndMax(-input_range/2, input_range/2);
if (!batch_mode) {
imp_tum.show();
}
parentCLT.saveImagePlusInModelDirectory(imp_tum); // ImagePlus imp)
}
float [][] fpixels_ra = fpixels_tum; //fpixels;
if (precorr_ra > 1) {
......@@ -7305,7 +7340,7 @@ public class CuasMotion {
fpixels_ra, // float[][] pixels,
cuasMotion.gpu_max_width, // int width,
cuasMotion.gpu_max_height, // int height,
model_prefix+(cuas_gaussian_ra?"-SOURCE-RG":"-SOURCE-RA"), //String title,
model_prefix+(cuas_gaussian_ra?"-SOURCE-RG":"-SOURCE-RA")+precorr_ra, //String title,
scene_titles); //String [] titles)
imp_ra.getProcessor().setMinAndMax(-input_range/2, input_range/2);
if (!batch_mode) {
......@@ -7398,7 +7433,7 @@ public class CuasMotion {
CLTParameters clt_parameters,
final boolean batch_mode,
QuadCLT parentCLT, //
float [][] fpixels,
// float [][] fpixels,
float [][] fpixels_tum,
double [][][] motion_sequence, // starts with just motion-based, then adds other fields (single target per tile)
final CuasMotion cuasMotion,
......@@ -7475,16 +7510,17 @@ public class CuasMotion {
double factor_lim = clt_parameters.imp.cuas_factor_lim;
double factor_pow = clt_parameters.imp.cuas_factor_pow;
double [] score_coeff = clt_parameters.imp.cuas_score_coeff.clone();
double slow_score = clt_parameters.imp.cuas_slow_score;
double input_range = clt_parameters.imp.cuas_input_range; // 5;
int iter_show = clt_parameters.imp.cuas_iter_show; //1; // Maximal enhancement iteration to show intermediate result (0 - none)
boolean intermed_low = clt_parameters.imp.cuas_intermed_low; //true;
boolean intermed_high = clt_parameters.imp.cuas_intermed_high; //true;
// boolean intermed_giga = clt_parameters.imp.cuas_intermed_giga; //false;
// boolean center_targ = clt_parameters.imp.cuas_center_targ;
double centered_radius= clt_parameters.imp.cuas_centered_radius; // 3.5; // in centered mode (target placed at [8,8] - zero out data outside peripheral areas, keep 0.5 at the radius
double centered_blur = clt_parameters.imp.cuas_centered_blur; // 0.5; // relative transition radius range (for 0.5 the mask inside (1-0.5) radius will be 1.0, outside (1+0.5) radius will be 0
double duplicate_tolerance = clt_parameters.imp.cuas_duplicate_tolerance ; // 2.0; // (pix) Remove weaker maximums closer than this to a stronger one
double centered_radius= clt_parameters.imp.cuas_centered_radius; // 3.5; // in centered mode (target placed at [8,8] - zero out data outside peripheral areas, keep 0.5 at the radius
double centered_blur = clt_parameters.imp.cuas_centered_blur; // 0.5; // relative transition radius range (for 0.5 the mask inside (1-0.5) radius will be 1.0, outside (1+0.5) radius will be 0
double duplicate_tolerance = clt_parameters.imp.cuas_duplicate_tolerance ; // 2.0; // (pix) Remove weaker maximums closer than this to a stronger one
boolean debug_more = clt_parameters.imp.cuas_debug_more;
for (int i = 0; i < target_frac.length; i++) {
if (clt_parameters.imp.cuas_target_frac[i].length >= 2) {
......@@ -7497,7 +7533,7 @@ public class CuasMotion {
double filter_below_horizon=5;
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int num_scenes = fpixels_tum.length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
int corr_inc = half_step ? (corr_offset/2) : corr_offset;
int num_corr_samples = (num_scenes - seq_length - start_frame) / corr_inc;
......@@ -7510,7 +7546,8 @@ public class CuasMotion {
int [] num_bad = new int [num_corr_samples];
int [] totals = null;
int [] passes = new int [num_corr_samples]; // debugging filter5
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
final int num_seq = motion_sequence.length;
final int num_tiles = motion_sequence[0].length;
final double [][][][] target_sequence_multi = new double [num_seq][num_tiles][][];
......@@ -7519,14 +7556,12 @@ public class CuasMotion {
for (; niter < num_cycles; niter++) {
boolean save_filtered_low = intermed_low && (niter < iter_show);
boolean save_filtered_high = intermed_high && (niter < iter_show);
// boolean save_filtered_giga = intermed_giga && (niter < iter_show);
totals = getRemain(motion_sequence, target_sequence_multi, num_all, num_undef, num_good, num_bad);
// if (debugLevel > -4) printStats ("Iteration "+niter+ " start", true,num_all, num_undef, num_good, num_bad);
if (totals[TOTALS_UNDEFINED] == 0) {
if (debugLevel > -4) System.out.println ("No undefined tiles left, breaking loop");
break;
}
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
ImagePlus imp_ms1 = showTargetSequence(
motion_sequence, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -7547,7 +7582,7 @@ public class CuasMotion {
speed_pref, // double speed_pref,
speed_boost); // double speed_boost);
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
ImagePlus imp_mv_strength = showTargetSequence(
motion_sequence, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -7606,7 +7641,7 @@ public class CuasMotion {
2, // final int range, // 1 or 2
null); // remain); // final int [] remain)
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
// targets_nonoverlap will contain motion vectors used fro the next fpixels_accumulated
ImagePlus imp_novl = showTargetSequence(
......@@ -7726,14 +7761,14 @@ public class CuasMotion {
parentCLT.saveImagePlusInModelDirectory(imp_acc); // ImagePlus imp)
}
boolean good_only= true;
boolean good_only= false;
boolean show_empty = true; // false; // show scenes with no (valid) targets
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
ImagePlus imp_new = showTargetSequence(
targets_new_multi, // final double [][][][] targets_multi,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-NEW-TARGETS-MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -7766,6 +7801,7 @@ public class CuasMotion {
factor_lim, // final double importance_limit,
factor_pow, // final double importance_power, // Raise each factor to this power before combining
score_coeff, // final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
slow_score, // final double slow_score, // multiply total score for targets detected in slow target mode
cuasMotion.tilesX); // final int tilesX,
if (save_filtered_low) {
......@@ -7773,7 +7809,7 @@ public class CuasMotion {
targets_new_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-NEW-TARGETS_SCORES_MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -7794,7 +7830,7 @@ public class CuasMotion {
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-ADDED_NEW_MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -7812,6 +7848,19 @@ public class CuasMotion {
}
} //for (niter=0; niter < max_iter; niter++)
if (intermed_low) {
ImagePlus imp_new_scores = showTargetSequence(
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-ROUNDE_ONE",// String title,
false, // good_only, // final boolean good_only,
false, // show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_new_scores); // ImagePlus imp)
}
//===========================================================================
if (debugLevel > -4) {
......@@ -7820,12 +7869,13 @@ public class CuasMotion {
// second pass, using non-centered targets
int niter_lim = niter+ num_cycles;
int iter_show1 = iter_show + niter;
for (; niter < niter_lim; niter++) {
boolean good_only= true;
boolean good_only= false;
boolean show_empty = true; // false; // show scenes with no (valid) targets
boolean save_filtered_low = intermed_low && (niter < iter_show);
boolean save_filtered_high = intermed_high && (niter < iter_show);
boolean save_filtered_low = intermed_low && (niter < iter_show1);
boolean save_filtered_high = intermed_high && (niter < iter_show1);
// totals = getRemain(motion_sequence, target_sequence_multi, num_all, num_undef, num_good, num_bad);
totals = getRemain(target_sequence_multi, num_all, num_undef, num_good, num_bad);
if (totals[TOTALS_UNDEFINED] == 0) {
......@@ -7862,12 +7912,12 @@ public class CuasMotion {
parentCLT.saveImagePlusInModelDirectory(imp_filter5); // ImagePlus imp)
}
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
ImagePlus imp_marked_used = showTargetSequence(
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-MARKED_USED-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -7893,7 +7943,7 @@ public class CuasMotion {
2, // final int range, // 1 or 2
null); // remain); // final int [] remain)
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
// targets_nonoverlap will contain motion vectors used fro the next fpixels_accumulated
ImagePlus imp_novl = showTargetSequence(
targets_nonoverlap, // double [][][] vector_fields_sequence,
......@@ -7951,7 +8001,7 @@ public class CuasMotion {
// targets_new will contain motion vectors, centroid, and LMA results combined
//save_filtered_high
float [][] accum_debug = save_filtered_high? new float [num_corr_samples][]:null; //fpixels_accumulated.length]
boolean keep_failed = false; // keep failed targets
boolean keep_failed = false; // keep failed targets
double [][][][] targets_new_multi = getAccumulatedCoordinatesMulti(
keep_failed, // final boolean keep_failed, // keep failed targets
niter, // final int when, // set if >=0 for failures
......@@ -8020,12 +8070,12 @@ public class CuasMotion {
if (save_filtered_low) {
if (save_filtered_low && debug_more) {
ImagePlus imp_new = showTargetSequence(
targets_new_multi, // final double [][][][] targets_multi,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-NEW-TARGETS-CENTERED-MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -8057,6 +8107,7 @@ public class CuasMotion {
factor_lim, // final double importance_limit,
factor_pow, // final double importance_power, // Raise each factor to this power before combining
score_coeff, // final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
slow_score, // final double slow_score, // multiply total score for targets detected in slow target mode
cuasMotion.tilesX); // final int tilesX,
if (save_filtered_low) {
......@@ -8064,7 +8115,7 @@ public class CuasMotion {
targets_new_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-NEW-TARGETS_CENTERED_SCORES_MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -8086,7 +8137,7 @@ public class CuasMotion {
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-ADDED_NEW_CENTERED_MULTI-n"+niter,// String title,
false, // good_only, // final boolean good_only,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -8103,15 +8154,15 @@ public class CuasMotion {
System.out.println("Centered iteration "+niter+" DONE.\n");
}
} //for (niter=0; niter < max_iter; niter++)
boolean good_only= true;
boolean good_only= false;
boolean show_empty = true; // false; // show scenes with no (valid) targets
if (intermed_low) { // targets_good now has
ImagePlus imp_good = showTargetSequence(
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-COMBINED",// String title,
false, // good_only, // final boolean good_only,
model_prefix+"-ROUND_TWO",// String title,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
......@@ -8570,10 +8621,11 @@ public class CuasMotion {
}
public static int [] getScore(
final double [][][][] target_sequence_multi, // modifies certain fields (scores)
final double [][][][] target_sequence_multi,// modifies certain fields (scores)
final double importance_limit,
final double importance_power, // Raise each factor to this power before combining
final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
final double importance_power, // Raise each factor to this power before combining
final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
final double slow_score, // multiply total score for targets detected in slow target mode
final int tilesX ) {
double sw = 0;
for (int i = 0; i < importance.length; i++) {
......@@ -8648,7 +8700,7 @@ public class CuasMotion {
final double [][][][] target_sequence_multi, // will only process non-nulls here
final double [][][][] new_sequence_multi,
final int num_best, // if >0, limit number of best results to add
final int when_iter) { // , final boolean overwrite) {
final int when_iter) { // , final boolean overwrite) {
final int num_seq = target_sequence_multi.length;
final int num_tiles = target_sequence_multi[0].length;
final Thread[] threads = ImageDtt.newThreadArray();
......@@ -8696,6 +8748,52 @@ public class CuasMotion {
return anew.get();
}
public static double [][][][] combineFastSlow(
final double [][][][] targets_fast, // will only process non-nulls here
final double [][][][] targets_slow,
final double scale_slow){ // if >0, limit number of best results to add
final int num_seq = targets_fast.length;
final int num_tiles = targets_fast[0].length;
final double [][][][] targets_combo = new double[num_seq][num_tiles][][];
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) { // if (target_sequence[nSeq][ntile] != null) {
double [][] tf = targets_fast[nSeq][ntile];
double [][] ts = targets_slow[nSeq][ntile];
if ((tf != null) || (ts != null)) {
if (tf == null) tf = new double [0][];
if (ts == null) ts = new double [0][];
double [][] tc = new double [tf.length+ts.length][];
for (int i = 0; i < tf.length; i++) if (tf[i] != null){
tc[i] = tf[i].clone();
tc[i][CuasMotionLMA.RSLT_SLOW] = 0;
}
for (int i = 0; i < ts.length; i++) if (ts[i] != null){
tc[i + tf.length] = ts[i].clone();
tc[i + tf.length][CuasMotionLMA.RSLT_SLOW] = 1;
tc[i + tf.length][CuasMotionLMA.RSLT_QSCORE] *= scale_slow;
}
targets_combo[nSeq][ntile] = tc;
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return targets_combo;
}
public static int [] getRemain(
final double [][][][] target_sequence_multi,
int [] num_all_in,
......@@ -8819,6 +8917,11 @@ public class CuasMotion {
int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
boolean half_step = clt_parameters.imp.cuas_half_step; // true;
double slow_ra = clt_parameters.imp.cuas_slow_ra;
double slow_score = clt_parameters.imp.cuas_slow_score;
boolean multi_targ = clt_parameters.imp.cuas_multi_targ; // true; // Use multi-target for each tile mode
int seq_length = corr_offset + corr_pairs;
int corr_inc = half_step ? (corr_offset/2) : corr_offset;
......@@ -8828,43 +8931,71 @@ public class CuasMotion {
int frame_cent = start_frame + corr_inc * nscan + seq_length/2; // debug only
slice_titles[nscan] = scene_titles[frame_cent];
}
float [][] fpixels_tum = temporalUnsharpMask( // all good targets
double [][][] targets_nonconflict = null;
// process fast targets
cuasMotion.slow_targets = false; // just for filenames
float [][] fpixels_fast = temporalUnsharpMask( // all good targets
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
// slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
double [][][] motion_sequence = prepareMotionBasedSequence( // all good targets
double [][][] motion_sequence_fast = prepareMotionBasedSequence( // all good targets
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
fpixels_tum, // float [][] fpixels_tum,
fpixels_fast, // float [][] fpixels_tum,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
double [][][][] targets_fast = locateAndFreezeTargetsMulti( // all good targets
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels_fast, // float [][] fpixels_tum,
motion_sequence_fast,// double [][][] target_sequence,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
double [][][] targets_nonconflict = null;
if (multi_targ) {
double [][][][] targets_good_multi = locateAndFreezeTargetsMulti( // all good targets
// process slow targets
cuasMotion.slow_targets = true; // just for filenames
float [][] fpixels_slow = runningGaussian(
fpixels, // final float [][] fpixels,
slow_ra, // final double ra_length,
cuasMotion.gpu_max_width); // final int width)
double [][][] motion_sequence_slow = prepareMotionBasedSequence( // all good targets
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
fpixels_tum, // float [][] fpixels_tum,
motion_sequence,// double [][][] target_sequence,
fpixels_slow, // float [][] fpixels_tum,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
double [][][][] targets_slow = locateAndFreezeTargetsMulti( // all good targets
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels_slow, // float [][] fpixels_tum,
motion_sequence_slow,// double [][][] target_sequence,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
double [][][][] targets_good_multi = combineFastSlow(
targets_fast, // final double [][][][] targets_fast, // will only process non-nulls here
targets_slow, // final double [][][][] targets_slow,
slow_score); // final double scale_slow){ // if >0, limit number of best results to add
sortMultiTargets(
targets_good_multi, // final double [][][][] target_multi,
true); // final boolean trim_nulls) { // trim null targets
targets_nonconflict = resolveTargetsConflictsMulti(
clt_parameters, // CLTParameters clt_parameters,
......@@ -8876,7 +9007,6 @@ public class CuasMotion {
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
} else {
double [][][] targets_good = locateAndFreezeTargets( // all good targets
......@@ -8884,8 +9014,8 @@ public class CuasMotion {
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
fpixels_tum, // float [][] fpixels_tum,
motion_sequence,// double [][][] target_sequence,
fpixels_fast, // float [][] fpixels_tum,
motion_sequence_fast,// double [][][] target_sequence,
cuasMotion, // final CuasMotion cuasMotion,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
......@@ -8965,14 +9095,14 @@ public class CuasMotion {
// Handling overall target scores
double min_score_lma = clt_parameters.imp.cuas_score_lma;
int min_seq= clt_parameters.imp.cuas_min_seq; // 3; // minimal number of consecutive key frames for the same target
int enough_seq= clt_parameters.imp.cuas_enough_seq; // 5; // minimal number of consecutive key frames for the same target
double factor_lim = clt_parameters.imp.cuas_factor_lim;
double factor_pow = clt_parameters.imp.cuas_factor_pow;
double [] score_coeff = clt_parameters.imp.cuas_score_coeff.clone();
// boolean remove_isolated= clt_parameters.imp.cuas_isolated;
double slow_score = clt_parameters.imp.cuas_slow_score;
boolean intermed_low = clt_parameters.imp.cuas_intermed_low; //true;
// boolean center_targ = clt_parameters.imp.cuas_center_targ;
boolean debug_more = true; // false;
boolean debug_more = clt_parameters.imp.cuas_debug_more;
for (int i = 0; i < target_frac.length; i++) {
if (clt_parameters.imp.cuas_target_frac[i].length >= 2) {
target_frac[i][0] = clt_parameters.imp.cuas_target_frac[i][0];
......@@ -8981,7 +9111,7 @@ public class CuasMotion {
System.out.println("testCuasScanMotion(): wrong format for a pair of strength, fraction values.");
}
}
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
......@@ -9003,7 +9133,7 @@ public class CuasMotion {
boolean show_empty = true; // false; // show scenes with no (valid) targets
boolean trim_nulls = true;
final double duplicate_tolerance = clt_parameters.imp.cuas_duplicate_tolerance ; // 2.0; // (pix) Remove weaker maximums closer than this to a stronger one
if (intermed_low) {
if (intermed_low && debug_more) {
ImagePlus imp_in = showTargetSequence(
targets_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -9026,7 +9156,7 @@ public class CuasMotion {
targets_multi, // final double [][][][] target_multi,
trim_nulls); // final boolean trim_nulls) { // trim null targets
if (intermed_low) {
if (intermed_low && debug_more) {
ImagePlus imp_dup = showTargetSequence(
targets_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -9060,7 +9190,7 @@ public class CuasMotion {
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
cuasMotion.tilesX); //final int tilesX)
if (intermed_low) {
if (intermed_low && debug_more) {
ImagePlus imp_lengths = showTargetSequence(
targets_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -9099,11 +9229,12 @@ public class CuasMotion {
factor_lim, // final double importance_limit,
factor_pow, // final double importance_power, // Raise each factor to this power before combining
score_coeff, // final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
slow_score, // final double slow_score, // multiply total score for targets detected in slow target mode
cuasMotion.tilesX); // final int tilesX,
getRemain(targets_multi, num_all, num_undef, num_good, num_bad);
if (debugLevel > -4) printStats ("Resolving, after matching before/after", true,num_all, num_undef, num_good, num_bad);
if (intermed_low) {
if (intermed_low && debug_more) {
ImagePlus imp_failures = showTargetSequence(
targets_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
......@@ -9125,7 +9256,7 @@ public class CuasMotion {
// if not select_new (assumes not use motion) will return best (and good) target indices
false, // final boolean use_motion, // true - use motion vectors confidence, false - use target confidence
false, // final boolean select_new, // true - use only untested tiles, false - use good tiles
min_score_lma, // double min_confidence,
0, // min_score_lma, // 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
......@@ -9134,7 +9265,7 @@ public class CuasMotion {
1); // debugLevel); // final int debugLevel)
if (debugLevel > -4) printStatsLine("After filter5 remaining non-conflicting targets", true,filter5_remain);
if (intermed_low) {
if (intermed_low && debug_more) {
ImagePlus imp_filter5_lma = ShowDoubleFloatArrays.makeArrays(
filter5, // double[][] pixels,
cuasMotion.tilesX,
......@@ -9160,26 +9291,32 @@ public class CuasMotion {
sortMultiTargets(
targets_multi, // final double [][][][] target_multi,
true); // trim_nulls); // final boolean trim_nulls) { // trim null targets
if (intermed_low) { // save final
// final with all multi-target data
if (intermed_low) { // save always
ImagePlus imp_good = showTargetSequence(
targets_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-GOOD-NONOVERLAP",// String title,
model_prefix+"-TARGETS-MULTI",// String title,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_good); // ImagePlus imp)
}
if (debugLevel > -4) System.out.println("Cutting below minimal score = "+min_score_lma);
double [][][] target_single = convertFromMultiTarget(// single target per tile
targets_multi); // final double [][][][] target_multi) {
if (intermed_low) {
targets_multi, // final double [][][][] target_multi) {
min_score_lma, //final double minimal_score) {
min_seq, // final int min_seq) { // minimal sequence length
enough_seq, // final int enough_seq, // good regardless of scores
num_good); // final int [] remain){
if (debugLevel > -4) printStatsLine("Final section of single targets per tile", true, num_good);
if (intermed_low) { // save always
ImagePlus imp_failures = showTargetSequence(
target_single, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-TARGETS_SINGLE",// String title,
model_prefix+"-TARGETS_SINGLE-FINAL",// String title,
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_failures);
......
......@@ -77,8 +77,9 @@ public class CuasMotionLMA {
public static final int RSLT_QMATCH_LEN=34;
public static final int RSLT_QSCORE = 35;
public static final int RSLT_STRONGER =36; // index of stronger neighbor (may be more)
public static final int RSLT_WHEN = 37;
public static final int RSLT_FAIL = 38;
public static final int RSLT_SLOW = 37; // 1 - slow, 0 - fast
public static final int RSLT_WHEN = 38;
public static final int RSLT_FAIL = 39;
public static final int RSLT_LEN = RSLT_FAIL+1;
......
......@@ -781,6 +781,10 @@ min_str_neib_fpn 0.35
public double cuas_lma_maxk = 5.0; // Maximal K (overshoot) = 5.0 (>3.8)
public double cuas_lma_a2a = 0.7; // Minimal ratio of the maximal pixel to the amplitude
public double cuas_slow_ra = 50.0; // running averaging for slow targets
public double cuas_slow_score = 1.0; // scale scores for slow target mode
public double cuas_score_mv = 0.0; // minimal score for the motion vectors
public double cuas_score_lma = 0.0; // minimal score for the target LMA
public double cuas_factor_lim = 5.0; // limit each individual score factor
......@@ -794,6 +798,7 @@ min_str_neib_fpn 0.35
public boolean cuas_isolated = true; // remove targets that do not have neighbors before/after
public int cuas_min_seq = 3; // minimal number of consecutive key frames for the same target
public int cuas_enough_seq = 5; // number of consecutive key frames considered good regardless of individual scores (maybe add minimal travel in pixels)?
public int cuas_min_seq_fl = 2; // minimal number of consecutive key frames for the same target that includes first or last key frame
// public boolean cuas_remove_2seq = true; // Remove 2-long target sequences consisting of 2 consecutive key frames
// public boolean cuas_remove_2seq_all=true; // Remove 2-long first/last target sequences
......@@ -827,6 +832,7 @@ min_str_neib_fpn 0.35
public boolean cuas_intermed_low = true; // save intermediate vector fields and target coordinates from the LMA (80x64 layers)
public boolean cuas_intermed_high = true; // save pixel-resolution accumulated images (640x512)
public boolean cuas_intermed_giga = false;// save huge (gigabyte) intermediate files
public boolean cuas_debug_more = false;// save/show more images
public boolean cuas_save_mono = true; // save 32-bit monochrome target+backgrounds Tiffs (before optional scaling)
public boolean cuas_save_color = true; // save color rendered images (same as videos)
public boolean cuas_save_video = true; // save color rendered images (same as videos)
......@@ -2401,6 +2407,11 @@ min_str_neib_fpn 0.35
"Maximal ratio of the overshoot radius to the first 0 radius (typical 3.0).");
gd.addNumericField("Minimal max pixel to amplitude ratio", this.cuas_lma_a2a, 5,8,"",
"Minimal ratio of the maximal pixel near fitted maximum to the LMA amplitude.");
gd.addMessage("=== Slow targets detection ===");
gd.addNumericField("Slow targets averaging", this.cuas_slow_ra, 5,8,"frames",
"Running averaging for slow targets.");
gd.addNumericField("Slow targets score scale", this.cuas_slow_score, 5,8,"",
"Scale scores for slow target detection mode relative to fast target.");
gd.addMessage("=== Handling overall target scores ===");
gd.addNumericField("Minimal MV score", this.cuas_score_mv, 5,8,"",
......@@ -2425,6 +2436,8 @@ min_str_neib_fpn 0.35
gd.addNumericField("Minimal sequence length", this.cuas_min_seq, 0,3,"key frames",
"Minimal number of consecutive key frames for the target to be detected.");
gd.addNumericField("Sufficient consecutive key frames", this.cuas_enough_seq, 0,3,"key frames",
"Number of consecutive key frames considered good regardless of their scores.");
gd.addNumericField("Minimal end sequence length", this.cuas_min_seq_fl, 0,3,"key frames",
"Minimal number of consecutive key frames for the target to be detected if the sequence includes first or last key frame.");
......@@ -2482,6 +2495,8 @@ min_str_neib_fpn 0.35
"Save pixel-resolution accumulated images (640x512).");
gd.addCheckbox ("Save gigabyte files", this.cuas_intermed_giga,
"Save pixel-resolution huge files, such as hyperstack comparison.");
gd.addCheckbox ("Save/show additional images", this.cuas_debug_more,
"Save/show more images.");
gd.addCheckbox ("Save monochrome targets+background", this.cuas_save_mono,
"Save 32-bit monochrome targets+background Tiffs (before optional scaling).");
......@@ -3547,6 +3562,9 @@ min_str_neib_fpn 0.35
this.cuas_lma_maxk = gd.getNextNumber();
this.cuas_lma_a2a = gd.getNextNumber();
this.cuas_slow_ra = gd.getNextNumber();
this.cuas_slow_score = gd.getNextNumber();
this.cuas_score_mv = gd.getNextNumber();
this.cuas_score_lma = gd.getNextNumber();
this.cuas_factor_lim = gd.getNextNumber();
......@@ -3559,6 +3577,8 @@ min_str_neib_fpn 0.35
// this.cuas_remove_2seq = gd.getNextBoolean();
// this.cuas_remove_2seq_all = gd.getNextBoolean();
this.cuas_min_seq= (int) gd.getNextNumber();
this.cuas_enough_seq= (int) gd.getNextNumber();
this.cuas_min_seq_fl= (int) gd.getNextNumber();
this.cuas_max_mismatch= gd.getNextNumber();
......@@ -3588,6 +3608,7 @@ min_str_neib_fpn 0.35
this.cuas_intermed_low = gd.getNextBoolean();
this.cuas_intermed_high = gd.getNextBoolean();
this.cuas_intermed_giga = gd.getNextBoolean();
this.cuas_debug_more = gd.getNextBoolean();
this.cuas_save_mono = gd.getNextBoolean();
this.cuas_save_color = gd.getNextBoolean();
this.cuas_save_video = gd.getNextBoolean();
......@@ -4560,8 +4581,11 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_lma_minr1", this.cuas_lma_minr1+""); // double
properties.setProperty(prefix+"cuas_lma_mink", this.cuas_lma_mink+""); // double
properties.setProperty(prefix+"cuas_lma_maxk", this.cuas_lma_maxk+""); // double
properties.setProperty(prefix+"cuas_lma_a2a", this.cuas_lma_a2a+""); // double
properties.setProperty(prefix+"cuas_lma_a2a", this.cuas_lma_a2a+""); // double
properties.setProperty(prefix+"cuas_slow_ra", this.cuas_slow_ra+""); // double
properties.setProperty(prefix+"cuas_slow_score", this.cuas_slow_score+""); // double
properties.setProperty(prefix+"cuas_score_mv", this.cuas_score_mv+""); // double
properties.setProperty(prefix+"cuas_score_lma", this.cuas_score_lma+""); // double
properties.setProperty(prefix+"cuas_factor_lim", this.cuas_factor_lim+""); // double
......@@ -4575,6 +4599,7 @@ min_str_neib_fpn 0.35
// properties.setProperty(prefix+"cuas_remove_2seq", this.cuas_remove_2seq+""); // boolean
// properties.setProperty(prefix+"cuas_remove_2seq_all", this.cuas_remove_2seq_all+"");// boolean
properties.setProperty(prefix+"cuas_min_seq", this.cuas_min_seq+""); // int
properties.setProperty(prefix+"cuas_enough_seq", this.cuas_enough_seq+""); // int
properties.setProperty(prefix+"cuas_min_seq_fl", this.cuas_min_seq_fl+""); // int
properties.setProperty(prefix+"cuas_max_mismatch", this.cuas_max_mismatch+""); // double
......@@ -4603,6 +4628,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_intermed_low", this.cuas_intermed_low+""); // boolean
properties.setProperty(prefix+"cuas_intermed_high", this.cuas_intermed_high+""); // boolean
properties.setProperty(prefix+"cuas_intermed_giga", this.cuas_intermed_giga+""); // boolean
properties.setProperty(prefix+"cuas_debug_more", this.cuas_debug_more+""); // boolean
properties.setProperty(prefix+"cuas_save_mono", this.cuas_save_mono+""); // boolean
properties.setProperty(prefix+"cuas_save_color", this.cuas_save_color+""); // boolean
properties.setProperty(prefix+"cuas_save_video", this.cuas_save_video+""); // boolean
......@@ -5548,6 +5575,9 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_lma_maxk")!=null) this.cuas_lma_maxk=Double.parseDouble(properties.getProperty(prefix+"cuas_lma_maxk"));
if (properties.getProperty(prefix+"cuas_lma_a2a")!=null) this.cuas_lma_a2a=Double.parseDouble(properties.getProperty(prefix+"cuas_lma_a2a"));
if (properties.getProperty(prefix+"cuas_slow_ra")!=null) this.cuas_slow_ra=Double.parseDouble(properties.getProperty(prefix+"cuas_slow_ra"));
if (properties.getProperty(prefix+"cuas_slow_score")!=null) this.cuas_slow_score=Double.parseDouble(properties.getProperty(prefix+"cuas_slow_score"));
if (properties.getProperty(prefix+"cuas_score_mv")!=null) this.cuas_score_mv=Double.parseDouble(properties.getProperty(prefix+"cuas_score_mv"));
if (properties.getProperty(prefix+"cuas_score_lma")!=null) this.cuas_score_lma=Double.parseDouble(properties.getProperty(prefix+"cuas_score_lma"));
if (properties.getProperty(prefix+"cuas_factor_lim")!=null) this.cuas_factor_lim=Double.parseDouble(properties.getProperty(prefix+"cuas_factor_lim"));
......@@ -5557,9 +5587,9 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_multi_targ")!=null) this.cuas_multi_targ=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_multi_targ"));
if (properties.getProperty(prefix+"cuas_isolated")!=null) this.cuas_isolated=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_isolated"));
// if (properties.getProperty(prefix+"cuas_remove_2seq")!=null) this.cuas_remove_2seq=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_remove_2seq"));
// if (properties.getProperty(prefix+"cuas_remove_2seq_all")!=null) this.cuas_remove_2seq_all=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_remove_2seq_all"));
if (properties.getProperty(prefix+"cuas_min_seq")!=null) this.cuas_min_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_min_seq"));
if (properties.getProperty(prefix+"cuas_enough_seq")!=null) this.cuas_enough_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_enough_seq"));
if (properties.getProperty(prefix+"cuas_min_seq_fl")!=null) this.cuas_min_seq_fl=Integer.parseInt(properties.getProperty(prefix+"cuas_min_seq_fl"));
if (properties.getProperty(prefix+"cuas_max_mismatch")!=null) this.cuas_max_mismatch=Double.parseDouble(properties.getProperty(prefix+"cuas_max_mismatch"));
if (properties.getProperty(prefix+"cuas_good_mismatch")!=null) this.cuas_good_mismatch=Double.parseDouble(properties.getProperty(prefix+"cuas_good_mismatch"));
......@@ -5588,6 +5618,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_intermed_low")!=null) this.cuas_intermed_low=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_intermed_low"));
if (properties.getProperty(prefix+"cuas_intermed_high")!=null) this.cuas_intermed_high=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_intermed_high"));
if (properties.getProperty(prefix+"cuas_intermed_giga")!=null) this.cuas_intermed_giga=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_intermed_giga"));
if (properties.getProperty(prefix+"cuas_debug_more")!=null) this.cuas_debug_more=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug_more"));
if (properties.getProperty(prefix+"cuas_save_mono")!=null) this.cuas_save_mono=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_mono"));
if (properties.getProperty(prefix+"cuas_save_color")!=null) this.cuas_save_color=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_color"));
if (properties.getProperty(prefix+"cuas_save_video")!=null) this.cuas_save_video=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_video"));
......@@ -6534,6 +6566,9 @@ min_str_neib_fpn 0.35
imp.cuas_lma_maxk = this.cuas_lma_maxk;
imp.cuas_lma_a2a = this.cuas_lma_a2a;
imp.cuas_slow_ra = this.cuas_slow_ra;
imp.cuas_slow_score = this.cuas_slow_score;
imp.cuas_score_mv = this.cuas_score_mv;
imp.cuas_score_lma = this.cuas_score_lma;
imp.cuas_factor_lim = this.cuas_factor_lim;
......@@ -6543,9 +6578,9 @@ min_str_neib_fpn 0.35
imp.cuas_multi_targ = this.cuas_multi_targ;
imp.cuas_isolated = this.cuas_isolated;
// imp.cuas_remove_2seq = this.cuas_remove_2seq;
// imp.cuas_remove_2seq_all = this.cuas_remove_2seq_all;
imp.cuas_min_seq = this.cuas_min_seq;
imp.cuas_min_seq = this.cuas_min_seq;
imp.cuas_enough_seq = this.cuas_enough_seq;
imp.cuas_min_seq_fl = this.cuas_min_seq_fl;
imp.cuas_max_mismatch = this.cuas_max_mismatch;
......@@ -6574,6 +6609,7 @@ min_str_neib_fpn 0.35
imp.cuas_intermed_low = this.cuas_intermed_low;
imp.cuas_intermed_high = this.cuas_intermed_high;
imp.cuas_intermed_giga = this.cuas_intermed_giga;
imp.cuas_debug_more = this.cuas_debug_more;
imp.cuas_save_mono = this.cuas_save_mono;
imp.cuas_save_color = this.cuas_save_color;
imp.cuas_save_video = this.cuas_save_video;
......
......@@ -7282,8 +7282,8 @@ public class OpticalFlow {
String [] bkp_sourcePaths = quadCLT_main.correctionsParameters.sourcePaths;
boolean bkp_use_set_dirs = quadCLT_main.correctionsParameters.use_set_dirs;
String bkp_cuasUasLogs = quadCLT_main.correctionsParameters.cuasSkyMask; // TIFF image 640x512 where 1.0 - sky, 0.0 - ground, blurred with GB (now sigma==2.0)
String bkp_cuasSkyMask = quadCLT_main.correctionsParameters.cuasUasLogs; // json file path containing UAS logs
String bkp_cuasUasLogs = quadCLT_main.correctionsParameters.cuasUasLogs; // TIFF image 640x512 where 1.0 - sky, 0.0 - ground, blurred with GB (now sigma==2.0)
String bkp_cuasSkyMask = quadCLT_main.correctionsParameters.cuasSkyMask; // json file path containing UAS logs
double bkp_cuasUasTimeStamp = quadCLT_main.correctionsParameters.cuasUasTimeStamp; // 0.0; // timestamp corresponding to the UAS time 0.0
double [] bkp_cuasCameraATR = quadCLT_main.correctionsParameters.cuasCameraATR; //{0, 0, 0};
double [] bkp_cuasUASHome = quadCLT_main.correctionsParameters.cuasUASHome; //{0, 0, 0};
......
......@@ -8635,8 +8635,8 @@ if (debugLevel > -100) return true; // temporarily !
if (quadCLT_main.correctionsParameters.useCuasSeedDir) {
cuas_centers = new String [] {quadCLT_main.correctionsParameters.cuasSeedDir,""};
}
if (debugLevel > -4) {
System.out.println("cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
if (debugLevel > -4){
System.out.println("2. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
}
/*
if ((quadCLT_main.correctionsParameters.cuasSeed != null) && (quadCLT_main.correctionsParameters.cuasSeed.length()>0)) {
......@@ -8685,12 +8685,15 @@ if (debugLevel > -100) return true; // temporarily !
// Process UAS logs
UasLogReader uasLogReader = null;
String uas_log_path = quadCLT_main.correctionsParameters.getUasLogsPath();
System.out.println("Using UAS log file: "+uas_log_path);
if ((uas_log_path != null) && (uas_log_path.length() > 0)) {
uasLogReader = new UasLogReader(uas_log_path, quadCLT_main.correctionsParameters.cuasUasTimeStamp, null, quadCLT_main);
uasLogReader.setCameraATR(quadCLT_main.correctionsParameters.cuasCameraATR);
uasLogReader.setUASHomeNed(quadCLT_main.correctionsParameters.cuasSetHome? quadCLT_main.correctionsParameters.cuasUASHome : null);
}
if (debugLevel > -4) {
System.out.println("cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
}
while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) {
String model_directory = opticalFlow.buildSeries(
......@@ -8715,6 +8718,10 @@ if (debugLevel > -100) return true; // temporarily !
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel+2); // final int debugLevel)
if (debugLevel > -4){
System.out.println("3. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
}
if (model_directory == null) {
// TODO: Save continuation after failure not to retry each run
System.out.println("Failed to build sequence for series "+ref_index);
......@@ -8784,6 +8791,10 @@ if (debugLevel > -100) return true; // temporarily !
link.delete();
}
Files.createSymbolicLink(link.toPath(), pathRelative);
if (debugLevel > -4){
System.out.println("createSymbolicLink "+pathRelative+" -> "+link.toPath());
}
}
// cuas_centers[0] = cuas_centers[1];
// cuas_centers[1] = "";
......@@ -8797,7 +8808,14 @@ if (debugLevel > -100) return true; // temporarily !
} // while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) {
if ((cuas_centers != null) && (cuas_centers[1] != null) && (cuas_centers[1].length()>0)) {
cuas_centers[0] = cuas_centers[1];
cuas_centers[1] = "";
cuas_centers[1] = "";
if (debugLevel > -4){
System.out.println("4. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
}
}
if (debugLevel > -4){
System.out.println("5. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
}
} // for (int nseq = 0; nseq < num_seq; nseq++) {
......
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