Commit 5bdb59ce authored by Andrey Filippov's avatar Andrey Filippov

Fixed old bug in 4 images (October, 6, 2020), propagating non-quad

configurations
parent 4e1e17b4
......@@ -63,8 +63,10 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.JFileChooser;
......@@ -775,6 +777,7 @@ private Panel panel1,
addButton("Reset Geometry", panelLWIR16, color_stop);
addButton("Reset AUX Geometry", panelLWIR16, color_stop);
addButton("Generate Sym Vectors", panelLWIR16, color_configure);
addButton("Image Properties", panelLWIR16, color_conf_process);
plugInFrame.add(panelLWIR16);
}
......@@ -4338,7 +4341,7 @@ private Panel panel1,
///========================================
QUAD_CLT.processCLTQuads(
QUAD_CLT.processCLTQuads( // uses quad
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
......@@ -5355,6 +5358,68 @@ private Panel panel1,
full_type1, // boolean full_type1, // false - all R or all T, true - mixed
full_type2, // boolean full_type2) {// false - quarter 3 is negated quarter 1, true - independent
DEBUG_LEVEL);
} else if (label.equals("Image Properties")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
ImagePlus imp_sel = WindowManager.getCurrentImage();
if (imp_sel==null){
IJ.showMessage("Error","There are no images open\nProcess canceled");
return;
}
(new JP46_Reader_camera(false)).decodeProperiesFromInfo(imp_sel);
ArrayList<String> prop_kv = new ArrayList<String>();
Set<Object> jp4_set;
Properties jp4_prop;
Iterator<Object> itr;
String str;
jp4_prop=imp_sel.getProperties();
if (jp4_prop!=null) {
jp4_set=jp4_prop.keySet();
itr=jp4_set.iterator();
while(itr.hasNext()) {
str = (String) itr.next();
// if (!str.equals("Info")) info+="<"+str+">\""+jp4_prop.getProperty(str)+"\"</"+str+">";
if (!str.equals("Info")) {
prop_kv.add(str+"|"+jp4_prop.getProperty(str));
}
}
}
Collections.sort(prop_kv);
prop_kv.add("|"); // empty item to add new property
GenericDialog gd = new GenericDialog("Edit properties");
gd.addMessage("Use empty string to remove property, quoted empty - to set zero length, "+
"name|value for value to set a new property");
String [] names = new String[prop_kv.size()];
for (int ii = 0; ii < prop_kv.size(); ii++) {
String s = (String) prop_kv.get(ii);
int sep = s.indexOf("|");
if (sep < 0) {
sep = s.length();
}
String name = s.substring(0, sep);
names[ii] = name;
String val = (sep == s.length()) ? "": s.substring(sep + 1);
gd.addStringField(ii+": "+name, val, 20);
}
WindowTools.addScrollBars(gd);
gd.showDialog();
if (gd.wasCanceled()) return;
for (int ii = 0; ii < prop_kv.size(); ii++) {
String name = names[ii];
String val = gd.getNextString();
int sep = val.indexOf("|");
if (sep > 0) { // ignore existing key, set a key/value pair
name = val.substring(0, sep);
val = val.substring(sep + 1);
} else if (val.length() == 0) {
val = null;
} else {
val = val.replaceAll("^\"+|\"+$", ""); // remove leading/trailing "
}
if (name.length() > 0) {
imp_sel.setProperty(name, val);
}
}
(new JP46_Reader_camera(false)).encodeProperiesToInfo(imp_sel);
//JTabbedTest
// End of buttons code
}
......
......@@ -139,7 +139,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
return derivs;
}
public Matrix [] getRotMatricesDbg() {
Matrix [] rots = new Matrix [4];
Matrix [] rots = new Matrix [getNumSensors()];
double [] azimuths = getAzimuths();
double [] tilts = getTilts();
double [] rolls = getFullRolls();
......@@ -183,7 +183,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
public Matrix [][] getRotDeriveMatricesDbg() // USED in lwir
{
Matrix [][] rot_derivs = new Matrix [4][4]; // channel, azimuth-tilt-roll-zoom
Matrix [][] rot_derivs = new Matrix [getNumSensors()][4]; // channel, azimuth-tilt-roll-zoom
double [] azimuths = getAzimuths();
double [] tilts = getTilts();
double [] rolls = getFullRolls();
......@@ -283,7 +283,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
public Matrix [] getRotMatrices() // USED in lwir TODO: Update to non-quad!
{
Matrix [] rots = new Matrix [4];
Matrix [] rots = new Matrix [getNumSensors()];
double [] azimuths = getAzimuths();
double [] tilts = getTilts();
double [] rolls = getFullRolls();
......@@ -323,7 +323,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
//TODO: UPDATE to include scales
public Matrix [][] getRotDeriveMatrices() // USED in lwir
{
Matrix [][] rot_derivs = new Matrix [4][4]; // channel, azimuth-tilt-roll-zoom
Matrix [][] rot_derivs = new Matrix [getNumSensors()][4]; // channel, azimuth-tilt-roll-zoom
double [] azimuths = getAzimuths();
double [] tilts = getTilts();
double [] rolls = getFullRolls();
......
......@@ -3061,8 +3061,8 @@ public class QuadCLTCPU {
return result;
}
public void processCLTQuads( // not used in lwir
@Deprecated
public void processCLTQuads( // not used in lwir uses quad
CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
ColorProcParameters colorProcParameters,
......@@ -3290,8 +3290,9 @@ public class QuadCLTCPU {
System.out.println("processCLTQuads(): processing "+fileIndices.length+" files finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),3)+" sec, --- Free memory="+Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
}
public ImagePlus [] processCLTQuad( // not used in lwir
@Deprecated
public ImagePlus [] processCLTQuad( // not used in lwir uses quad
ImagePlus [] imp_quad, // should have properties "name"(base for saving results), "channel","path"
CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
......
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