Commit 9e5d4e97 authored by Andrey Filippov's avatar Andrey Filippov

added x3d model versions

parent 47feee12
......@@ -128,6 +128,7 @@ public class EyesisCorrectionParameters {
public String x3dModelVersion="v01";
public String x3dDirectory="";
public void setProperties(String prefix,Properties properties){
......@@ -219,6 +220,8 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"x3dDirectory", this.x3dDirectory);
properties.setProperty(prefix+"use_x3d_subdirs", this.use_x3d_subdirs+"");
properties.setProperty(prefix+"x3dModelVersion", this.x3dModelVersion);
properties.setProperty(prefix+"clt_batch_apply_man", this.clt_batch_apply_man+"");
properties.setProperty(prefix+"clt_batch_extrinsic", this.clt_batch_extrinsic+"");
properties.setProperty(prefix+"clt_batch_poly", this.clt_batch_poly+"");
......@@ -323,6 +326,8 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"use_x3d_subdirs")!= null) this.use_x3d_subdirs=Boolean.parseBoolean(properties.getProperty(prefix+"use_x3d_subdirs"));
if (properties.getProperty(prefix+"x3dModelVersion")!= null) this.x3dModelVersion=properties.getProperty(prefix+"x3dModelVersion");
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"));
......@@ -401,6 +406,7 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aberration kernels for CLT directory", this.cltKernelDirectory, 60);
gd.addCheckbox ("Select aberration kernels for CLT directory", false);
gd.addStringField ("x3d model version", this.x3dModelVersion, 20); // 10a
gd.addStringField ("x3d output directory", this.x3dDirectory, 60);
gd.addCheckbox ("Select x3d output directory", false);
gd.addCheckbox ("Use individual subdirectory for each 3d model (timestamp as name)", this.use_x3d_subdirs);
......@@ -488,6 +494,7 @@ public class EyesisCorrectionParameters {
this.smoothKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSmoothKernelDirectory(false, true);
this.dctKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectDCTKernelDirectory(false, true);
this.cltKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectCLTKernelDirectory(false, true);
this.x3dModelVersion= gd.getNextString(); // 10a
this.x3dDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectX3dDirectory(false, true);
this.use_x3d_subdirs= gd.getNextBoolean();
this.equirectangularDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectEquirectangularDirectory(false, false);
......@@ -533,11 +540,13 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aberration kernels for CLT directory", this.cltKernelDirectory, 60); // 6
gd.addCheckbox ("Select aberration kernels for CLT directory", false); // 7
gd.addStringField ("x3d model version", this.x3dModelVersion, 60); // 10a
gd.addStringField ("x3d output directory", this.x3dDirectory, 60); // 8
gd.addCheckbox ("Select x3d output directory", false); // 9
gd.addCheckbox ("Select x3d output (top model) directory", false); // 9
gd.addCheckbox ("Use individual subdirectory for each 3d model (timestamp as name)", this.use_x3d_subdirs); //10
gd.addStringField ("Results directory", this.resultsDirectory, 60); // 11
gd.addCheckbox ("Select results directory", false); // 12
......@@ -581,6 +590,7 @@ public class EyesisCorrectionParameters {
this.sourceDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSourceDirectory(false, false); // 3
this.sensorDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSensorDirectory(false, false); // 5
this.cltKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectCLTKernelDirectory(false, true); // 7
this.x3dModelVersion= gd.getNextString(); // 10a
this.x3dDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectX3dDirectory(false, true); // 9
this.use_x3d_subdirs= gd.getNextBoolean(); // 10
this.resultsDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectResultsDirectory(false, true); // 12
......@@ -1148,7 +1158,7 @@ public class EyesisCorrectionParameters {
}
// select qualified (by 'name' - quad timestamp) x3d subdirectory
public String selectX3dDirectory(String name, boolean smart, boolean newAllowed) {
public String selectX3dDirectory(String name, String version, boolean smart, boolean newAllowed) {
String dir= CalibrationFileManagement.selectDirectory(
smart,
......@@ -1159,14 +1169,18 @@ public class EyesisCorrectionParameters {
this.x3dDirectory); //this.sourceDirectory);
if (dir!=null) {
this.x3dDirectory=dir;
if (this.use_x3d_subdirs &&(name != null) && !name.equals("")) {
if (this.use_x3d_subdirs && (name != null) && !name.equals("")) {
name = this.x3dDirectory + Prefs.getFileSeparator()+name;
if ((version != null) && !version.equals("")) {
name = name + Prefs.getFileSeparator()+version;
}
dir= CalibrationFileManagement.selectDirectory(
smart,
newAllowed, // save
"x3d output sub-directory", // title
"Select x3d output sub-directory", // button
null, // filter
this.x3dDirectory + Prefs.getFileSeparator()+name); //this.sourceDirectory);
name); //this.x3dDirectory + Prefs.getFileSeparator()+name); //this.sourceDirectory);
}
}
return dir;
......
......@@ -27,12 +27,19 @@
import java.awt.Button;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.MouseInfo;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
......@@ -394,10 +401,10 @@ private Panel panel1,
panel6 = new Panel();
panel6.setLayout(new GridLayout(1, 0, 5, 5));
addButton("Save",panel6);
addButton("Restore",panel6,color_restore);
addButton("Stop",panel6,color_stop);
addButton("Abort",panel6,color_stop);
addButton("Save", panel6,color_process); //, "Save configuration");
addButton("Restore", panel6,color_restore); // , "Restore configuration");
addButton("Stop", panel6,color_stop);
addButton("Abort", panel6,color_stop);
add(panel6);
......@@ -666,18 +673,62 @@ private Panel panel1,
}
}
public class AwtToolTip extends MouseAdapter{
private String toolTipText= "...";
private Component component = null;
private Dialog dialog;
public AwtToolTip(String toolTipText, Component component){
this.toolTipText= toolTipText;
this.component= component;
dialog = new Dialog(new Frame());
dialog.add(new Label(toolTipText));
dialog.setLocationRelativeTo(component);
dialog.pack();
}
@Override
public void mouseEntered(MouseEvent mouseEvent){
Point location = MouseInfo.getPointerInfo().getLocation();
int x = (int) location.getX();
int y = (int) location.getY();
dialog.setLocation(x,y);
dialog.setVisible(true);
}
@Override
public void mouseExited(MouseEvent mouseEvent){
dialog.setVisible(false);
}
}
void addButton(String label, Panel panel,Color color, String toolTip) {
Button b = new Button(label);
b.setBackground(color);
b.addActionListener(this);
b.addKeyListener(IJ.getInstance());
b.addMouseListener(new AwtToolTip(toolTip, b));
panel.add(b);
}
void addButton(String label, Panel panel,Color color) {
Button b = new Button(label);
b.setBackground(color);
b.addActionListener(this);
b.addKeyListener(IJ.getInstance());
// b.addMouseListener(new AwtToolTip(label, b));
panel.add(b);
}
void addButton(String label, Panel panel) {
Button b = new Button(label);
b.addActionListener(this);
b.addKeyListener(IJ.getInstance());
// b.addMouseListener(new AwtToolTip(label, b));
panel.add(b);
}
@Override
......
......@@ -24,22 +24,29 @@
**
*/
import ij.*;
import ij.io.*;
import ij.process.*;
import ij.gui.*;
import ij.plugin.frame.*;
import ij.text.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.awt.Button;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import java.io.*;
import javax.swing.*;
import javax.swing.JFileChooser;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
......@@ -49,6 +56,21 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
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.io.FileInfo;
import ij.io.OpenDialog;
import ij.plugin.frame.PlugInFrame;
import ij.process.ImageConverter;
import ij.process.ImageProcessor;
import ij.text.TextWindow;
/* This plugin opens images in Elphel JP4/JP46 format (opens as JPEG, reads MakerNote and converts). */
......@@ -137,6 +159,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel.add(b);
}
@Override
public void actionPerformed(ActionEvent e) {
String label = e.getActionCommand();
......@@ -428,7 +451,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
double[] blacks= new double[4];
double[] blacks256= new double[4];
double[] gammas= new double[4];
long [] gamma_scales= new long[4]; /* now not used, was scale _after_ gamma is applied, 0x400(default) corersponds to 1.0 */
long [] gamma_scales= new long[4]; /* now not used, was scale _after_ gamma is applied, 0x400(default) corresponds to 1.0 */
int i;
double[][] rgammas=new double[4][];
double min_gain;
......@@ -618,13 +641,15 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
min_gain=2.0*gains[0];
for (i=0;i<4;i++) {
if (min_gain > gains[i]*(1.0-blacks[i])) min_gain = gains[i]*(1.0-blacks[i]);
// System.out.println("gains["+i+"]="+gains[i]+" min_gain="+min_gain);
System.out.println("gains["+i+"]="+gains[i]+" min_gain="+min_gain);
}
imp.setProperty("GAIN",String.format("%f",min_gain)); // common gain
for (i=0;i<4;i++) gains[i]/=min_gain;
for (i=0;i<4;i++) blacks256[i]=256.0*blacks[i];
// for (i=0;i<4;i++) {
// System.out.println("scaled gains["+i+"]="+gains[i]);
// }
for (i=0;i<4;i++) {
System.out.println("scaled gains["+i+"]="+gains[i]);
}
for (i=0;i<4;i++) {
......@@ -633,7 +658,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
else satValue[i]=((rgammas[i][255])-blacks256[i]);
} else satValue[i]=255.0;
imp.setProperty("saturation_"+i,String.format("%f",satValue[i]));
// System.out.println("scaled gains["+i+"]="+gains[i]+" satValue["+i+"]="+satValue[i]);
System.out.println("scaled gains["+i+"]="+gains[i]+" satValue["+i+"]="+satValue[i]);
}
// swap satValue to match FLIPH,FLIPV again
......@@ -951,9 +976,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
return imp;
}
@Override
public void setTitle (String title) {
imageTitle=title;
}
@Override
public String getTitle () {
return imageTitle;
}
......
......@@ -4069,6 +4069,7 @@ public class QuadCLT {
// Save as individual JPEG images in the model directory
String x3d_path= correctionsParameters.selectX3dDirectory(
name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters.x3dModelVersion,
true, // smart,
true); //newAllowed, // save
for (int sub_img = 0; sub_img < 4; sub_img++){
......@@ -7039,6 +7040,7 @@ public class QuadCLT {
}
String x3d_path= correctionsParameters.selectX3dDirectory( // for x3d and obj
this.image_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters.x3dModelVersion,
true, // smart,
true); //newAllowed, // save
......@@ -7559,6 +7561,7 @@ public class QuadCLT {
String path= correctionsParameters.selectX3dDirectory(
//TODO: Which one to use - name or this.image_name ?
this.image_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters.x3dModelVersion,
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
true, // smart,
true); //newAllowed, // save
......@@ -7707,6 +7710,7 @@ public class QuadCLT {
String path= correctionsParameters.selectX3dDirectory(
//TODO: Which one to use - name or this.image_name ?
this.image_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters.x3dModelVersion,
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
true, // smart,
true); //newAllowed, // save
......
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