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("")) {
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);
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
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
......
......@@ -7,7 +7,7 @@
** Copyright (C) 2010 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
**
** JP46_Reader.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
......@@ -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,13 +56,28 @@ 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). */
public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
/**
*
*
*/
private static final long serialVersionUID = 390855361964415147L;
Panel panel1;
......@@ -90,13 +112,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel1.setLayout(new GridLayout(6, 1, 50, 5));
addButton("Open JP4/JP46...",panel1);
addButton("Open JP4/JP46...",panel1);
addButton("Open JP4/JP46 from camera",panel1);
addButton("Configure...",panel1);
addButton("Show image properties",panel1);
addButton("Decode image info to properties",panel1);
addButton("Split Bayer",panel1);
add(panel1);
......@@ -118,7 +140,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel1.setLayout(new GridLayout(6, 1, 50, 5));
addButton("Open JP4/JP46...",panel1);
addButton("Open JP4/JP46...",panel1);
addButton("Open JP4/JP46 from camera",panel1);
addButton("Configure...",panel1);
addButton("Show image properties",panel1);
......@@ -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();
......@@ -144,16 +167,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if (label==null) return;
/* button */
if (label.equals("Open JP4/JP46...")) {
if (label.equals("Open JP4/JP46...")) {
read_jp46(arg,true);
}else if (label.equals("Open JP4/JP46 (no scale)...")) {
read_jp46(arg,false);
}else if (label.equals("Configure...")) {
showConfigDialog(); // open configure dialog
}else if (label.equals("Open JP4/JP46 from camera")) {
openURL(camera_url + camera_img_new + camera_jp46settings, arg, true);
openURL(camera_url + camera_img_new + camera_jp46settings, arg, true);
}else if (label.equals("Open JP4/JP46 from camera (no scale)")) {
openURL(camera_url + camera_img_new + camera_jp46settings, arg, false);
openURL(camera_url + camera_img_new + camera_jp46settings, arg, false);
}else if (label.equals("Show image properties")) {
ImagePlus imp_sel = WindowManager.getCurrentImage();
if (imp_sel==null){
......@@ -202,7 +225,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp_stack.getProcessor().resetMinAndMax();
imp_stack.show();
}
public void read_jp46(String arg, boolean scale) {
JFileChooser fc=null;
//try {fc = new JFileChooser();}
......@@ -249,7 +272,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
confpanel = new Panel();
gd.addPanel(confpanel);
addButton("Open JP4/JP46 (no scale)...", confpanel);
addButton("Open JP4/JP46 (no scale)...", confpanel);
addButton("Open JP4/JP46 from camera (no scale)", confpanel);
//Vector textfields = gd.getStringFields();
......@@ -310,7 +333,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if (reuse_imp) {
imp=imp_src;
} else if ((imp_src!=null)&& showImage) { /* tried to reuse, but wrong size */
imp.show(); /* never did that before */
imp.show(); /* never did that before */
}
if ((xtraExif!=null) && !Double.isNaN(xtraExif[0])){
imp.setProperty("EXPOSURE", String.format("%f",xtraExif[0]));
......@@ -328,16 +351,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return imp;
}
return null;
return null;
}
public ImagePlus openURL(ImagePlus imp_src) {
if (imp_src==null) return openURL(camera_url + camera_img_new + camera_jp46settings, arg, true);
return openURL(camera_url + camera_img_new + camera_jp46settings, arg, true, imp_src,true);
return openURL(camera_url + camera_img_new + camera_jp46settings, arg, true, imp_src,true);
}
public ImagePlus openURL() {
return openURL(camera_url + camera_img_new + camera_jp46settings, arg, true);
return openURL(camera_url + camera_img_new + camera_jp46settings, arg, true);
}
public ImagePlus openURL(String url, String arg, boolean scale) {
......@@ -356,7 +379,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
boolean showDemux=showImage && demux;
if (demux) showImage=false;
double [] xtraExif=new double[1]; // ExposureTime
// System.out.println("imp_src is "+((imp_src!=null)?"not ":"")+"null");
try {
......@@ -389,7 +412,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp=imp_src;
} else if ((imp_src!=null) && showImage) { /* tried to reuse, but wrong size */
// System.out.println("show() 2");
imp.show(); /* never did that before */
imp.show(); /* never did that before */
}
if ((xtraExif!=null) && !Double.isNaN(xtraExif[0])){
imp.setProperty("EXPOSURE", String.format("%f",xtraExif[0]));
......@@ -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;
......@@ -564,7 +587,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if (i==0) info+="SYSTEM TEMPERATURE\t" + temperature+"\t\t\t\n";
else info+="SFE "+i+" TEMPERATURE\t" + temperature+"\t\t\t\n";
imp.setProperty("TEMPERATURE_"+i,""+temperature);
}
}
if (COMPOSITE) {
......@@ -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,9 +658,9 @@ 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
if (FLIPV!=0) {
swapArrayElements (satValue, 1, 3);
......@@ -645,13 +670,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
swapArrayElements (satValue, 1, 0);
swapArrayElements (satValue, 3, 2);
}
for (i=0;i<4;i++) {
imp.setProperty("saturation_"+i,String.format("%f",satValue[i]));
//System.out.println("saturation_"+i+"\t"+String.format("%f",satValue[i]));
}
}
ImageProcessor ip = imp.getProcessor();
......@@ -745,11 +770,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
if (FLIPH!=0) ip_src.flipHorizontal(); /* To correct Bayer */
if (FLIPV!=0) ip_src.flipVertical(); /* To correct Bayer */
/* Is it needed here ? */
/* imp.draw();
imp.show(); **/
if (use_imp_src) copyProperties (imp, imp_src);
if (use_imp_src) copyProperties (imp, imp_src);
return use_imp_src;
}
......@@ -834,7 +859,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
try {
camURL = new URL(url);
urlConn = camURL.openConnection();
int contentLength = 4096; /* just read the beginning of the file */ //urlConn.getContentLength();
int contentLength = 4096; /* just read the beginning of the file */ //urlConn.getContentLength();
//inStream = new InputStreamReader(urlConn.getInputStream());
int bytesRead = 0;
......@@ -852,7 +877,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
} catch(MalformedURLException e){
System.out.println("Please check the URL:" + e.toString() );
} catch(IOException e1){
System.out.println("Can't read from the Internet: "+ e1.toString() );
System.out.println("Can't read from the Internet: "+ e1.toString() );
}
byte [] sig= {(byte) 0x92 ,0x7c, /* MakerNote*/
0x00 ,0x04, /* type (long)*/
......@@ -891,9 +916,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return note;
}
long [] getExifData (byte [] sig, byte [] head, int len){
/* search for sig array */
int i = this.ExifOffset + 2;
......@@ -934,7 +959,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp = new ImagePlus(name, img);
} catch (IllegalStateException e) {
return null; // error loading image
}
}
if (imp.getType()==ImagePlus.COLOR_RGB) {
checkGrayJpegTo32Bits(imp);
......@@ -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;
}
......@@ -964,8 +991,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return camera_url;
}
ImagePlus openJpegOrGifUsingURL (String cameraurl) {
URL url = null;
ImagePlus openJpegOrGifUsingURL (String cameraurl) {
URL url = null;
ImagePlus imp = null;
Image img = null;
......@@ -1062,7 +1089,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
for (i=y0;i<y1;i++) {
index=i*mapWidth+x0;
for (j=0;j<width;j++) if (map[index++]>0.0) over++;
}
return (1.0*over)/width/height;
}
......@@ -1086,7 +1113,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if (noProperties) return null;
//0 - red, 1,2 - green (use Math.min()), 3 - blue
for (i=0;i<4;i++) satValues[i]*=relativeThreshold;
ImageProcessor ip=imp.getProcessor();
int width=imp.getWidth();
float []pixels=(float[]) ip.getPixels();
......@@ -1098,12 +1125,12 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
return overexposed;
}
public ImagePlus demuxImageOrClone(ImagePlus imp, int numImg) {
ImagePlus imp_new=demuxImage(imp, numImg);
if (imp_new!=null) return imp_new;
return demuxClone(imp);
}
}
public ImagePlus demuxClone(ImagePlus imp) {
ImageProcessor ip=imp.getProcessor().duplicate();
......@@ -1122,9 +1149,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
return imp_new;
}
}
public ImagePlus demuxImage(ImagePlus imp, int numImg) {
int width= imp.getWidth();
// int height=imp.getHeight();
......@@ -1147,8 +1174,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
timestamp=imp.getProperty("timestamp");
if (timestamp!=null);
/*
/*
System.out.println("FLIPV="+FLIPGV+" FLIPH="+FLIPGH);
for (i=0;i<3;i++) System.out.println("FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
for (i=0;i<3;i++) System.out.println("HEIGHTS["+i+"]="+HEIGHTS[i]);
......@@ -1178,9 +1205,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
// for (i=0;i<3;i++) System.out.println("Final: FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
// if needed, we'll cut one pixel line. later can modify to add one extra, but then we need to duplicate the pre-last one (same Bayer),
// not just add zeros - later before sliding FHT the two border lines are repeated for 16 times to reduce border effects.
// not just add zeros - later before sliding FHT the two border lines are repeated for 16 times to reduce border effects.
for (i=0;i<3;i++) {
// System.out.println("before r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("before r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("before r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
if (((r[i].height & 1)==0 ) & (((r[i].y+FLIPV[i])&1)!=0)) r[i].height-=2;
r[i].height &=~1;
......@@ -1190,10 +1217,10 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
r[i].width &=~1;
if (((r[i].x+FLIPH[i])&1)!=0) r[i].x+=1;
// System.out.println("after r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("after r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
// System.out.println("after r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("after r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
}
if (r[numImg].height<=0) return null;
// ImageProcessor ip=imp.getProcessor();
......@@ -1205,7 +1232,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
at ij.process.FloatProcessor.crop(FloatProcessor.java:706)
at JP46_Reader_camera.demuxImage(JP46_Reader_camera.java:1104)
at CalibrationHardwareInterface$CamerasInterface$4.run(CalibrationHardwareInterface.java:1101)
*/
// ImageProcessor ip=imp.getProcessor();
// ip.setRoi(r[numImg]);
......@@ -1241,7 +1268,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
}
if (timestamp!=null)imp_result.setProperty("timestamp", timestamp);
*/
// fill in meta data
// fill in meta data
return imp_result;
}
public void copyProperties (ImagePlus imp_src,ImagePlus imp_dst){
......@@ -1260,8 +1287,8 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
}
}
}
public ImagePlus encodeProperiesToInfo(ImagePlus imp){
String info="<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties>";
Set<Object> jp4_set;
......@@ -1285,7 +1312,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
public boolean decodeProperiesFromInfo(ImagePlus imp){
if (imp.getProperty("Info")==null) return false;
String xml= (String) imp.getProperty("Info");
DocumentBuilder db=null;
try {
db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
......@@ -1307,9 +1334,9 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
String name= allNodes.item(i).getNodeName();
String value=allNodes.item(i).getFirstChild().getNodeValue();
imp.setProperty(name, value);
}
return true;
}
/**
......@@ -1331,7 +1358,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
// run the plugin
IJ.runPlugIn(clazz.getName(), "");
}
}
......
......@@ -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