Commit 058e17c7 authored by Andrey Filippov's avatar Andrey Filippov

merged with lwir branch

parents c9f09988 78aea970
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>imagej-elphel</name>
<comment></comment>
<projects>
<project>metadata-extractor</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
......@@ -11,50 +11,95 @@
<version>3.1</version>
<relativePath/>
</parent>
<!--
<properties>
<imagej.app.directory>/home/foxel/Desktop/Fiji.app</imagej.app.directory>
</properties>
-->
<groupId>com.elphel</groupId>
<artifactId>imagej-elphel</artifactId>
<!-- <artifactId>Aberration_Calibration</artifactId> -->
<version>1.0.0-SNAPSHOT</version>
<name>plugins/imagej_elphel.jar</name>
<name>plugins/imagej_elphel.jar</name>
<!-- <name>plugins/Aberration_Calibration.jar</name> -->
<description>A Maven project implementing imagej-elphel plugin</description>
<description>A Maven project implementing imagej-elphel plugin</description>
<dependencies>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
<version>1.50b</version>
<!-- <version>${imagej1.version}</version> -->
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>jama</groupId>
<artifactId>jama</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>ome</groupId>
<artifactId>loci_tools</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
<version>1.52e</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcuda</artifactId>
<version>0.9.2</version>
</dependency>
<!--
As of 2018/09/11 TF for GPU on Maven supports CUDA 9.0 (vs latest 9.2)
Workaround:
~$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
~$ sudo apt install cuda-9.0
# install or link back to cuda-9.2:
~$ sudo rm /usr/local/cuda; sudo ln -sf /usr/local/cuda-9.2 /usr/local/cuda
Then in Eclipse's Run configurations... add an environment variable:
LD_LIBRARY_PATH = /usr/local/cuda-9.0/lib64
-->
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>libtensorflow</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>libtensorflow_jni_gpu</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-compress</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
<version>1.0.3</version>
</dependency>
<!--
<dependency>
<groupId>jama</groupId>
<artifactId>jama</artifactId>
<version>1.0.3</version>
</dependency>
-->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>ome</groupId>
<artifactId>loci_tools</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.11.0</version>
<type>java-source</type>
</dependency>
</dependencies>
<build>
<resources>
......@@ -64,6 +109,17 @@
<resource>
<directory>${project.build.sourceDirectory}</directory>
</resource>
<!-- trying to copy deep classes to top for the imageJ to see as plugins-->
<!--
<resource>
<filtering>true</filtering>
<directory>${basedir}/target/classes/com/elphel/imagej/jp4</directory>
<targetPath>${basedir}/target/classes</targetPath>
<includes>
<include>JP46_Reader_camera.class</include>
</includes>
</resource>
-->
</resources>
<testResources>
<testResource>
......@@ -73,29 +129,55 @@
<directory>${project.build.testSourceDirectory}</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-plugin-plugin
</artifactId>
<versionRange>[3.3,)</versionRange>
<goals>
<goal>descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<version>1.3.2</version><!--$NO-MVN-MAN-VER$-->
<executions>
<execution>
<phase>package</phase>
......@@ -105,11 +187,11 @@
</execution>
</executions>
<configuration>
<!-- <mainClass>Aberration_Calibration</mainClass> -->
<mainClass>Eyesis_Correction</mainClass>
<!-- <mainClass>Aberration_Calibration</mainClass> -->
<mainClass>Eyesis_Correction</mainClass>
</configuration>
</plugin>
<plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
......@@ -127,12 +209,13 @@
<format>Build {0,date,yyyy-MM-dd} {0,time,HH:MM:SS} on host {1}</format>
<items>
<item>timestamp</item>
<item>foxel-MRHM7AP</item>
<!-- <item>foxel-MRHM7AP</item> -->
</items>
</configuration>
</plugin>
</plugins>
</plugins>
</pluginManagement>
</build>
<developers>
......@@ -168,10 +251,10 @@
</repositories>
<scm>
<connection>scm:git:git://github.com/Elphel/imagej-elphel</connection>
<developerConnection>scm:git:https://github.com/Elphel/imagej-elphel</developerConnection>
<connection>scm:git:git://git.elphel.com/Elphel/imagej-elphel</connection>
<developerConnection>scm:git:https://git.elphel.com/Elphel/imagej-elphel</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/Elphel/imagej-elphel</url>
<url>https://git.elphel.com/Elphel/imagej-elphel</url>
</scm>
<packaging>maven-plugin</packaging>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** aberrations.java
......@@ -47,8 +48,12 @@ import java.lang.Integer;
import javax.swing.*;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
public class aberrations extends PlugInFrame implements ActionListener {
public class AberrationsOld extends PlugInFrame implements ActionListener {
/**
*
*/
......@@ -56,7 +61,7 @@ public class aberrations extends PlugInFrame implements ActionListener {
Panel panel1,panel2;
// Panel panel;
JP46_Reader_camera jp4_instance;
showDoubleFloatArrays SDFA_instance;
ShowDoubleFloatArrays SDFA_instance;
DoubleFHT fht_instance;
static Frame instance;
public static int DEBUG_LEVEL = 2;
......@@ -267,7 +272,7 @@ Panel panel1,panel2;
public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel
public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel
public static boolean INVERSE_FILTER= true; // apply variable-sigma filetering to the inverted PSF
public static boolean INVERSE_FILTER= true; // apply variable-sigma filtering to the inverted PSF
public static int SPLIT_OVERSAMPLE= 2;
......@@ -316,7 +321,7 @@ Panel panel1,panel2;
public static double DOUBLE_DEBUG_RESULT; // just for temporary passing results from inside the functions
public static ImageStack convolutionKernelStack=null; // select to use for image convolution
public aberrations() {
public AberrationsOld() {
super("Aberrations");
if (IJ.versionLessThan("1.39t")) return;
if (instance!=null) {
......@@ -367,7 +372,7 @@ Panel panel1,panel2;
setVisible(true);
jp4_instance= new JP46_Reader_camera();
fht_instance= new DoubleFHT();
SDFA_instance= new showDoubleFloatArrays();
SDFA_instance= new ShowDoubleFloatArrays();
Hamming=initHamming(FFTSize);
......
/**
** -----------------------------------------------------------------------------**
** aberrations.java
**
** Programs for experimenting with aberrations correction
**
**
**
** Copyright (C) 2010 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** focus_tuning.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
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
package com.elphel.imagej.calibration;
import ij.*;
import ij.io.*;
......@@ -47,6 +22,10 @@ import java.lang.Integer;
import javax.swing.*;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
public class Aberrations_all extends PlugInFrame implements ActionListener {
/**
......@@ -56,7 +35,7 @@ public class Aberrations_all extends PlugInFrame implements ActionListener {
Panel panel1,panel2;
// Panel panel;
JP46_Reader_camera jp4_instance;
showDoubleFloatArrays SDFA_instance;
ShowDoubleFloatArrays SDFA_instance;
DoubleFHT fht_instance;
static Frame instance;
public static int DEBUG_LEVEL = 2;
......@@ -260,7 +239,7 @@ Panel panel1,panel2;
public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel
public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel
public static boolean INVERSE_FILTER= true; // apply variable-sigma filetering to the inverted PSF
public static boolean INVERSE_FILTER= true; // apply variable-sigma filtering to the inverted PSF
public static int SPLIT_OVERSAMPLE= 2;
......@@ -360,7 +339,7 @@ Panel panel1,panel2;
setVisible(true);
jp4_instance= new JP46_Reader_camera();
fht_instance= new DoubleFHT();
SDFA_instance= new showDoubleFloatArrays();
SDFA_instance= new ShowDoubleFloatArrays();
Hamming=initHamming(FFTSize);
......
import ij.IJ;
import ij.io.OpenDialog;
package com.elphel.imagej.calibration;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
......@@ -10,6 +8,9 @@ import java.io.IOException;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import ij.IJ;
import ij.io.OpenDialog;
public class CalibrationFileManagement {
public static String DEFAULT_DIRECTORY=null;
......@@ -22,9 +23,9 @@ public class CalibrationFileManagement {
System.out.println("Error: "+msg);
return null;
}
File [] files=dFile.listFiles(filter);
File [] files=dFile.listFiles(filter);
}
*/
/* ======================================================================== */
......@@ -32,7 +33,7 @@ public class CalibrationFileManagement {
return selectDirectoryOrFile(false, save,true, title, button, filter,defaultPath); // always open dialog
}
/**
*
*
* @param smart if true, and defaultPath matches criteria, return it and do not open dialog
* @param save file/directory for writing, new OK
* @param title Dialog title
......@@ -89,7 +90,7 @@ public class CalibrationFileManagement {
}
if ((dir==null) || (!dir.exists())) {
if (DEFAULT_DIRECTORY!=null) {
defaultPath = DEFAULT_DIRECTORY;
defaultPath = DEFAULT_DIRECTORY;
dir = new File(defaultPath);
}
}
......@@ -106,9 +107,9 @@ public class CalibrationFileManagement {
JFileChooser fc= new JFileChooser();
fc.setFileSelectionMode(directory?JFileChooser.DIRECTORIES_ONLY:JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(true);
if ((title!=null) && (title.length()>0)) fc.setDialogTitle(title);
if ((button!=null) && (button.length()>0)) fc.setApproveButtonText(button);
if (filter!=null) fc.setFileFilter(filter) ;
if ((title!=null) && (title.length()>0)) fc.setDialogTitle(title);
if ((button!=null) && (button.length()>0)) fc.setApproveButtonText(button);
if (filter!=null) fc.setFileFilter(filter) ;
if (dir!=null) fc.setCurrentDirectory(dir);
fc.setSelectedFiles(files);
int returnVal = save?(fc.showSaveDialog(IJ.getInstance())):(fc.showOpenDialog(IJ.getInstance()));
......@@ -141,8 +142,8 @@ public class CalibrationFileManagement {
(defaultPath.length()>1) && // skip "/"
save &&
!dir.exists()) dir.mkdirs();
// see if defaultPath matches
if (smart &&
(dir!=null) &&
......@@ -155,7 +156,7 @@ public class CalibrationFileManagement {
if ((dir==null) || (!dir.exists())) {
if (DEFAULT_DIRECTORY!=null) {
defaultPath = DEFAULT_DIRECTORY;
defaultPath = DEFAULT_DIRECTORY;
dir = new File(defaultPath);
}
}
......@@ -172,17 +173,17 @@ public class CalibrationFileManagement {
JFileChooser fc= new JFileChooser();
fc.setFileSelectionMode(directory?JFileChooser.DIRECTORIES_ONLY:JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
if ((title!=null) && (title.length()>0)) fc.setDialogTitle(title);
if ((button!=null) && (button.length()>0)) fc.setApproveButtonText(button);
if (filter!=null) fc.setFileFilter(filter) ;
if ((title!=null) && (title.length()>0)) fc.setDialogTitle(title);
if ((button!=null) && (button.length()>0)) fc.setApproveButtonText(button);
if (filter!=null) fc.setFileFilter(filter) ;
if (dir!=null) fc.setCurrentDirectory(dir);
int returnVal = save?(fc.showSaveDialog(IJ.getInstance())):(fc.showOpenDialog(IJ.getInstance()));
if (returnVal!=JFileChooser.APPROVE_OPTION) return null;
DEFAULT_DIRECTORY=fc.getCurrentDirectory().getPath();
return fc.getSelectedFile().getPath();
}
public static void saveStringToFile (String path,String data){
public static void saveStringToFile (String path,String data){
BufferedWriter writer = null;
try {
writer = new BufferedWriter( new FileWriter( path));
......@@ -191,7 +192,7 @@ public class CalibrationFileManagement {
} catch ( IOException e) {
String msg = e.getMessage();
if (msg==null || msg.equals("")) msg = ""+e;
IJ.showMessage("Error",msg);
IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg);
}
finally {
......@@ -205,7 +206,7 @@ public class CalibrationFileManagement {
}
/* ======================================================================== */
static class MultipleExtensionsFileFilter extends FileFilter implements FilenameFilter {
public static class MultipleExtensionsFileFilter extends FileFilter implements FilenameFilter {
protected String [] patterns; // case insensitive
protected String description="JP4 files";
protected String prefix=""; // case sensitive
......@@ -222,25 +223,28 @@ public class CalibrationFileManagement {
public MultipleExtensionsFileFilter (String [] patterns) {
this.patterns=patterns.clone();
}
public boolean accept (File file) {
int i;
@Override
public boolean accept (File file) {
int i;
String name=file.getName();
if (file.isDirectory()) return true;
if (!name.startsWith(this.prefix)) return false; // empty prefix OK
for (i=0;i<patterns.length;i++) {
if (name.toLowerCase().endsWith(patterns[i].toLowerCase())) return true;
}
return false;
return false;
}
public boolean accept (File dir, String name) { // directory - don't care here, only name
@Override
public boolean accept (File dir, String name) { // directory - don't care here, only name
if (!name.startsWith(this.prefix)) return false; // empty prefix OK
for (int i=0;i<patterns.length;i++) {
if (name.toLowerCase().endsWith(patterns[i].toLowerCase())) return true;
}
return false;
return false;
}
public String getDescription() {
@Override
public String getDescription() {
return description;
}
}
......
package com.elphel.imagej.calibration;
/**
**
** CalibrationHardwareInterface.jave - hardware-related part (cameras, focusing motors,
......@@ -69,6 +70,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import com.elphel.imagej.common.PolynomialApproximation;
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
import Jama.Matrix;
......@@ -738,8 +743,15 @@ public class CalibrationHardwareInterface {
IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg);
}
String sTemperature=((Node) (((Node) dom.getDocumentElement().getElementsByTagName("sensorTemperature").item(0)).getChildNodes().item(0))).getNodeValue();
String sTemperature=null;
if ((dom.getDocumentElement().getElementsByTagName("sensorTemperature").item(0))!=null){
sTemperature=((Node) (((Node) dom.getDocumentElement().getElementsByTagName("sensorTemperature").item(0)).getChildNodes().item(0))).getNodeValue();
}else{
sTemperature= "0.0";
}
// remove opening and closing "
if (sTemperature==null){
String msg="Could not read sensor temperature";
......
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** Crosstalk_Deconv.java
......
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** deBayerScissors.java
......@@ -28,12 +29,15 @@
import ij.process.*;
import ij.plugin.filter.GaussianBlur;
import java.util.HashSet;
public class deBayerScissors {
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
public class DeBayerScissors {
private PolarSpectrums pol_instace=null;
private double [][][] lopass=null;
private int size;
private double lastMidEnergy; // last midrange spectral energy
private showDoubleFloatArrays SDFA_instance; // just for debugging?
private ShowDoubleFloatArrays SDFA_instance; // just for debugging?
private DoubleFHT fht_instance;
private int [][] aliasMapRedBlue={
{-2,-2},{-2,-1},{-2,0},{-2,1},
......@@ -43,7 +47,7 @@ public class deBayerScissors {
private int [][][][] speedTable = null;
public double getMidEnergy() {return lastMidEnergy; } // instead of the DOUBLE_DEBUG_RESULT
public deBayerScissors(
public DeBayerScissors(
int isize, // size of the square array, centar is at size/2, size/2, only top half+line will be used
double polarStep, // maximal step in pixels on the maxRadius for 1 angular step (i.e. 0.5)
double debayer_width_green, // result green mask mpy by scaled default (diamond)
......@@ -52,7 +56,7 @@ public class deBayerScissors {
double debayer_width_redblue_clones){// green mask when applied to red/blue, clones
size=isize;
fht_instance= new DoubleFHT();
SDFA_instance= new showDoubleFloatArrays();
SDFA_instance= new ShowDoubleFloatArrays();
pol_instace=new PolarSpectrums(size, // size of the square array, centar is at size/2, size/2, only top half+line will be used
Math.PI,
size/2-2, // width of the polar array - should be <= size/2-2
......
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** DebayerScissors.java
**
** Frequency-domain debosaic methods for aberration correction for Eyesis4pi
**
**
**
** Copyright (C) 2012 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
**
** DebayerScissors.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
......@@ -25,28 +26,32 @@
**
*/
import ij.IJ;
import ij.ImageStack;
import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;