Commit 8b0de09b authored by Andrey Filippov's avatar Andrey Filippov

Connected targets to other processing

parent 6671a6fd
......@@ -755,6 +755,8 @@ min_str_neib_fpn 0.35
public boolean cuas_ra_background = true; // apply running average to the background of the moving targets (false - use high-noise no-averaged images
// which files to save in the model directory:
public boolean cuas_targets = true; // enable targets generation together with the source UM images
public int cuas_iter_show = 1; // Maximal enhancement iteration to show intermediate result (0 - none)
public boolean cuas_2d_save_show = true; // save/show 2D correlation
public boolean cuas_intermed_low = true; // save intermediate vector fields and target coordinates from the LMA (80x64 layers)
......@@ -762,6 +764,9 @@ min_str_neib_fpn 0.35
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)
public boolean cuas_debug = false; // save debug images (and show them if not in batch mode)
public boolean cuas_step_debug = false; // save debug images during per-step cuas recalculation (and show them if not in batch mode)
......@@ -2280,6 +2285,9 @@ min_str_neib_fpn 0.35
"Apply running average to the background of the moving targets (false - use high-noise no-averaged images.");
gd.addMessage("=== Saving intermediate and final images and video ===");
gd.addCheckbox ("Generate and save targets images/video", this.cuas_targets,
"Genearte after differential images are output");
gd.addNumericField("Maximal iteration to save/show", this.cuas_iter_show, 0,3,"",
"Maximal enhancement iteration to save/ show intermediate result (0 - none).");
gd.addCheckbox ("Save/show 2D correlations", this.cuas_2d_save_show,
......@@ -3294,6 +3302,7 @@ min_str_neib_fpn 0.35
this.cuas_scale2x = gd.getNextBoolean();
this.cuas_ra_background = gd.getNextBoolean();
this.cuas_targets = gd.getNextBoolean();
this.cuas_iter_show= (int) gd.getNextNumber();
this.cuas_2d_save_show = gd.getNextBoolean();
this.cuas_intermed_low = gd.getNextBoolean();
......@@ -4227,7 +4236,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_scale2x", this.cuas_scale2x+""); // boolean
properties.setProperty(prefix+"cuas_ra_background", this.cuas_ra_background+""); // boolean
properties.setProperty(prefix+"cuas_iter_show", this.cuas_iter_show+""); // int
properties.setProperty(prefix+"cuas_targets", this.cuas_targets+""); // boolean
properties.setProperty(prefix+"cuas_iter_show", this.cuas_iter_show+""); // int
properties.setProperty(prefix+"cuas_2d_save_show", this.cuas_2d_save_show+""); // boolean
properties.setProperty(prefix+"cuas_intermed_low", this.cuas_intermed_low+""); // boolean
properties.setProperty(prefix+"cuas_intermed_high", this.cuas_intermed_high+""); // boolean
......@@ -5133,6 +5143,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_scale2x")!=null) this.cuas_scale2x=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_scale2x"));
if (properties.getProperty(prefix+"cuas_ra_background")!=null) this.cuas_ra_background=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_ra_background"));
if (properties.getProperty(prefix+"cuas_targets")!=null) this.cuas_targets=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_targets"));
if (properties.getProperty(prefix+"cuas_iter_show")!=null) this.cuas_iter_show=Integer.parseInt(properties.getProperty(prefix+"cuas_iter_show"));
if (properties.getProperty(prefix+"cuas_2d_save_show")!=null) this.cuas_2d_save_show=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_2d_save_show"));
if (properties.getProperty(prefix+"cuas_intermed_low")!=null) this.cuas_intermed_low=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_intermed_low"));
......@@ -6038,6 +6049,7 @@ min_str_neib_fpn 0.35
imp.cuas_scale2x = this.cuas_scale2x;
imp.cuas_ra_background = this.cuas_ra_background;
imp.cuas_targets = this.cuas_targets;
imp.cuas_iter_show= this.cuas_iter_show;
imp.cuas_2d_save_show = this.cuas_2d_save_show;
imp.cuas_intermed_low = this.cuas_intermed_low;
......
......@@ -6439,6 +6439,28 @@ public class OpticalFlow {
master_CLT.saveImagePlusInModelDirectory(
null, // "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_scenes_pair[nstereo]); // imp_scenes); // ImagePlus imp)
if (master_CLT.hasCenterClt()) { // cuas mode
boolean insert_average = (master_CLT.getCenterAverage() != null) || clt_parameters.imp.calculate_average;
boolean subtract_average = clt_parameters.imp.subtract_average && insert_average;
if (subtract_average && clt_parameters.imp.cuas_targets && (mode3d > 0)) {
System.out.println("Will generate targets images/videos, mode3d="+mode3d);
ImagePlus imp_targets = imp_scenes_pair[nstereo];
int first_corr = insert_average? 1:0; // skip average
int num_scenes = imp_targets.getStack().getSize()- first_corr; // includes average
float [][] fpixels = new float[num_scenes][];
String [] scene_titles = new String [num_scenes];
for (int nscene = 0; nscene < fpixels.length; nscene++) {
fpixels[nscene] = (float[]) imp_targets.getStack().getPixels(nscene+first_corr+1);
scene_titles[nscene] = imp_targets.getStack().getSliceLabel(nscene+first_corr+1);
}
master_CLT.processMovingTargets(
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
fpixels, // final float [][] fpixels,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel); // final int debugLevel)
}
}
}
}
} else {
......
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