Commit 3344eaf3 authored by Andrey Filippov's avatar Andrey Filippov

more refactoring

parent 446646b6
package com.elphel.imagej.common;
/**
* The code below is extracted form ImageJ plugin GaussianBlur.java, stripped of ImageProcessor and used (double) instead of (float) arrays.
* The following are notes from the original file:
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** Aberration_Calibration.java
......@@ -59,6 +60,11 @@ import java.util.regex.Pattern;
// TODO: modify methods that depend on it, use class CalibrationFileManagement
import javax.swing.JFileChooser;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/
import ij.IJ;
import ij.ImageJ;
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** Aberration_Correction.java
......@@ -51,6 +52,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
//import javax.swing.SwingUtilities;
//import javax.swing.UIManager;
......
/**
** -----------------------------------------------------------------------------**
** 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.dp;
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 {
/**
......
package com.elphel.imagej.dp;
/**
**
** AlignmentCorrection - try to apply minor adjustments to the misaligned camera
......@@ -23,6 +24,9 @@
*/
import java.util.ArrayList;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
//import GeometryCorrection.CorrVector;
import Jama.Matrix;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
/**
** BiCamDSI - Building DSI using correlation between two quad cameras
**
......@@ -23,6 +24,8 @@
import java.util.ArrayList;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class BiCamDSI {
TileNeibs tnImage; // = new TileNeibs(tilesX, tilesY)
......
package com.elphel.imagej.dp;
/**
**
** BiQuadParameters - parameters defining Operation of a two quad camera rig
......
package com.elphel.imagej.dp;
/**
** BiCamScan - class to represent multiple bi-quad camera measurements
**
......@@ -25,6 +26,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class BiScan {
final static double THRESHOLD_LIN = 1.0E-20; // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail)
final static double THRESHOLD_QUAD = 1.0E-30; // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** BlueLeak.java
......@@ -29,6 +30,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class BlueLeak {
private double [][] rgb_in;
private double [] yrg;
......
package com.elphel.imagej.dp;
/**
**
** CLTPass3d - A single processing "pass" over the image set. May be both actual
......
package com.elphel.imagej.dp;
/**
**
** CalibrationHardwareInterface.jave - hardware-related part (cameras, focusing motors,
......@@ -69,6 +70,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
import Jama.Matrix;
......
package com.elphel.imagej.dp;
/**
**
** Conflict - Represent a "conflit" between connected supertiles
......
package com.elphel.imagej.dp;
/**
**
** Conflicts - Represent "conflicts" (instances of Conflict) between connected supertiles
......
package com.elphel.imagej.dp;
/**
**
** ConnectionCosts - calculate and incrementally update cost of supertile connections
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** CorrectionColorProc.java
......@@ -28,7 +29,9 @@
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.showDoubleFloatArrays;
import ij.ImageStack;
import ij.gui.GenericDialog;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** CorrectionDenoise.java
......@@ -30,6 +31,10 @@ import ij.ImageStack;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class CorrectionDenoise {
showDoubleFloatArrays SDFA_INSTANCE= new showDoubleFloatArrays();
......
package com.elphel.imagej.dp;
import java.util.ArrayList;
import com.elphel.imagej.common.showDoubleFloatArrays;
/**
**
** Correlation2d - Handle 2-d (phase) correlations, combining multiple-pair data
......
package com.elphel.imagej.dp;
import java.util.ArrayList;
import Jama.Matrix;
......
package com.elphel.imagej.dp;
/**
**
** Correlation2dLMA - Fit multi - baseline correaltion pairs to the model
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** Crosstalk_Deconv.java
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** DebayerScissors.java
......@@ -32,6 +33,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class DebayerScissors {
// showDoubleFloatArrays SDFA_INSTANCE= new showDoubleFloatArrays();
......
package com.elphel.imagej.dp;
import ij.IJ;
import ij.ImagePlus;
......@@ -11,6 +12,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class DenseCorrespondence {
public double [][] disparityScales= null; // for each image - a pair of {scaleX, scaleY} or null if undefined (interSensor has the same)
......
package com.elphel.imagej.dp;
/**
**
** DisparityProcessor
......@@ -25,6 +26,8 @@
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class DisparityProcessor {
static int [] corn_side_neib = { // of +1 - up (N), +2 - up-right - NE, ... +0x80 - NW
0b00011100, // top left corner
......
package com.elphel.imagej.dp;
/*
**
** DistortionCalibrationData.java
......@@ -34,6 +35,10 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.configuration.XMLConfiguration;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
......
package com.elphel.imagej.dp;
/*
**
** Distortions.java - Calculate lens distortion parameters from the pattern image
......@@ -43,6 +44,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
import Jama.Matrix;
//import src.java.org.apache.commons.configuration.*;
......
package com.elphel.imagej.dp;
/**
**
** DttRad2 - Calculate DCT types II and IV for n=2^t and n*n 2-d
......
package com.elphel.imagej.dp;
/**
**
** ExtendSurfaces predict disparity in the unknown areas
......@@ -25,6 +26,8 @@
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class ExtendSurfaces {
TileProcessor tp;
......
package com.elphel.imagej.dp;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
......@@ -18,6 +19,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
public class EyesisAberrations {
public double [][][][] pdfKernelMap=null;
JP46_Reader_camera JP4_INSTANCE= new JP46_Reader_camera(false);
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** EyesisCorrectionParameters.java
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** EyesisCorrections.java
......@@ -30,6 +31,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import ij.CompositeImage;
import ij.IJ;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
/**
**
** EyesisDCT - Process images with DTT-based methods (code specific to ImageJ plugin)
......@@ -25,6 +26,9 @@
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import ij.CompositeImage;
import ij.IJ;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** EyesisTiff.java
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** Eyesis_Correction.java
......@@ -70,7 +71,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import com.elphel.imagej.lwir.LwirReader;
import ij.CompositeImage;
......
package com.elphel.imagej.dp;
/**
**
** FactorConvKernel Split convolution kernel into small asymmetrical
......@@ -26,6 +27,9 @@
import java.util.ArrayList;
import java.util.Random;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import Jama.LUDecomposition;
import Jama.Matrix;
import ij.IJ;
......
package com.elphel.imagej.dp;
/**
**
** FocusingField.jave - save/restore/process sagittal/tangential PSF width
......@@ -42,6 +43,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import com.elphel.imagej.common.showDoubleFloatArrays;
//import Distortions.LMAArrays; // may still reuse?
import Jama.LUDecomposition;
import Jama.Matrix;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** GPUTileProcessor.java
......
package com.elphel.imagej.dp;
import java.util.ArrayList;
import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.showDoubleFloatArrays;
import Jama.Matrix;
import ij.IJ;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** Goniometer.java
......@@ -28,6 +29,8 @@
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
import ij.IJ;
import ij.ImagePlus;
import ij.gui.GenericDialog;
......
package com.elphel.imagej.dp;
/**
**
** ImageDtt - Process images with DTT-based methods
......@@ -23,6 +24,8 @@
*/
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
import Jama.Matrix;
import ij.ImageStack;
......
package com.elphel.imagej.dp;
/**
**
** ImageDttParameters - parameters defining TP operations (at first extra)
......
package com.elphel.imagej.dp;
/**
**
** LensAdjustment.jave - processing related to focus measurement/adjustment machine
......@@ -24,6 +25,8 @@
import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.common.showDoubleFloatArrays;
import ij.IJ;
import ij.ImagePlus;
import ij.gui.GenericDialog;
......
package com.elphel.imagej.dp;
import java.util.Arrays;
import java.util.Properties;
......
package com.elphel.imagej.dp;
/**
**
** LinkPlanes - manage links between supertile planes
......@@ -28,6 +29,8 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class LinkPlanes {
SuperTiles st;
public boolean plPreferDisparity; // = false;// Always start with disparity-most axis (false - lowest eigenvalue)
......
package com.elphel.imagej.dp;
/**
**
** LwirCamera.java - Control/image acquisition for LWIR cameras
......
package com.elphel.imagej.dp;
/**
** MLStats - Generate reports over multiple scenes
**
......@@ -39,6 +40,10 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Properties;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** MTF_Bayer.java
......
package com.elphel.imagej.dp;
/**
**
** MacroCorrelation handle "correlations of correlations" - tiles instead of pixels
......@@ -28,6 +29,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class MacroCorrelation {
TileProcessor tp; // pixel tile processor
......
package com.elphel.imagej.dp;
/**
**
** MatchSimulatedPattern.java - Determine simulation pattern parameters to match
......@@ -35,6 +36,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/
import ij.IJ;
......
package com.elphel.imagej.dp;
/**
** MeasuredLayer - per-tile measured disparity/strength pairs,
** multiple layers can be used for 4-disparity and 2 (hor/vert) pairs
......
package com.elphel.imagej.dp;
/*
**
** PatternParameters.java
......@@ -30,6 +31,8 @@ import ij.io.Opener;
import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.jp4.JP46_Reader_camera;
/* gridGeometry:
* [v][u][0] - x(mm) of the node(u,v), right (looking to the wall) - positive
* [v][u][1] - y(mm) of the node(u,v), down - positive
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** PixelMapping.java
......@@ -37,6 +38,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.showDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.Matrix;
import ij.IJ;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
/**
** -----------------------------------------------------------------------------**
** PolarSpectrums.java
......
package com.elphel.imagej.dp;
/**
** PoleProcessor - handling poles like street lights and other vertical objects
** common in artificial environments
......@@ -28,6 +29,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.showDoubleFloatArrays;
public class PoleProcessor {
final static double THRESHOLD_LIN = 1.0E-20; // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail)
......
package com.elphel.imagej.dp;
import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog;
......