Commit 73ae347c authored by Andrey Filippov's avatar Andrey Filippov

More refactoring

parent d7e96c38
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** Aberration_Calibration.java
......@@ -63,6 +63,29 @@ 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.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.CalibrationHardwareInterface;
import com.elphel.imagej.dp.DistortionCalibrationData;
import com.elphel.imagej.dp.DistortionProcessConfiguration;
import com.elphel.imagej.dp.Distortions;
import com.elphel.imagej.dp.EyesisCameraParameters;
import com.elphel.imagej.dp.LensDistortionParameters;
import com.elphel.imagej.dp.PolynomialApproximation;
import com.elphel.imagej.dp.SFEPhases;
import com.elphel.imagej.dp.SimulationPattern;
import com.elphel.imagej.dp.WavePatternGenerator;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
import com.elphel.imagej.dp.CalibrationHardwareInterface.CamerasInterface;
import com.elphel.imagej.dp.CalibrationHardwareInterface.FocusingMotors;
import com.elphel.imagej.dp.CalibrationHardwareInterface.GoniometerMotors;
import com.elphel.imagej.dp.CalibrationHardwareInterface.LaserPointers;
import com.elphel.imagej.dp.CalibrationHardwareInterface.PowerControl;
import com.elphel.imagej.dp.CalibrationHardwareInterface.UVLEDandLasers;
import com.elphel.imagej.dp.Distortions.RefineParameters;
import com.elphel.imagej.dp.SFEPhases.Defect;
import com.elphel.imagej.dp.SFEPhases.SensorDefects;
import com.elphel.imagej.dp.SimulationPattern.SimulParameters;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** aberrations.java
......@@ -53,7 +53,7 @@ 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 {
/**
*
*/
......@@ -321,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) {
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** deBayerScissors.java
......@@ -32,7 +32,7 @@ import java.util.HashSet;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
public class deBayerScissors {
public class DeBayerScissors {
private PolarSpectrums pol_instace=null;
private double [][][] lopass=null;
private int size;
......@@ -47,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)
......
package com.elphel.imagej.dp;
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
......@@ -26,31 +26,32 @@ package com.elphel.imagej.dp;
**
*/
import ij.IJ;
import ij.ImageStack;
import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.dp.EyesisCorrectionParameters;
import ij.IJ;
import ij.ImageStack;
public class DebayerScissors {
public class DebayerScissorsClass {
// showDoubleFloatArrays SDFA_INSTANCE= new showDoubleFloatArrays();
public AtomicInteger stopRequested=null; // 1 - stop now, 2 - when convenient
double [] debayerEnergy;
int debayerEnergyWidth;
int debugLevel=1;
public DebayerScissors(AtomicInteger stopRequested){
public DebayerScissorsClass(AtomicInteger stopRequested){
this.stopRequested=stopRequested;
}
double [] getDebayerEnergy() {return this.debayerEnergy;}
int getDebayerEnergyWidth() {return this.debayerEnergyWidth;}
void setDebug(int debugLevel){this.debugLevel=debugLevel;}
public double [] getDebayerEnergy() {return this.debayerEnergy;}
public int getDebayerEnergyWidth() {return this.debayerEnergyWidth;}
public void setDebug(int debugLevel){this.debugLevel=debugLevel;}
// uses global OUT_PIXELS to accumulate results
public ImageStack aliasScissorsStack (
final ImageStack imageStack, // stack with 3 colors/slices with the image
......@@ -102,13 +103,13 @@ public class DebayerScissors {
final Thread[] threads = newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
final int numberOfKernels=tilesY*tilesX;
int indx,dx,dy,tx,ty,li;
final int [] nonOverlapSeq = new int[numberOfKernels];
int [] nextFirstFindex=new int[4];
indx = 0;
li=0;
for (dy=0;dy<2;dy++) for (dx=0;dx<2;dx++) {
for (ty=dy; ty < tilesY; ty+=2) for (tx=dx; tx < tilesX; tx+=2){
nonOverlapSeq[indx++] = ty*tilesX + tx;
......@@ -127,7 +128,8 @@ public class DebayerScissors {
}
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
@Override
public void run() {
double [][] tile= new double[nChn][debayerParameters.size * debayerParameters.size ];
double [][] both_masks;
float [][] pixels= new float[nChn][];
......@@ -136,15 +138,15 @@ public class DebayerScissors {
DoubleFHT fht_instance = new DoubleFHT(); // provide DoubleFHT instance to save on initializations (or null)
ShowDoubleFloatArrays SDFA_instance=null; // just for debugging?
deBayerScissors debayer_instance=new deBayerScissors( debayerParameters.size, // size of the square array, centar is at size/2, size/2, only top half+line will be used
DeBayerScissors debayer_instance=new DeBayerScissors( debayerParameters.size, // size of the square array, centar is at size/2, size/2, only top half+line will be used
debayerParameters.polarStep, // maximal step in pixels on the maxRadius for 1 angular step (i.e. 0.5)
debayerParameters.debayerRelativeWidthGreen, // result green mask mpy by scaled default (diamond)
debayerParameters.debayerRelativeWidthRedblue, // result red/blue mask mpy by scaled default (square)
debayerParameters.debayerRelativeWidthRedblueMain, // green mask when applied to red/blue, main (center)
debayerParameters.debayerRelativeWidthRedblueClones);// green mask when applied to red/blue, clones
debayerParameters.debayerRelativeWidthRedblueClones);// green mask when applied to red/blue, clones
// for (int nTile0 = ai.getAndIncrement(); nTile0 < numberOfKernels; nTile0 = ai.getAndIncrement()) {
for (int nTile0 = ai.getAndIncrement(); nTile0 < aStopIndex.get(); nTile0 = ai.getAndIncrement()) {
int nTile = nonOverlapSeq[nTile0];
tileY = nTile /tilesX;
tileX = nTile % tilesX;
......@@ -209,13 +211,14 @@ public class DebayerScissors {
tileY*step); // top corner Y
}
if ((tileY==yTileDebug) && (tileX==xTileDebug) && (SDFA_instance!=null)) SDFA_instance.showArrays (tile.clone(),debayerParameters.size,debayerParameters.size, "B00");
final int numFinished=tilesFinishedAtomic.getAndIncrement();
// final double dprogr= (1.0+numFinished)/numberOfKernels;
if (numFinished % (numberOfKernels/50+1) == 0) {
// System.out.print(numFinished);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
@Override
public void run() {
// System.out.println(" --- "+numFinished+"("+numberOfKernels+"): "+dprogr);
IJ.showProgress(numFinished, numberOfKernels);
}
......@@ -224,7 +227,7 @@ public class DebayerScissors {
}
}
};
}
}
startAndJoin(threads);
IJ.showProgress(tilesFinishedAtomic.get(), numberOfKernels);
}
......@@ -236,7 +239,7 @@ public class DebayerScissors {
for (chn=0;chn<nChn;chn++) {
outStack.addSlice(imageStack.getSliceLabel(chn+1), outPixles[chn]);
}
debayerEnergyWidth= (debayerEnergy!=null)?tilesX:0; // for the image to be displayed externally
debayerEnergyWidth= (debayerEnergy!=null)?tilesX:0; // for the image to be displayed externally
if (globalDebugLevel>0) System.out.println("Reducing sampling aliases done in "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
return outStack;
}
......@@ -291,7 +294,7 @@ public class DebayerScissors {
}
}
/* ======================================================================== */
/* accumulate square tile to the pixel array (tile may extend beyond the array, will be cropped) */
synchronized void accumulateSquareTile(
......@@ -341,7 +344,7 @@ public class DebayerScissors {
}
}
}
synchronized void accumulateSquareTile(
double [] pixels, // float pixels array to accumulate tile
double [] tile, // data to accumulate to the pixels array
......@@ -378,10 +381,10 @@ public class DebayerScissors {
return mask;
}
/* ======================================================================== */
/* ======================================================================== */
/* Create a Thread[] array as large as the number of processors available.
* From Stephan Preibisch's Multithreading.java class. See:
......@@ -405,7 +408,7 @@ public class DebayerScissors {
}
try
{
{
for (int ithread = 0; ithread < threads.length; ++ithread)
threads[ithread].join();
} catch (InterruptedException ie)
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
......@@ -22,6 +22,13 @@ 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.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.DistortionCalibrationData;
import com.elphel.imagej.dp.Distortions;
import com.elphel.imagej.dp.SimulationPattern;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
import com.elphel.imagej.dp.SimulationPattern.SimulParameters;
import com.elphel.imagej.jp4.JP46_Reader_camera;
public class EyesisAberrations {
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/*
**
** FittingStrategy.java
......@@ -37,6 +37,11 @@ import java.util.Set;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import com.elphel.imagej.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.DistortionCalibrationData;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
import ij.IJ;
import ij.gui.GenericDialog;
import ij.text.TextWindow;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
**
** FocusingField.jave - save/restore/process sagittal/tangential PSF width
......@@ -44,6 +44,9 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
//import Distortions.LMAArrays; // may still reuse?
import Jama.LUDecomposition;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** Goniometer.java
......@@ -30,6 +30,16 @@ import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.dp.CalibrationHardwareInterface;
import com.elphel.imagej.dp.DistortionCalibrationData;
import com.elphel.imagej.dp.DistortionProcessConfiguration;
import com.elphel.imagej.dp.Distortions;
import com.elphel.imagej.dp.EyesisCameraParameters;
import com.elphel.imagej.dp.SimulationPattern;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.CalibrationHardwareInterface.CamerasInterface;
import com.elphel.imagej.dp.CalibrationHardwareInterface.GoniometerMotors;
import com.elphel.imagej.dp.SimulationPattern.SimulParameters;
import ij.IJ;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
**
** LensAdjustment.jave - processing related to focus measurement/adjustment machine
......@@ -26,6 +26,9 @@ import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.dp.SimulationPattern;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.SimulationPattern.SimulParameters;
import ij.IJ;
import ij.ImagePlus;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** MTF_Bayer.java
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
**
** MatchSimulatedPattern.java - Determine simulation pattern parameters to match
......@@ -39,6 +39,10 @@ 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.dp.PolynomialApproximation;
import com.elphel.imagej.dp.SimulationPattern;
import com.elphel.imagej.dp.WindowTools;
import com.elphel.imagej.dp.SimulationPattern.SimulParameters;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/*
**
** PatternParameters.java
......@@ -32,6 +32,8 @@ import ij.io.Opener;
import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
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
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** PixelMapping.java
......@@ -41,6 +41,9 @@ 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.dp.CalibrationFileManagement;
import com.elphel.imagej.dp.EyesisTiff;
import com.elphel.imagej.dp.CalibrationFileManagement.MultipleExtensionsFileFilter;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.Matrix;
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** PolarSpectrums.java
......
package com.elphel.imagej.dp;
package com.elphel.imagej.calibration;
/**
** -----------------------------------------------------------------------------**
** focus_tuning.java
......
/**
*
*/
/**
* @author eyesis
*
*/
package com.elphel.imagej.calibration;
\ No newline at end of file
......@@ -52,6 +52,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import com.elphel.imagej.calibration.Aberration_Calibration;
import com.elphel.imagej.calibration.DeBayerScissors;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
......@@ -644,7 +646,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6;
if (amps!=null) amps[i]=FHT_INSTANCE.calculateAmplitude(pixels_debayer[i]);
}
deBayerScissors debayer_instance=new deBayerScissors(DEBAYER_PARAMETERS.size, // size of the square array, center is at size/2, size/2, only top half+line will be used
DeBayerScissors debayer_instance=new DeBayerScissors(DEBAYER_PARAMETERS.size, // size of the square array, center is at size/2, size/2, only top half+line will be used
DEBAYER_PARAMETERS.polarStep, // maximal step in pixels on the maxRadius for 1 angular step (i.e. 0.5)
DEBAYER_PARAMETERS.debayerRelativeWidthGreen, // result green mask mpy by scaled default (diamond)
DEBAYER_PARAMETERS.debayerRelativeWidthRedblue, // result red/blue mask mpy by scaled default (square)
......@@ -2517,7 +2519,7 @@ if (PROCESS_PARAMETERS.saveSettings) saveProperties(FILE_PARAMETERS.resultsDirec
DoubleFHT fht_instance = new DoubleFHT(); // provide DoubleFHT instance to save on initializations (or null)
ShowDoubleFloatArrays SDFA_instance=null; // just for debugging?
deBayerScissors debayer_instance=new deBayerScissors( debayerParameters.size, // size of the square array, centar is at size/2, size/2, only top half+line will be used
DeBayerScissors debayer_instance=new DeBayerScissors( debayerParameters.size, // size of the square array, centar is at size/2, size/2, only top half+line will be used
debayerParameters.polarStep, // maximal step in pixels on the maxRadius for 1 angular step (i.e. 0.5)
debayerParameters.debayerRelativeWidthGreen, // result green mask mpy by scaled default (diamond)
debayerParameters.debayerRelativeWidthRedblue, // result red/blue mask mpy by scaled default (square)
......
package com.elphel.imagej.dp;
import ij.IJ;
import ij.io.OpenDialog;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
......@@ -11,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;
......@@ -23,9 +23,9 @@ public class CalibrationFileManagement {
System.out.println("Error: "+msg);
return null;
}
File [] files=dFile.listFiles(filter);
File [] files=dFile.listFiles(filter);
}
*/
/* ======================================================================== */
......@@ -33,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
......@@ -90,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);
}
}
......@@ -107,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()));
......@@ -142,8 +142,8 @@ public class CalibrationFileManagement {
(defaultPath.length()>1) && // skip "/"
save &&
!dir.exists()) dir.mkdirs();
// see if defaultPath matches
if (smart &&
(dir!=null) &&
......@@ -156,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);
}
}
......@@ -173,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));
......@@ -192,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 {
......@@ -206,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
......@@ -223,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;
}
}
......
......@@ -70,6 +70,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import com.elphel.imagej.calibration.FocusingField;
import com.elphel.imagej.calibration.LensAdjustment;
import com.elphel.imagej.calibration.MatchSimulatedPattern;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.LUDecomposition;
......
......@@ -37,6 +37,9 @@ import java.awt.event.*;
import ij.plugin.frame.*;
import java.util.Random;
import com.elphel.imagej.calibration.Aberration_Calibration;
import java.util.Arrays;
import ij.text.*;
......
......@@ -35,6 +35,9 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.configuration.XMLConfiguration;
import com.elphel.imagej.calibration.EyesisAberrations;
import com.elphel.imagej.calibration.MatchSimulatedPattern;
import com.elphel.imagej.calibration.PatternParameters;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.jp4.JP46_Reader_camera;
......@@ -115,7 +118,7 @@ import ij.text.TextWindow;
public double diameter=0.0;
public int [] UVShiftRot={0,0,0}; // shift and rotation of the grid
final int contrastIndex=2;
int getSetNumber(){return this.setNumber;}
public int getSetNumber(){return this.setNumber;}
public GridImageParameters(int index){
this.imgNumber=index;
}
......@@ -1521,7 +1524,7 @@ import ij.text.TextWindow;
IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg);
}
int getNumberOfEstimated(boolean enabledOnly) {
public int getNumberOfEstimated(boolean enabledOnly) {
int numEstimated=0;
if (this.gIS==null) return 0;
for (int i=0;i<this.gIS.length;i++) if (this.gIS[i].imageSet!=null){
......@@ -1533,7 +1536,7 @@ import ij.text.TextWindow;
return numEstimated;
}
int [] getNumberOfEstimatedPerStation(boolean enabledOnly) {
public int [] getNumberOfEstimatedPerStation(boolean enabledOnly) {
int [] numEstimated=new int [this.eyesisCameraParameters.numStations];
for (int i=0;i<numEstimated.length;i++) numEstimated[i]=0;
if (this.gIS!=null){
......@@ -1547,59 +1550,59 @@ import ij.text.TextWindow;
}
int getNumEnabled(){
public int getNumEnabled(){
int num=0;
for (int i=0;i<this.gIP.length;i++) if ((this.gIP[i]!=null) && this.gIP[i].enabled) num++;
return num;
}
int getNumNewEnabled(){
public int getNumNewEnabled(){
int num=0;
for (int i=0;i<this.gIP.length;i++) if ((this.gIP[i]!=null) && this.gIP[i].enabled && this.gIP[i].newEnabled) num++;
return num;
}