Commit 81ca6c68 authored by Andrey Filippov's avatar Andrey Filippov

implementing averaging of multiple sequencing

parent 8e595c63
......@@ -54,8 +54,15 @@ import ij.gui.GenericDialog;
public class EyesisCorrectionParameters {
public static class CorrectionParameters{
public static final String [] KEY_DIRS= {"rootDirectory",
"sourceDirectory","linkedModels","videoDirectory","x3dDirectory","resultsDirectory"};
public static final String [] KEY_DIRS= {
"rootDirectory", // 0
"sourceDirectory", // 1
"linkedModels", // 2
"linkedCenters", // 3
"videoDirectory", // 4
"x3dDirectory", // 5
"resultsDirectory", // 6
"cuasSeed"}; // 7
public static final String AUX_PREFIX = "AUX-";
public boolean swapSubchannels01= true; // false; // (false: 0-1-2, true - 1-0-2)
public boolean split= true;
......@@ -213,9 +220,10 @@ public class EyesisCorrectionParameters {
public String linkedModels=""; // linked models with reference scenes
public String linkedCenters=""; // linked models with centers scene in CUAS mode
public String x3dDirectory="";
public String videoDirectory=""; // combined (with MPEG) from multiple scene sequences video files
public String cuasSeed ="";
public String mlDirectory="ml";
......@@ -332,6 +340,8 @@ public class EyesisCorrectionParameters {
cp.relativeExposure= this.relativeExposure;
cp.swapSubchannels01= this.swapSubchannels01;
cp.linkedModels= this.linkedModels;
cp.linkedCenters= this.linkedCenters;
cp.cuasSeed= this.cuasSeed;
cp.videoDirectory= this.videoDirectory;
cp.x3dDirectory= this.x3dDirectory;
cp.mlDirectory= this.mlDirectory;
......@@ -547,6 +557,8 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"cltSuffix", this.cltSuffix);
properties.setProperty(prefix+"linkedModels", this.linkedModels);
properties.setProperty(prefix+"linkedCenters", this.linkedCenters);
properties.setProperty(prefix+"cuasSeed", this.cuasSeed);
properties.setProperty(prefix+"videoDirectory", this.videoDirectory);
properties.setProperty(prefix+"x3dDirectory", this.x3dDirectory);
properties.setProperty(prefix+"use_x3d_subdirs", this.use_x3d_subdirs+"");
......@@ -743,6 +755,8 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"cltSuffix")!= null) this.cltSuffix=properties.getProperty(prefix+"cltSuffix");
if (properties.getProperty(prefix+"linkedModels")!= null) this.linkedModels=properties.getProperty(prefix+"linkedModels");
if (properties.getProperty(prefix+"linkedCenters")!= null) this.linkedCenters=properties.getProperty(prefix+"linkedCenters");
if (properties.getProperty(prefix+"cuasSeed")!= null) this.cuasSeed=properties.getProperty(prefix+"cuasSeed");
if (properties.getProperty(prefix+"videoDirectory")!= null) this.videoDirectory=properties.getProperty(prefix+"videoDirectory");
if (properties.getProperty(prefix+"x3dDirectory")!= null) this.x3dDirectory=properties.getProperty(prefix+"x3dDirectory");
......@@ -928,6 +942,10 @@ public class EyesisCorrectionParameters {
"Directory where links to reference models directories will be created.");
gd.addCheckbox ("Select linked reference models directory", false);
gd.addStringField ("Linked centers", this.linkedCenters, 80,
"Directory where links to model centers directories will be created.");
gd.addCheckbox ("Select linked models centers directory", false);
gd.addStringField ("Video directory", this.videoDirectory, 80,
"Directory to store combined video files.");
gd.addCheckbox ("Select video directory", false);
......@@ -1064,6 +1082,7 @@ public class EyesisCorrectionParameters {
this.x3dModelVersion= gd.getNextString(); // 10a
this.jp4SubDir= gd.getNextString(); // 10b
this.linkedModels= gd.getNextString(); if (gd.getNextBoolean()) selectLinkedModelsDirectory(false, true);
this.linkedCenters= gd.getNextString(); if (gd.getNextBoolean()) selectLinkedCentersDirectory(false, true);
this.videoDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectVideoDirectory(false, true);
this.x3dDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectX3dDirectory(false, true);
this.use_x3d_subdirs= gd.getNextBoolean();
......@@ -1150,6 +1169,10 @@ public class EyesisCorrectionParameters {
"Directory where links to reference models directories will be created.");
gd.addCheckbox ("Select linked reference models directory", false);
gd.addStringField ("Linked centers", this.linkedCenters, 80,
"Directory where links to model centers directories will be created.");
gd.addCheckbox ("Select linked models centers directory", false);
gd.addStringField ("Video directory", this.videoDirectory, 80,
"Directory to store combined video files.");
gd.addCheckbox ("Select video directory", false);
......@@ -1327,6 +1350,7 @@ public class EyesisCorrectionParameters {
this.x3dModelVersion= gd.getNextString(); // 10a
this.jp4SubDir= gd.getNextString(); // 10b
this.linkedModels= gd.getNextString(); if (gd.getNextBoolean()) selectLinkedModelsDirectory(false, true);
this.linkedCenters= gd.getNextString(); if (gd.getNextBoolean()) selectLinkedCentersDirectory(false, true);
this.videoDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectVideoDirectory(false, true);
this.x3dDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectX3dDirectory(false, true); // 9
this.use_x3d_subdirs= gd.getNextBoolean(); // 10
......@@ -1651,34 +1675,47 @@ public class EyesisCorrectionParameters {
if (!source_dir.exists()) {
source_dir.mkdirs();
}
if (dir_map.containsKey("cuasSeed")) {
this.cuasSeed=(base_path.resolve(Paths.get(dir_map.get("cuasSeed")))).toString();
}
// Set other directories (possibly relative to base_path)
for (int i = 2; i < KEY_DIRS.length; i++) { // skip "rootDirectory" and "sourceDirectory"
if (dir_map.containsKey(KEY_DIRS[i])) {
Path dir_path=base_path.resolve(Paths.get(dir_map.get(KEY_DIRS[i])));
File dir_file = new File(dir_path.toString());
if (!dir_file.exists()) {
dir_file.mkdirs();
}
switch (i) {
case 2:
this.linkedModels = dir_path.toString();
System.out.println("this.linkedModels="+this.linkedModels);
break;
case 3:
this.videoDirectory = dir_path.toString();
System.out.println("this.videoDirectory="+this.videoDirectory);
break;
case 4:
this.x3dDirectory = dir_path.toString();
System.out.println("this.x3dDirectory="+this.x3dDirectory);
break;
case 5:
this.resultsDirectory = dir_path.toString();
System.out.println("this.resultsDirectory="+this.resultsDirectory);
break;
}
}
}
for (int i = 2; i < KEY_DIRS.length; i++) { // skip "rootDirectory" and "sourceDirectory"
if (dir_map.containsKey(KEY_DIRS[i])) {
Path dir_path=base_path.resolve(Paths.get(dir_map.get(KEY_DIRS[i])));
File dir_file = new File(dir_path.toString());
if (!dir_file.exists()) {
dir_file.mkdirs();
}
switch (i) {
case 2:
this.linkedModels = dir_path.toString();
System.out.println("this.linkedModels="+this.linkedModels);
break;
case 3:
this.linkedCenters = dir_path.toString();
System.out.println("this.linkedCenters="+this.linkedCenters);
break;
case 4:
this.videoDirectory = dir_path.toString();
System.out.println("this.videoDirectory="+this.videoDirectory);
break;
case 5:
this.x3dDirectory = dir_path.toString();
System.out.println("this.x3dDirectory="+this.x3dDirectory);
break;
case 6:
this.resultsDirectory = dir_path.toString();
System.out.println("this.resultsDirectory="+this.resultsDirectory);
break;
case 7:
this.resultsDirectory = dir_path.toString();
System.out.println("this.cuasSeed="+this.cuasSeed);
break;
}
}
}
// process source sequence directories
ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>();
for (String line:lines){
......@@ -2409,6 +2446,17 @@ public class EyesisCorrectionParameters {
if (dir!=null) this.linkedModels=dir;
return dir;
}
public String selectLinkedCentersDirectory(boolean smart, boolean newAllowed) {
String dir= CalibrationFileManagement.selectDirectory(
smart,
newAllowed, // save
"linked centers directory", // title
"Select linked centers directory", // button
null, // filter
this.linkedCenters); //this.sourceDirectory);
if (dir!=null) this.linkedCenters=dir;
return dir;
}
public String selectVideoDirectory(boolean smart, boolean newAllowed) {
String dir= CalibrationFileManagement.selectDirectory(
......
This diff is collapsed.
package com.elphel.imagej.cuas;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import com.elphel.imagej.gpu.GPUTileProcessor;
public class CuasTile implements Comparable<CuasTile>, Serializable {
private static final long serialVersionUID = 1L;
public final static int TILE_SIZE = GPUTileProcessor.DTT_SIZE; // 8
public final static int TILE_LENGTH = TILE_SIZE * TILE_SIZE; // 64
public final static int CLT_TILE_LENGTH = 4 * TILE_LENGTH; // 256
public float [] clt_data; // = new float [CLT_TILE_LENGTH];
public double dts = 0; // time stamp as double
public double weight = 0;
/*
public int parent_index = -1;
public void setParentIndex(int indx) {
parent_index = indx;
}
public int getParentIndex() {
return parent_index;
}
*/
public CuasTile (
int num_colors,
double dts,
double weight,
float [] clt_data) {
// clt_data = new float [num_colors * CLT_TILE_LENGTH];
this.dts = dts;
this.weight = weight;
this.clt_data = clt_data;
}
public CuasTile (
int num_colors,
double dts,
double weight,
float [] clt_full,
int ntile) {
int tile_length = num_colors * CLT_TILE_LENGTH;
clt_data = new float [tile_length];
this.dts = dts;
this.weight = weight;
System.arraycopy(
clt_full,
ntile * tile_length,
clt_data,
0,
tile_length);
}
public void getData (
float [] fclt,
int ntile) {
if (isEmpty()) return; // do nothing
System.arraycopy(
clt_data,
0,
fclt,
ntile * clt_data.length,
clt_data.length);
}
public double getWeight() {
return weight;
}
public double getTimeStamp() {
return dts;
}
public boolean isEmpty() {
return (clt_data == null) || (weight <= 0);
}
public float [] getData() {
return clt_data;
}
public double getWeight(
double decay,
double ts_now) {
if (isEmpty()) {
return 0;
}
if (decay > 0) {
return weight * Math.exp(-Math.max(ts_now-this.dts, 0)/decay);
}
return weight;
}
public CuasTile cloneEmpty() {
int num_colors = clt_data.length/CLT_TILE_LENGTH;
return new CuasTile(num_colors, dts, 0, null);
}
public double merge (CuasTile tile, double decay) {
if ((tile.clt_data == null) || (tile.weight == 0)) {
// do nothing
} else if ((clt_data == null) || (weight == 0)) {
clt_data = tile.clt_data;
weight = tile.weight;
dts = tile.dts;
} else {
double w = weight, wt = tile.weight;
if (decay > 0) {
if (dts < tile.dts) {
w = getWeight(
decay, // double decay,
tile.dts); // double ts_now)
} else if (dts > tile.dts) {
wt = tile.getWeight(
decay, // double decay,
dts); // double ts_now)
}
}
double sumw = w + wt;
w /= sumw;
wt /= sumw;
for (int i = 0; i < clt_data.length; i++) {
clt_data[i] = (float)(clt_data[i] * w + tile.clt_data[i] * wt);
}
dts = Math.max(dts, tile.dts);
weight = sumw;
}
return weight;
}
@Override
public CuasTile clone() {
int num_colors = clt_data.length/CLT_TILE_LENGTH;
return new CuasTile(num_colors, dts, weight, clt_data.clone());
}
@Override
public int compareTo(CuasTile otherTile) {
return Double.compare(dts, otherTile.dts);
}
public double diffTile2 (float [] clt_data_other) {
double d2 = 0;
for (int i = 0; i < clt_data.length; i++) {
double dd = clt_data_other[i] - clt_data[i];
d2 += dd * dd;
}
return d2/clt_data.length;
}
public double diffTile2 (CuasTile tile_other) {
return diffTile2(tile_other.clt_data);
}
@SuppressWarnings("static-method")
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
ois.defaultReadObject();
}
@SuppressWarnings("static-method")
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
}
}
......@@ -81,8 +81,8 @@ public class OrthoMapsCollection implements Serializable{
*/
public static final String [] KEY_DIRS= {"rootDirectory", // from EyesisCorrectionParameters
"sourceDirectory","linkedModels","videoDirectory","x3dDirectory","resultsDirectory","scenesDirectory",
"kernelsDirectory", "patternsDirectory"};
"sourceDirectory","linkedModels","linkedCenters","videoDirectory","x3dDirectory","resultsDirectory","scenesDirectory",
"kernelsDirectory", "patternsDirectory","cuasSeed"};
public static final String [] NAME_FH = {"full","half"};
public static final String [] NAME_MO = {"main","other"};
......
......@@ -158,7 +158,7 @@ public class Interscene {
QuadCLT quadCLT_main, // tiles should be set
final QuadCLT[] quadCLTs, //
final int ref_index,
final QuadCLT.SetChannels [] set_channels,
final SetChannels [] set_channels,
final boolean batch_mode,
int earliest_scene,
int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index
......@@ -170,7 +170,7 @@ public class Interscene {
// when going first - do not go beyond center (center by IMS coordinates) or just index?
// Index is easier, no need to change
// QuadCLT[] quadCLTs_half = new QuadCLT[(quadCLTs.length+1)/2];
// QuadCLT.SetChannels [] set_channels_half;
// SetChannels [] set_channels_half;
// consider if it is using initial DSI from previous in overlap mode
boolean overlap_sequences = clt_parameters.imp.overlap_sequences;
int [] start_ref_pointers1 = new int[2];
......@@ -248,7 +248,7 @@ public class Interscene {
colorProcParameters, // final ColorProcParameters colorProcParameters,
quadCLTs, // final QuadCLT[] quadCLTs, //
ref_index, // final int ref_index,
set_channels, // final QuadCLT.SetChannels [] set_channels,
set_channels, // final SetChannels [] set_channels,
batch_mode, // final boolean batch_mode,
cent_index, // int earliest_scene,
start_ref_pointers1, // int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index
......@@ -324,7 +324,7 @@ public class Interscene {
colorProcParameters, // final ColorProcParameters colorProcParameters,
quadCLTs, // final QuadCLT[] quadCLTs, //
cent_index, // final int ref_index,
set_channels, // final QuadCLT.SetChannels [] set_channels,
set_channels, // final SetChannels [] set_channels,
batch_mode, // final boolean batch_mode,
earliest_scene, // int earliest_scene,
start_ref_pointers2, // int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index
......@@ -845,7 +845,7 @@ public class Interscene {
final ColorProcParameters colorProcParameters,
final QuadCLT[] quadCLTs, //
final int ref_index,
final QuadCLT.SetChannels [] set_channels,
final SetChannels [] set_channels,
final boolean batch_mode,
int earliest_scene,
int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index
......@@ -1444,7 +1444,7 @@ public class Interscene {
int min_num_scenes,
final ColorProcParameters colorProcParameters,
final QuadCLT[] quadCLTs, //
final QuadCLT.SetChannels [] set_channels,
final SetChannels [] set_channels,
final boolean batch_mode,
int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index. Set if non-null
final boolean updateStatus,
......@@ -2047,7 +2047,7 @@ public class Interscene {
final ColorProcParameters colorProcParameters,
final QuadCLT[] quadCLTs, //
final int ref_index,
final QuadCLT.SetChannels [] set_channels,
final SetChannels [] set_channels,
final boolean batch_mode,
int earliest_scene,
int [] start_ref_pointers, // [0] - earliest valid scene, [1] ref_index
......
......@@ -658,8 +658,15 @@ min_str_neib_fpn 0.35
public int cuas_discard_border = 8; // Discard this number of pixels from each side when merging
public double cuas_max_fold = 50;
public int cuas_min_in_row_col = 4; // Minimal number of defined tiles in a row/column
public double cuas_clt_threshold = 20; // threshold for CLT tile difference from a template
public double cuas_clt_variant = 10; // threshold from the nearest to create a variant for the tile
public double cuas_clt_threshold = 20; // threshold for CLT tile difference not merged when selecting the best
public double cuas_clt_decrease = 0.01; // Scale CLT outliers weight
public double cuas_decay_average = 100.0; // Decay in seconds for cimulative CLT
public double cuas_keep_fraction = 0.9; // Filter CLT variants for tiles keeping at least this fraction of the total weight
public boolean cuas_step = true; // recalculate template image after each fitting step
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)
// TODO: move next parameters elsewhere - they are not the motion blur ones.
public int mb_gain_index_pose = 5; // pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter
......@@ -1975,10 +1982,24 @@ min_str_neib_fpn 0.35
"Maximal non-monotonic Px, Py in PxPyD (usually near image edges).");
gd.addNumericField("Minimal tiles in a row/column", this.cuas_min_in_row_col, 0,3,"tiles",
"Discards rows then columns that have less defined tiles (noticed in a diagonal after folds removal).");
gd.addNumericField("CLT tile diff thershold", this.cuas_clt_threshold, 5,7,"pix",
"Threshold to the CLT tile difference to a template (RMS).");
gd.addNumericField("CLT outliers scale", this.cuas_clt_decrease, 5,7,"pix",
gd.addNumericField("CLT tile variant thershold", this.cuas_clt_variant, 5,7,"",
"Threshold from the nearest in teplate to create a variant for the tile (RMS).");
gd.addNumericField("CLT tile diff merge", this.cuas_clt_threshold, 5,7,"",
"Threshold to the CLT tile difference to a template (RMS) when selectin a single best.");
gd.addNumericField("CLT outliers scale", this.cuas_clt_decrease, 5,7,"x",
"Scale CLT outliers tiles weight when averaging.");
gd.addNumericField("Decay of average", this.cuas_decay_average, 5,7,"s",
"Reduce weight of old scenes while averaging (in e times) after this time.");
gd.addNumericField("Keep weight fraction", this.cuas_keep_fraction, 5,7,"x",
"Filter tile CLT variants that keep fraction of the total weight.");
gd.addCheckbox ("Recalculate after each tuning step", this.cuas_step,
"Recalciulate correlation pattern after each position/orientation and disparity adjustment step.");
gd.addCheckbox ("Save/show debug images", this.cuas_debug,
"Save CUAS-related debug images and show them in non-batch mode.");
gd.addMessage("=== Debug ===");
gd.addCheckbox ("Save/show debug images for each tuning step",this.cuas_step_debug,
"Save CUAS-related debug images during per-step cuas recalculation and show them in non-batch mode.");
gd.addTab("LMA sequence","Interscene LMA sequence control");
gd.addMessage("Parameters for control of the LMA pose adjustment sequence");
......@@ -2866,8 +2887,14 @@ min_str_neib_fpn 0.35
this.cuas_discard_border= (int) gd.getNextNumber();
this.cuas_max_fold = gd.getNextNumber();
this.cuas_min_in_row_col= (int) gd.getNextNumber();
this.cuas_clt_variant = gd.getNextNumber();
this.cuas_clt_threshold = gd.getNextNumber();
this.cuas_clt_decrease = gd.getNextNumber();
this.cuas_decay_average = gd.getNextNumber();
this.cuas_keep_fraction = gd.getNextNumber();
this.cuas_step = gd.getNextBoolean();
this.cuas_debug = gd.getNextBoolean();
this.cuas_step_debug = gd.getNextBoolean();
this.mb_gain_index_pose = (int) gd.getNextNumber();
this.mb_gain_index_depth =(int) gd.getNextNumber();
......@@ -3686,8 +3713,14 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_discard_border", this.cuas_discard_border+""); // int
properties.setProperty(prefix+"cuas_max_fold", this.cuas_max_fold+""); // double
properties.setProperty(prefix+"cuas_min_in_row_col", this.cuas_min_in_row_col+""); // int
properties.setProperty(prefix+"cuas_clt_variant", this.cuas_clt_variant+""); // double
properties.setProperty(prefix+"cuas_clt_threshold", this.cuas_clt_threshold+""); // double
properties.setProperty(prefix+"cuas_clt_decrease", this.cuas_clt_decrease+""); // double
properties.setProperty(prefix+"cuas_decay_average", this.cuas_decay_average+""); // double
properties.setProperty(prefix+"cuas_keep_fraction", this.cuas_keep_fraction+""); // double
properties.setProperty(prefix+"cuas_step", this.cuas_step+""); // boolean
properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean
properties.setProperty(prefix+"cuas_step_debug", this.cuas_step_debug+""); // boolean
properties.setProperty(prefix+"mb_gain_index_pose", this.mb_gain_index_pose+""); // int
properties.setProperty(prefix+"mb_gain_index_depth", this.mb_gain_index_depth+""); // int
......@@ -4481,12 +4514,16 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_discard_border")!=null) this.cuas_discard_border=Integer.parseInt(properties.getProperty(prefix+"cuas_discard_border"));
if (properties.getProperty(prefix+"cuas_max_fold")!=null) this.cuas_max_fold=Double.parseDouble(properties.getProperty(prefix+"cuas_max_fold"));
if (properties.getProperty(prefix+"cuas_min_in_row_col")!=null) this.cuas_min_in_row_col=Integer.parseInt(properties.getProperty(prefix+"cuas_min_in_row_col"));
if (properties.getProperty(prefix+"cuas_clt_variant")!=null) this.cuas_clt_variant=Double.parseDouble(properties.getProperty(prefix+"cuas_clt_variant"));
if (properties.getProperty(prefix+"cuas_clt_threshold")!=null) this.cuas_clt_threshold=Double.parseDouble(properties.getProperty(prefix+"cuas_clt_threshold"));
if (properties.getProperty(prefix+"cuas_clt_decrease")!=null) this.cuas_clt_decrease=Double.parseDouble(properties.getProperty(prefix+"cuas_clt_decrease"));
if (properties.getProperty(prefix+"mb_gain_index_pose")!=null) this.mb_gain_index_pose=Integer.parseInt(properties.getProperty(prefix+"mb_gain_index_pose"));
if (properties.getProperty(prefix+"mb_gain_index_depth")!=null) this.mb_gain_index_depth=Integer.parseInt(properties.getProperty(prefix+"mb_gain_index_depth"));
if (properties.getProperty(prefix+"cuas_decay_average")!=null) this.cuas_decay_average=Double.parseDouble(properties.getProperty(prefix+"cuas_decay_average"));
if (properties.getProperty(prefix+"cuas_keep_fraction")!=null) this.cuas_keep_fraction=Double.parseDouble(properties.getProperty(prefix+"cuas_keep_fraction"));
if (properties.getProperty(prefix+"cuas_step")!=null) this.cuas_step=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_step"));
if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug"));
if (properties.getProperty(prefix+"cuas_step_debug")!=null) this.cuas_step_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_step_debug"));
if (properties.getProperty(prefix+"mb_gain_index_pose")!=null) this.mb_gain_index_pose=Integer.parseInt(properties.getProperty(prefix+"mb_gain_index_pose"));
if (properties.getProperty(prefix+"mb_ers_index")!=null) this.mb_ers_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_index"));
if (properties.getProperty(prefix+"mb_ers_y_index")!=null) this.mb_ers_y_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_y_index"));
if (properties.getProperty(prefix+"mb_ers_r_index")!=null) this.mb_ers_r_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_r_index"));
......@@ -5278,8 +5315,14 @@ min_str_neib_fpn 0.35
imp.cuas_discard_border = this.cuas_discard_border;
imp.cuas_max_fold = this.cuas_max_fold;
imp.cuas_min_in_row_col = this.cuas_min_in_row_col;
imp.cuas_clt_variant = this.cuas_clt_variant;
imp.cuas_clt_threshold = this.cuas_clt_threshold;
imp.cuas_clt_decrease = this.cuas_clt_decrease;
imp.cuas_decay_average = this.cuas_decay_average;
imp.cuas_keep_fraction = this.cuas_keep_fraction;
imp.cuas_step = this.cuas_step;
imp.cuas_debug = this.cuas_debug;
imp.cuas_step_debug = this.cuas_step_debug;
imp.mb_gain_index_pose = this.mb_gain_index_pose;
imp.mb_gain_index_depth = this.mb_gain_index_depth;
......
......@@ -52,7 +52,7 @@ import com.elphel.imagej.correction.EyesisCorrections;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.TpTask;
//import com.elphel.imagej.tileprocessor.QuadCLTCPU.SetChannels;
//import com.elphel.imagej.tileprocessor.SetChannels;
import ij.IJ;
import ij.ImagePlus;
......@@ -124,16 +124,28 @@ public class QuadCLT extends QuadCLTCPU {
}
public ImagePlus showCenterClt(
CLTParameters clt_parameters) {
float [][] fclt, // may be null
CLTParameters clt_parameters,
boolean show) {
if (getCenterClt() == null) {
System.out.println("showCenterClt(): not a center CLT");
return null;
}
int sensor_mask_clt = 1; // just one
setQuadClt();
int tilesX = getTilesX();
int tilesY = getTilesY();
int tile_size = getTileSize();
int [] wh = {tilesX*tile_size,tilesY*tile_size};
getGPUQuad().handleWH(
wh, // int [] wh,
false); // boolean ref_scene)
getGPUQuad().handleWH(
wh, // int [] wh,
true); // boolean ref_scene)
int [] whc = new int[3];
setComboToTD(
null, // new float [][] {center_CLT.getCenterClt()}, // ,combo_seq_clt, // final float [][] fclt,
fclt, // new float [][] {center_CLT.getCenterClt()}, // ,combo_seq_clt, // final float [][] fclt,
true, // merge_clt, // final boolean merge_channels, // duplicate same data to all selected channels
sensor_mask_clt, // final int sensor_mask, // only if merge_channels
whc, // final int [] whc, // if int[2], will return width, height
......@@ -149,10 +161,12 @@ public class QuadCLT extends QuadCLTCPU {
false, // toRGB, // boolean toRGB,
false, // use_reference, // boolean use_reference
suffix); // String suffix)
imp_virtual.show();
if (show) {
imp_virtual.show();
}
return imp_virtual;
}
@Deprecated
public ImagePlus showCenterCltWeights(
CLTParameters clt_parameters) {
if (getCenterCltWeights() == null) {
......@@ -2870,11 +2884,14 @@ public class QuadCLT extends QuadCLTCPU {
return gpuQuad.getCltTileLength();
}
@Deprecated
public boolean saveCenterClt() {
if (!hasCenterClt()) {
System.out.println("saveCenterCli(): center CLT data is not set");
return false;
}
int fclt_tile_length = getCltTileLength();
float [] fcenter_clt_data_weights = new float [center_clt.length + center_clt_weights.length]; // to include weights
System.arraycopy(center_clt, 0, fcenter_clt_data_weights, 0, center_clt.length);
......@@ -2885,21 +2902,6 @@ public class QuadCLT extends QuadCLTCPU {
new float [][] {fcenter_clt_data_weights}, // dbg_data, // float [][] data,
(fclt_tile_length+1), // getCenterCltWH()[0], // int width,
center_clt.length / fclt_tile_length); // getCenterCltWH()[1]); // int height)
/*
float [] fcenter_clt_num = new float [center_clt_num.length];
for (int i = 0; i <center_clt_num.length; i++) {
fcenter_clt_num[i] = center_clt_num[i];
}
String [] clt_titles= {"CLT","num-acc"};
float [][] fdata = {center_clt, fcenter_clt_num};
saveFloatArrayInModelDirectory( // error
CENTER_CLT_SUFFIX, // String suffix,
clt_titles, // String [] labels, // or null
fdata, // dbg_data, // float [][] data,
getCenterCltWH()[0], // int width,
getCenterCltWH()[1]); // int height)
*/
return true;
}
......@@ -3041,6 +3043,7 @@ public class QuadCLT extends QuadCLTCPU {
fclt = new float[][] {getCenterClt()};
merge_channels = true;
}
final int [] width_height = gpuQuad.getWH(use_reference);
final int num_colors = gpuQuad.getNumColors();
if (whc != null) {
......
package com.elphel.imagej.tileprocessor;
public class SetChannels{ // USED in lwir
public String set_name; // set name (timestamp)
int [] file_number; // array of file numbers for channels
public SetChannels(String name, int[] fn){ // USED in lwir
set_name = name;
file_number = fn;
}
public String name() { // USED in lwir
return set_name;
}
public int [] fileNumber() { // USED in lwir
return file_number;
}
public int fileNumber(int i) { // not used in lwir
return file_number[i];
}
}
......@@ -23,7 +23,6 @@ package com.elphel.imagej.tileprocessor;
**
*/
import java.awt.Rectangle;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
......
......@@ -38,6 +38,7 @@ import com.elphel.imagej.correction.CorrectionColorProc;
import com.elphel.imagej.tileprocessor.CLTPass3d;
import com.elphel.imagej.tileprocessor.OpticalFlow;
import com.elphel.imagej.tileprocessor.QuadCLT;
import com.elphel.imagej.tileprocessor.SetChannels;
import com.elphel.imagej.tileprocessor.TileProcessor;
import com.elphel.imagej.tileprocessor.TwoQuadCLT;
......@@ -274,13 +275,13 @@ public class LwirWorld {
// final boolean batch_mode = clt_parameters.batch_run;
// this.startTime=System.nanoTime();
String [] sourceFiles0=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
if ((set_channels_main == null) || (set_channels_main.length==0)) {
System.out.println("buildSeriesTQ(): No files to process (of "+sourceFiles0.length+")");
return null;
}
// set_channels will include all 99 scenes even as quadCLTs.length matches ref_index
QuadCLT.SetChannels [] set_channels=quadCLT_main.setChannels(debugLevel);
SetChannels [] set_channels=quadCLT_main.setChannels(debugLevel);
// Each of (usually 99) set_channels entries has set name (timestamp) and an array of corresponding (16) file indices
......
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