Commit 484ec936 authored by Andrey Filippov's avatar Andrey Filippov

fixing configuration and missing clt directory creation

parent 0f7af7d5
......@@ -25,17 +25,15 @@
**
*/
import ij.IJ;
import ij.Prefs;
import ij.gui.GenericDialog;
import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
import ij.IJ;
import ij.Prefs;
import ij.gui.GenericDialog;
public class EyesisCorrectionParameters {
public static class CorrectionParameters{
......@@ -293,18 +291,18 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"equirectangularSuffix")!=null) this.equirectangularSuffix=properties.getProperty(prefix+"equirectangularSuffix");
if (properties.getProperty(prefix+"equirectangularCut")!=null)
this.equirectangularCut=Boolean.parseBoolean((String)properties.getProperty(prefix+"equirectangularCut"));
this.equirectangularCut=Boolean.parseBoolean(properties.getProperty(prefix+"equirectangularCut"));
// if (properties.getProperty(prefix+"equirectangularSuffixA")!=null) this.equirectangularSuffixA=properties.getProperty(prefix+"equirectangularSuffixA");
if (properties.getProperty(prefix+"planeMapPrefix")!=null) this.planeMapPrefix=properties.getProperty(prefix+"planeMapPrefix");
if (properties.getProperty(prefix+"planeMapSuffix")!=null) this.planeMapSuffix=properties.getProperty(prefix+"planeMapSuffix");
if (properties.getProperty(prefix+"usePlaneProjection")!=null)
this.usePlaneProjection=Boolean.parseBoolean((String)properties.getProperty(prefix+"usePlaneProjection"));
this.usePlaneProjection=Boolean.parseBoolean(properties.getProperty(prefix+"usePlaneProjection"));
if (properties.getProperty(prefix+"planeAsJPEG")!=null)
this.planeAsJPEG=Boolean.parseBoolean((String)properties.getProperty(prefix+"planeAsJPEG"));
this.planeAsJPEG=Boolean.parseBoolean(properties.getProperty(prefix+"planeAsJPEG"));
if (properties.getProperty(prefix+"resultsDirectory")!= null) this.resultsDirectory=properties.getProperty(prefix+"resultsDirectory");
if (properties.getProperty(prefix+"removeUnusedSensorData")!= null)
this.removeUnusedSensorData=Boolean.parseBoolean((String) properties.getProperty(prefix+"removeUnusedSensorData"));
this.removeUnusedSensorData=Boolean.parseBoolean(properties.getProperty(prefix+"removeUnusedSensorData"));
if (properties.getProperty(prefix+"sourcePaths")!= null){
int numFiles=Integer.parseInt(properties.getProperty(prefix+"sourcePaths"));
this.sourcePaths=new String[numFiles];
......@@ -323,17 +321,17 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"x3dDirectory")!= null) this.x3dDirectory=properties.getProperty(prefix+"x3dDirectory");
if (properties.getProperty(prefix+"use_x3d_subdirs")!= null) this.use_x3d_subdirs=Boolean.parseBoolean((String) properties.getProperty(prefix+"use_x3d_subdirs"));
if (properties.getProperty(prefix+"use_x3d_subdirs")!= null) this.use_x3d_subdirs=Boolean.parseBoolean(properties.getProperty(prefix+"use_x3d_subdirs"));
if (properties.getProperty(prefix+"clt_batch_apply_man")!= null) this.clt_batch_apply_man=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_apply_man"));
if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_extrinsic"));
if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_poly"));
if (properties.getProperty(prefix+"clt_batch_4img")!= null) this.clt_batch_4img=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_4img"));
if (properties.getProperty(prefix+"clt_batch_explore")!= null) this.clt_batch_explore=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_explore"));
if (properties.getProperty(prefix+"clt_batch_surf")!= null) this.clt_batch_surf=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_surf"));
if (properties.getProperty(prefix+"clt_batch_assign")!= null) this.clt_batch_assign=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_assign"));
if (properties.getProperty(prefix+"clt_batch_gen3d")!= null) this.clt_batch_gen3d=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_gen3d"));
if (properties.getProperty(prefix+"clt_batch_dbg1")!= null) this.clt_batch_dbg1=Boolean.parseBoolean((String) properties.getProperty(prefix+"clt_batch_dbg1"));
if (properties.getProperty(prefix+"clt_batch_apply_man")!= null) this.clt_batch_apply_man=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_apply_man"));
if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_extrinsic"));
if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly"));
if (properties.getProperty(prefix+"clt_batch_4img")!= null) this.clt_batch_4img=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_4img"));
if (properties.getProperty(prefix+"clt_batch_explore")!= null) this.clt_batch_explore=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_explore"));
if (properties.getProperty(prefix+"clt_batch_surf")!= null) this.clt_batch_surf=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_surf"));
if (properties.getProperty(prefix+"clt_batch_assign")!= null) this.clt_batch_assign=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_assign"));
if (properties.getProperty(prefix+"clt_batch_gen3d")!= null) this.clt_batch_gen3d=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_gen3d"));
if (properties.getProperty(prefix+"clt_batch_dbg1")!= null) this.clt_batch_dbg1=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_dbg1"));
}
public boolean showDialog(String title) {
......@@ -426,7 +424,7 @@ public class EyesisCorrectionParameters {
gd.addStringField("DCT symmetical kernel files", this.dctSymSuffix, 40);
gd.addStringField("DCT asymmetrical kernel files suffix", this.dctAsymSuffix, 40);
gd.addStringField("CLT kernel files prefix", this.cltKernelPrefix, 40);
gd.addStringField("CLT symmetical kernel files", this.cltSuffix, 40);
gd.addStringField("CLT kernel files suffix", this.cltSuffix, 40);
gd.addStringField("Equirectangular maps prefix", this.equirectangularPrefix, 40);
gd.addStringField("Equirectangular maps suffix", this.equirectangularSuffix, 40);
......@@ -499,6 +497,13 @@ public class EyesisCorrectionParameters {
this.firstSubCamera= (int) gd.getNextNumber();
this.sensorPrefix= gd.getNextString();
this.sensorSuffix= gd.getNextString();
this.sharpKernelPrefix= gd.getNextString();
this.sharpKernelSuffix= gd.getNextString();
this.smoothKernelPrefix= gd.getNextString();
this.smoothKernelSuffix= gd.getNextString();
this.dctKernelPrefix= gd.getNextString();
this.dctSymSuffix= gd.getNextString();
this.dctAsymSuffix= gd.getNextString();
this.cltKernelPrefix= gd.getNextString();
this.cltSuffix= gd.getNextString();
this.equirectangularPrefix= gd.getNextString();
......@@ -544,7 +549,7 @@ public class EyesisCorrectionParameters {
gd.addStringField("Sensor files suffix", this.sensorSuffix, 40); // 17
gd.addStringField("CLT kernel files prefix", this.cltKernelPrefix, 40); // 18
gd.addStringField("CLT symmetical kernel files", this.cltSuffix, 40); // 19
gd.addStringField("CLT kernel files suffix", this.cltSuffix, 40); // 19
gd.addMessage ("============ batch parameters ============");
gd.addCheckbox ("Apply (and disable) manual pixel shift", this.clt_batch_apply_man); // 20
......@@ -1026,7 +1031,7 @@ public class EyesisCorrectionParameters {
String kernelPrefix= this.cltKernelPrefix;
CalibrationFileManagement.MultipleExtensionsFileFilter kernelFilter =
new CalibrationFileManagement.MultipleExtensionsFileFilter(kernelPrefix,extensions,kernelPrefix+
"*"+extensions[0]+" CLT symmetrical kernel files");
"*"+extensions[0]+" CLT kernel files");
if (debugLevel>1) System.out.println("selectKernelFiles("+debugLevel+"): defaultPaths[0]="+defaultPaths[0]+" "+kernelPrefix+"*"+extensions[0]);
String [] kernelFiles=null;
......@@ -2025,8 +2030,8 @@ public class EyesisCorrectionParameters {
this.ringIR=Double.parseDouble(properties.getProperty(prefix+"ringIR"));
this.ringOR=Double.parseDouble(properties.getProperty(prefix+"ringOR"));
if (properties.getProperty(prefix+"thresholdCorr")!=null){
this.thresholdCorr=new double [Integer.parseInt((String) properties.getProperty(prefix+"thresholdCorr"))];
for (int i=0;i<this.thresholdCorr.length;i++) this.thresholdCorr[i]=Double.parseDouble((String)properties.getProperty(prefix+"thresholdCorr_"+i));
this.thresholdCorr=new double [Integer.parseInt(properties.getProperty(prefix+"thresholdCorr"))];
for (int i=0;i<this.thresholdCorr.length;i++) this.thresholdCorr[i]=Double.parseDouble(properties.getProperty(prefix+"thresholdCorr_"+i));
}
}
......
......@@ -25,17 +25,15 @@
**
*/
import ij.*;
import ij.process.*;
import ij.gui.*;
import ij.io.FileInfo;
import ij.io.FileSaver;
import ij.io.OpenDialog;
import ij.io.Opener;
import ij.plugin.frame.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Button;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
......@@ -53,6 +51,26 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import ij.CompositeImage;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.Prefs;
import ij.WindowManager;
import ij.gui.GUI;
import ij.gui.GenericDialog;
import ij.gui.Plot;
import ij.gui.PlotWindow;
import ij.gui.Roi;
import ij.io.FileInfo;
import ij.io.FileSaver;
import ij.io.OpenDialog;
import ij.io.Opener;
import ij.plugin.frame.PlugInFrame;
import ij.process.ColorProcessor;
import ij.process.FloatProcessor;
import ij.process.ImageProcessor;
import loci.common.services.DependencyException;
import loci.common.services.ServiceException;
import loci.formats.FormatException;
......@@ -662,6 +680,7 @@ private Panel panel1,
b.addKeyListener(IJ.getInstance());
panel.add(b);
}
@Override
public void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID()==WindowEvent.WINDOW_CLOSING) {
......@@ -669,6 +688,7 @@ private Panel panel1,
}
}
@Override
public void actionPerformed(ActionEvent e) {
String label = e.getActionCommand();
if (label.equals("Abort")) {
......@@ -2633,7 +2653,7 @@ private Panel panel1,
for (int ii = 0; ii<n; ii++) {
dindex[ii] = (double) ii;
dindex[ii] = ii;
x[ii] = 0.0;
}
// x[1] = 1.0;
......@@ -4146,6 +4166,15 @@ private Panel panel1,
return;
}
}
String cltPath=EYESIS_CORRECTIONS.correctionsParameters.selectCLTKernelDirectory( // create if it does not exist
true,
true);
if (cltPath==null) {
String msg="No CLT kernels (results) directory selected, command aborted";
System.out.println("Warning: "+msg);
IJ.showMessage("Warning",msg);
return;
}
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL);
......@@ -5288,6 +5317,7 @@ private Panel panel1,
public MultipleExtensionsFileFilter (String [] patterns) {
this.patterns=patterns.clone();
}
@Override
public boolean accept (File file) {
int i;
String name=file.getName();
......@@ -5297,6 +5327,7 @@ private Panel panel1,
}
return false;
}
@Override
public String getDescription() {
return description;
}
......@@ -6617,6 +6648,7 @@ private Panel panel1,
final long startTime = System.nanoTime();
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
float [] pixels=null; // will be initialized at first use
float [] kernelPixels=null; // will be initialized at first use
......@@ -6759,6 +6791,7 @@ private Panel panel1,
final long startTime = System.nanoTime();
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
double [][] tile= new double[nChn][debayerParameters.size * debayerParameters.size ];
double [][] both_masks;
......@@ -7006,6 +7039,7 @@ private Panel panel1,
final long startTime = System.nanoTime();
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
double [] tile= new double[size * size ];
int tileY,tileX;
......
......@@ -711,7 +711,7 @@ public class QuadCLT {
imp_clt.show();
}
FileSaver fs=new FileSaver(imp_clt);
fs.saveAsTiffStack(cltPath);
fs.saveAsTiffStack(cltPath); // directory does not exist
}
}
return true;
......
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