Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
7c9b8ed9
Commit
7c9b8ed9
authored
Jun 25, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addin illustration generation
parent
f68fa78e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
527 additions
and
32 deletions
+527
-32
Aberration_Calibration.java
...com/elphel/imagej/calibration/Aberration_Calibration.java
+95
-10
CalibrationIllustration.java
...om/elphel/imagej/calibration/CalibrationIllustration.java
+278
-0
CalibrationIllustrationParameters.java
...imagej/calibration/CalibrationIllustrationParameters.java
+101
-0
DistortionCalibrationData.java
.../elphel/imagej/calibration/DistortionCalibrationData.java
+0
-10
EyesisAberrations.java
...java/com/elphel/imagej/calibration/EyesisAberrations.java
+20
-0
EyesisCorrections.java
.../java/com/elphel/imagej/correction/EyesisCorrections.java
+4
-4
LwirReaderParameters.java
...ain/java/com/elphel/imagej/lwir/LwirReaderParameters.java
+22
-2
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+2
-2
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+2
-2
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+3
-2
No files found.
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java
View file @
7c9b8ed9
...
@@ -112,7 +112,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
...
@@ -112,7 +112,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
private Panel panelGoniometer;
private Panel panelGoniometer;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelLWIR;
private Panel panelLWIR;
// private Panel panelLWIR16
;
private Panel panelIllustrations
;
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
JP46_Reader_camera JP4_INSTANCE;
JP46_Reader_camera JP4_INSTANCE;
...
@@ -597,6 +597,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -597,6 +597,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
1 // public int debugLevel=1;
1 // public int debugLevel=1;
);
);
public static CalibrationIllustration CALIBRATION_ILLUSTRATION = null;
public static RefineParameters REFINE_PARAMETERS = new RefineParameters();
public static RefineParameters REFINE_PARAMETERS = new RefineParameters();
public static DistortionCalibrationData DISTORTION_CALIBRATION_DATA=null;
public static DistortionCalibrationData DISTORTION_CALIBRATION_DATA=null;
// public static FittingStrategy FITTING_STRATEGY=null;
// public static FittingStrategy FITTING_STRATEGY=null;
...
@@ -666,7 +667,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -666,7 +667,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
public static Goniometer GONIOMETER=null;
public static Goniometer GONIOMETER=null;
public static LwirReaderParameters LWIR_PARAMETERS = new LwirReaderParameters();
public static LwirReaderParameters LWIR_PARAMETERS = new LwirReaderParameters();
public static CalibrationIllustrationParameters CALIBRATION_ILLUSTRATION_PARAMETERS = new CalibrationIllustrationParameters(LWIR_PARAMETERS);
// new CalibrationHardwareInterface.LaserPointers();
// new CalibrationHardwareInterface.LaserPointers();
public class SyncCommand{
public class SyncCommand{
public boolean isRunning= false;
public boolean isRunning= false;
...
@@ -687,7 +688,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -687,7 +688,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
addKeyListener(IJ.getInstance());
addKeyListener(IJ.getInstance());
// setLayout(new GridLayout(ADVANCED_MODE?8:5, 1));
// setLayout(new GridLayout(ADVANCED_MODE?8:5, 1));
// setLayout(new GridLayout(ADVANCED_MODE?9:6, 1));
// setLayout(new GridLayout(ADVANCED_MODE?9:6, 1));
setLayout(new GridLayout(ADVANCED_MODE?2
1:21
, 1));
setLayout(new GridLayout(ADVANCED_MODE?2
2:22
, 1));
Color color_configure= new Color(200, 200,160);
Color color_configure= new Color(200, 200,160);
Color color_process= new Color(180, 180, 240);
Color color_process= new Color(180, 180, 240);
Color color_conf_process= new Color(180, 240, 240);
Color color_conf_process= new Color(180, 240, 240);
...
@@ -1064,6 +1065,13 @@ if (MORE_BUTTONS) {
...
@@ -1064,6 +1065,13 @@ if (MORE_BUTTONS) {
addButton("Manual hint", panelLWIR,color_configure);
addButton("Manual hint", panelLWIR,color_configure);
add(panelLWIR);
add(panelLWIR);
panelIllustrations= new Panel();
panelIllustrations.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("Illustrations Configure", panelIllustrations,color_configure);
addButton("Illustrations", panelIllustrations,color_bundle);
add(panelIllustrations);
pack();
pack();
GUI.center(this);
GUI.center(this);
setVisible(true);
setVisible(true);
...
@@ -9372,6 +9380,77 @@ if (MORE_BUTTONS) {
...
@@ -9372,6 +9380,77 @@ if (MORE_BUTTONS) {
selectLwirGrids(LWIR_PARAMETERS);
selectLwirGrids(LWIR_PARAMETERS);
return;
return;
}
}
/* ======================================================================== */
if (label.equals("Illustrations Configure")) {
CALIBRATION_ILLUSTRATION_PARAMETERS.showJDialog();
return;
}
/* ======================================================================== */
if (label.equals("Illustrations")) {
if (LENS_DISTORTIONS==null) {
IJ.showMessage("LENS_DISTORTION is not set"); // to use all grids imported
return;
}
EYESIS_ABERRATIONS.setDistortions(LENS_DISTORTIONS);
if (EYESIS_ABERRATIONS.aberrationParameters.illustrationsDirectory.length()>0){
File dFile=new File(EYESIS_ABERRATIONS.aberrationParameters.illustrationsDirectory);
if (!dFile.isDirectory() && !dFile.mkdirs()) {
String msg="Failed to create directory "+EYESIS_ABERRATIONS.aberrationParameters.illustrationsDirectory;
IJ.showMessage("Warning",msg);
System.out.println("Warning: "+msg);
EYESIS_ABERRATIONS.aberrationParameters.illustrationsDirectory=""; // start over with selecting directory
}
}
String configPath=EYESIS_ABERRATIONS.aberrationParameters.selectIllustrationsDirectory(
true,
EYESIS_ABERRATIONS.aberrationParameters.illustrationsDirectory,
true);
if (configPath==null){
String msg="No illustrations directory selected, command aborted";
System.out.println("Warning: "+msg);
IJ.showMessage("Warning",msg);
return;
}
configPath+=Prefs.getFileSeparator()+"config-illustrations";
try {
saveTimestampedProperties(
configPath, // full path or null
null, // use as default directory if path==null
true,
PROPERTIES);
} catch (Exception e){
String msg="Failed to save configuration to "+configPath+", command aborted";
System.out.println("Error: "+msg);
IJ.showMessage("Error",msg);
return;
}
if (CALIBRATION_ILLUSTRATION == null) {
CALIBRATION_ILLUSTRATION = new CalibrationIllustration(
CALIBRATION_ILLUSTRATION_PARAMETERS, // CalibrationIllustrationParameters illustrationParameters,
EYESIS_ABERRATIONS, // EyesisAberrations eyesisAberrations,
LENS_DISTORTIONS, // Distortions distortions,
SYNC_COMMAND.stopRequested, // AtomicInteger stopRequested,
MASTER_DEBUG_LEVEL); // int debug_level);
/*
CALIBRATION_ILLUSTRATION = new CalibrationIllustration(
LWIR_PARAMETERS, // LwirReaderParameters lwirReaderParameters,
LENS_DISTORTION_PARAMETERS, // LensDistortionParameters lensDistortionParameters,
PATTERN_PARAMETERS, // PatternParameters patternParameters,
REFINE_PARAMETERS, // RefineParameters refineParameters,
DISTORTION_PROCESS_CONFIGURATION, // DistortionProcessConfiguration distortionProcessConfiguration,
EYESIS_CAMERA_PARAMETERS, // EyesisCameraParameters eyesisCameraParameters,
SYNC_COMMAND.stopRequested, // AtomicInteger stopRequested,
MASTER_DEBUG_LEVEL); // int debug_level);
*/
}
// CALIBRATION_ILLUSTRATION.selectUsefulGrids();
CALIBRATION_ILLUSTRATION.convertSourceFiles();
return;
}
/* ======================================================================== */
/* ======================================================================== */
if (label.equals("Manual hint")) {
if (label.equals("Manual hint")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
...
@@ -10214,7 +10293,6 @@ if (MORE_BUTTONS) {
...
@@ -10214,7 +10293,6 @@ if (MORE_BUTTONS) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
// Maybe wrong ! Use folders that have at least all EO channels?
// Maybe wrong ! Use folders that have at least all EO channels?
// int min_files = lwirReaderParameters.getNumChannels();// 8; // use folders that have all 8 files
int [] type_map = lwirReaderParameters.getTypeMap(); // 0 - eo, 1 -0 lwir
int [] type_map = lwirReaderParameters.getTypeMap(); // 0 - eo, 1 -0 lwir
int lwir_chn0 = lwirReaderParameters.getLwirChn0();
int lwir_chn0 = lwirReaderParameters.getLwirChn0();
...
@@ -10242,8 +10320,6 @@ if (MORE_BUTTONS) {
...
@@ -10242,8 +10320,6 @@ if (MORE_BUTTONS) {
allornone_eo = gd.getNextBoolean();
allornone_eo = gd.getNextBoolean();
allornone_lwir = gd.getNextBoolean();
allornone_lwir = gd.getNextBoolean();
// String [] grid_extensions={".tif",".tiff"};
// String [] src_extensions={".tif",".tiff"};
String [] grid_extensions={".tiff"};
String [] grid_extensions={".tiff"};
String [] src_extensions={".tiff"};
String [] src_extensions={".tiff"};
MultipleExtensionsFileFilter gridFilter =
MultipleExtensionsFileFilter gridFilter =
...
@@ -10251,11 +10327,8 @@ if (MORE_BUTTONS) {
...
@@ -10251,11 +10327,8 @@ if (MORE_BUTTONS) {
MultipleExtensionsFileFilter sourceFilter =
MultipleExtensionsFileFilter sourceFilter =
new MultipleExtensionsFileFilter("",src_extensions,"Source calibration images");
new MultipleExtensionsFileFilter("",src_extensions,"Source calibration images");
// CalibrationFileManagement.DirectoryContentsFilter gridDirFilter =
// new CalibrationFileManagement.DirectoryContentsFilter (gridFilter, min_files, 0, null);
String [][] gridFileDirs= new String [numStations][];
String [][] gridFileDirs= new String [numStations][];
// int [][] gridUseTypes = new int [numStations][]; // +1 - use eo channels,+2 - use lwir channels (in pointed set)
boolean [][][] gridUseChn = new boolean [numStations][][]; // channels to use in each scene
boolean [][][] gridUseChn = new boolean [numStations][][]; // channels to use in each scene
String [] sourceStationDirs = new String [numStations]; // directories of the source files per station
String [] sourceStationDirs = new String [numStations]; // directories of the source files per station
...
@@ -11002,7 +11075,11 @@ if (MORE_BUTTONS) {
...
@@ -11002,7 +11075,11 @@ if (MORE_BUTTONS) {
ABERRATIONS_PARAMETERS.autoRestore=false;
ABERRATIONS_PARAMETERS.autoRestore=false;
// String confPath=loadProperties(null,PROCESS_PARAMETERS.kernelsDirectory, PROCESS_PARAMETERS.useXML, PROPERTIES);
// String confPath=loadProperties(null,PROCESS_PARAMETERS.kernelsDirectory, PROCESS_PARAMETERS.useXML, PROPERTIES);
String confPath = readPropertiesPath(null, PROCESS_PARAMETERS.kernelsDirectory,PROCESS_PARAMETERS.useXML);
String confPath = readPropertiesPath(null, PROCESS_PARAMETERS.kernelsDirectory,PROCESS_PARAMETERS.useXML);
PROPERTIES = readProperties( confPath, true, PROPERTIES);
Properties properties = readProperties( confPath, true, PROPERTIES);
if (properties == null) {
return;
}
PROPERTIES = properties; // readProperties( confPath, true, PROPERTIES);
getAllProperties(PROPERTIES);
getAllProperties(PROPERTIES);
if (DEBUG_LEVEL>0) System.out.println("Configuration parameters are restored from " + confPath);
if (DEBUG_LEVEL>0) System.out.println("Configuration parameters are restored from " + confPath);
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
...
@@ -16016,6 +16093,9 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16016,6 +16093,9 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
} else {
} else {
properties = new Properties();
properties = new Properties();
}
}
if (path == null) {
return null;
}
InputStream is;
InputStream is;
try {
try {
is = new FileInputStream(path);
is = new FileInputStream(path);
...
@@ -16151,6 +16231,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16151,6 +16231,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
boolean select_FOCUSING_FIELD=!select;
boolean select_FOCUSING_FIELD=!select;
boolean select_POWER_CONTROL=!select;
boolean select_POWER_CONTROL=!select;
boolean select_LWIR=!select;
boolean select_LWIR=!select;
boolean select_ILLUSTRATIONS=!select;
if (select) {
if (select) {
GenericDialog gd = new GenericDialog("Select parameters to save");
GenericDialog gd = new GenericDialog("Select parameters to save");
gd.addMessage("===== Individual parameters ======");
gd.addMessage("===== Individual parameters ======");
...
@@ -16193,6 +16274,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16193,6 +16274,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
gd.addCheckbox("FOCUSING_FIELD",select_FOCUSING_FIELD);
gd.addCheckbox("FOCUSING_FIELD",select_FOCUSING_FIELD);
gd.addCheckbox("POWER_CONTROL",select_POWER_CONTROL);
gd.addCheckbox("POWER_CONTROL",select_POWER_CONTROL);
gd.addCheckbox("LWIR",select_LWIR);
gd.addCheckbox("LWIR",select_LWIR);
gd.addCheckbox("Illustrations",select_ILLUSTRATIONS);
WindowTools.addScrollBars(gd);
WindowTools.addScrollBars(gd);
gd.showDialog();
gd.showDialog();
...
@@ -16236,6 +16318,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16236,6 +16318,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
select_FOCUSING_FIELD=gd.getNextBoolean();
select_FOCUSING_FIELD=gd.getNextBoolean();
select_POWER_CONTROL=gd.getNextBoolean();
select_POWER_CONTROL=gd.getNextBoolean();
select_LWIR=gd.getNextBoolean();
select_LWIR=gd.getNextBoolean();
select_ILLUSTRATIONS=gd.getNextBoolean();
}
}
if (select_MASTER_DEBUG_LEVEL) properties.setProperty("MASTER_DEBUG_LEVEL", MASTER_DEBUG_LEVEL+"");
if (select_MASTER_DEBUG_LEVEL) properties.setProperty("MASTER_DEBUG_LEVEL", MASTER_DEBUG_LEVEL+"");
...
@@ -16277,6 +16360,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16277,6 +16360,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
if ((select_FOCUSING_FIELD) && (FOCUSING_FIELD!=null)) FOCUSING_FIELD.setProperties("FOCUSING_FIELD.", properties);
if ((select_FOCUSING_FIELD) && (FOCUSING_FIELD!=null)) FOCUSING_FIELD.setProperties("FOCUSING_FIELD.", properties);
if (select_POWER_CONTROL) POWER_CONTROL.setProperties("POWER_CONTROL.", properties);
if (select_POWER_CONTROL) POWER_CONTROL.setProperties("POWER_CONTROL.", properties);
if (select_LWIR) LWIR_PARAMETERS.setProperties("LWIR.", properties);
if (select_LWIR) LWIR_PARAMETERS.setProperties("LWIR.", properties);
if (select_ILLUSTRATIONS) CALIBRATION_ILLUSTRATION_PARAMETERS.setProperties("ILLUSTRATIONS.", properties);
if (select) properties.remove("selected");
if (select) properties.remove("selected");
}
}
...
@@ -16321,6 +16405,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -16321,6 +16405,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
if (FOCUSING_FIELD!=null) FOCUSING_FIELD.getProperties("FOCUSING_FIELD.", properties,false); // false -> overwrite distortions center
if (FOCUSING_FIELD!=null) FOCUSING_FIELD.getProperties("FOCUSING_FIELD.", properties,false); // false -> overwrite distortions center
POWER_CONTROL.getProperties("POWER_CONTROL.", properties);
POWER_CONTROL.getProperties("POWER_CONTROL.", properties);
LWIR_PARAMETERS.getProperties("LWIR.", properties);
LWIR_PARAMETERS.getProperties("LWIR.", properties);
CALIBRATION_ILLUSTRATION_PARAMETERS.getProperties("ILLUSTRATIONS.", properties);
}
}
private String selectSourceDirectory(String defaultPath) {
private String selectSourceDirectory(String defaultPath) {
src/main/java/com/elphel/imagej/calibration/CalibrationIllustration.java
0 → 100644
View file @
7c9b8ed9
package
com
.
elphel
.
imagej
.
calibration
;
import
java.awt.Color
;
import
java.awt.Rectangle
;
import
java.io.File
;
import
java.util.Arrays
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
com.elphel.imagej.calibration.DistortionCalibrationData.GridImageParameters
;
import
com.elphel.imagej.cameras.ThermalColor
;
import
com.elphel.imagej.common.ShowDoubleFloatArrays
;
import
com.elphel.imagej.correction.EyesisCorrections
;
import
com.elphel.imagej.lwir.LwirReaderParameters
;
import
ij.IJ
;
import
ij.ImagePlus
;
import
ij.ImageStack
;
import
ij.Prefs
;
import
ij.gui.Line
;
import
ij.process.ImageProcessor
;
public
class
CalibrationIllustration
{
EyesisAberrations
eyesisAberrations
;
Distortions
distortions
;
CalibrationIllustrationParameters
illustrationParameters
;
LwirReaderParameters
lwirReaderParameters
;
AtomicInteger
stopRequested
;
int
debug_level
;
int
numStations
;
int
numSubCameras
;
String
[][]
gridFileDirs
;
// = new String [numStations][];
boolean
[][][]
gridUseChn
;
// = new boolean [numStations][][]; // channels to use in each scene
String
[]
sourceStationDirs
;
// = new String [numStations]; // directories of the source files per station
String
[]
grid_extensions
={
".tiff"
};
String
[]
src_extensions
={
".tiff"
};
public
CalibrationIllustration
(
CalibrationIllustrationParameters
illustrationParameters
,
EyesisAberrations
eyesisAberrations
,
Distortions
distortions
,
AtomicInteger
stopRequested
,
int
debug_level
)
{
this
.
illustrationParameters
=
illustrationParameters
;
this
.
eyesisAberrations
=
eyesisAberrations
;
this
.
distortions
=
distortions
;
this
.
stopRequested
=
stopRequested
;
this
.
debug_level
=
debug_level
;
}
public
void
plotGrid
(
int
numImg
,
ImagePlus
imp
,
Color
color_grid
,
Color
color_grid_extra
// at least one end points to extra (unreliable) nodes (may be null)
)
{
int
line_width
=
1
;
//https://imagej.nih.gov/ij/developer/api/ij/ij/gui/Line.html#drawPixels(ij.process.ImageProcessor)
DistortionCalibrationData
dcd
=
distortions
.
fittingStrategy
.
distortionCalibrationData
;
GridImageParameters
gip
=
dcd
.
gIP
[
numImg
];
int
[][]
pUV
=
gip
.
pixelsUV
;
int
[][]
pUV_extra
=
gip
.
pixelsUV_extra
;
double
[][]
pXY
=
gip
.
pixelsXY
;
double
[][]
pXY_extra
=
gip
.
pixelsXY_extra
;
int
minU
=
pUV
[
0
][
0
],
maxU
=
minU
,
minV
=
pUV
[
0
][
1
],
maxV
=
minV
;
for
(
int
i
=
0
;
i
<
pUV
.
length
;
i
++)
{
if
(
pUV
[
i
][
0
]
<
minU
)
minU
=
pUV
[
i
][
0
];
else
if
(
pUV
[
i
][
0
]
>
maxU
)
maxU
=
pUV
[
i
][
0
];
if
(
pUV
[
i
][
1
]
<
minV
)
minV
=
pUV
[
i
][
1
];
else
if
(
pUV
[
i
][
1
]
>
maxV
)
maxV
=
pUV
[
i
][
1
];
}
if
(
color_grid_extra
!=
null
)
{
for
(
int
i
=
0
;
i
<
pUV_extra
.
length
;
i
++)
{
if
(
pUV_extra
[
i
][
0
]
<
minU
)
minU
=
pUV_extra
[
i
][
0
];
else
if
(
pUV_extra
[
i
][
0
]
>
maxU
)
maxU
=
pUV_extra
[
i
][
0
];
if
(
pUV_extra
[
i
][
1
]
<
minV
)
minV
=
pUV_extra
[
i
][
1
];
else
if
(
pUV_extra
[
i
][
1
]
>
maxV
)
maxV
=
pUV_extra
[
i
][
1
];
}
}
Rectangle
dimsUV
=
new
Rectangle
(
minU
-
1
,
minV
-
1
,
maxU
-
minU
+
2
,
maxV
-
minV
+
2
);
int
[]
grid
=
new
int
[
dimsUV
.
height
*
dimsUV
.
width
];
Arrays
.
fill
(
grid
,
-
1
);
int
main_len
=
pUV
.
length
;
for
(
int
i
=
0
;
i
<
main_len
;
i
++)
{
int
indx
=
(
pUV
[
i
][
0
]-
dimsUV
.
x
)
+
(
pUV
[
i
][
1
]-
dimsUV
.
y
)*
dimsUV
.
width
;
grid
[
indx
]
=
i
;
}
if
(
color_grid_extra
!=
null
)
{
for
(
int
i
=
0
;
i
<
pUV_extra
.
length
;
i
++)
{
int
indx
=
(
pUV_extra
[
i
][
0
]-
dimsUV
.
x
)
+
(
pUV_extra
[
i
][
1
]-
dimsUV
.
y
)*
dimsUV
.
width
;
grid
[
indx
]
=
i
+
main_len
;
}
}
ImageProcessor
ip
=
imp
.
getProcessor
();
ip
.
setLineWidth
(
line_width
);
// int upper = dimsUV.width * (dimsUV.height-1);
int
upper
=
dimsUV
.
width
*
dimsUV
.
height
;
for
(
int
indx
=
dimsUV
.
width
+
1
;
indx
<
upper
;
indx
++)
if
(
grid
[
indx
]
>=
0
){
// try to the right and down
int
g0
=
grid
[
indx
];
for
(
int
dir
=
0
;
dir
<
2
;
dir
++)
{
// 90 - right, 1 - down
int
indx1
=
indx
+
((
dir
>
0
)
?
dimsUV
.
width
:
1
);
if
(
indx1
<
grid
.
length
)
{
int
g1
=
grid
[
indx1
];
if
(
g1
>=
0
)
{
if
((
g0
<
main_len
)
&&
(
g1
<
main_len
))
{
ip
.
setColor
(
color_grid
);
}
else
{
ip
.
setColor
(
color_grid_extra
);
// should not get here with color_grid_extra==null
}
double
[]
pXY0
=
(
g0
<
main_len
)
?
pXY
[
g0
]
:
pXY_extra
[
g0
-
main_len
];
double
[]
pXY1
=
(
g1
<
main_len
)
?
pXY
[
g1
]
:
pXY_extra
[
g1
-
main_len
];
Line
line
=
new
Line
(
pXY0
[
0
],
pXY0
[
1
],
pXY1
[
0
],
pXY1
[
1
]);
line
.
drawPixels
(
ip
);
}
}
}
}
}
public
boolean
convertSourceFiles
()
{
double
threshold_contrast
=
10.0
;
int
threshold_number
=
10
;
// grid should have this number of nodes with above-threshold contrast
int
CONTRAST_INDEX
=
2
;
//this.eyesisCameraParameters.numStations
boolean
[]
selectedChannels
=
eyesisAberrations
.
aberrationParameters
.
getChannelSelection
(
distortions
);
DistortionCalibrationData
dcd
=
distortions
.
fittingStrategy
.
distortionCalibrationData
;
int
numStations
=
dcd
.
eyesisCameraParameters
.
getNumStations
();
boolean
[]
station_sel
=
new
boolean
[
numStations
];
// Arrays.fill(station_sel, true);
station_sel
[
0
]=
true
;
// only 06-L
MultipleExtensionsFileFilter
sourceFilter
=
new
MultipleExtensionsFileFilter
(
""
,
src_extensions
,
"Source calibration images"
);
int
lwir0
=
illustrationParameters
.
getLwirReaderParameters
().
getLwirChn0
();
int
eo0
=
illustrationParameters
.
getLwirReaderParameters
().
getEoChn0
();
for
(
int
nChn
=
0
;
nChn
<
selectedChannels
.
length
;
nChn
++)
if
(
selectedChannels
[
nChn
])
{
// iterate through all image set (some grids may be missing)
for
(
int
nSet
=
0
;
nSet
<
dcd
.
gIS
.
length
;
nSet
++)
{
if
(
station_sel
[
dcd
.
gIS
[
nSet
].
getStationNumber
()])
{
// some stations only
// construct source file name
String
srcPath
=
null
;
int
numImg
=
-
1
;
if
(
dcd
.
gIS
[
nSet
].
imageSet
[
nChn
]
!=
null
)
{
srcPath
=
dcd
.
gIS
[
nSet
].
imageSet
[
nChn
].
source_path
;
numImg
=
dcd
.
gIS
[
nSet
].
imageSet
[
nChn
].
getImageNumber
();
}
else
{
// find other non-null
for
(
int
i
=
0
;
i
<
dcd
.
gIS
[
nSet
].
imageSet
.
length
;
i
++)
{
if
(
dcd
.
gIS
[
nSet
].
imageSet
[
i
]
!=
null
)
{
String
other_path
=
dcd
.
gIS
[
nSet
].
imageSet
[
i
].
source_path
;
String
set_path
=
other_path
.
substring
(
0
,
other_path
.
lastIndexOf
(
Prefs
.
getFileSeparator
()));
File
set_dir
=
new
File
(
set_path
);
String
[]
sfiles
=
set_dir
.
list
(
sourceFilter
);
for
(
String
spath:
sfiles
)
{
int
chn
=
DistortionCalibrationData
.
pathToChannel
(
spath
);
if
(
chn
==
nChn
)
{
srcPath
=
(
new
File
(
set_dir
,
spath
)).
getPath
();
break
;
}
}
break
;
}
}
}
// open 32-bit image
if
(
srcPath
==
null
)
{
System
.
out
.
println
(
"Source image for set "
+
nSet
+
", channel "
+
nChn
+
" does not exist"
);
continue
;
}
ImagePlus
imp
=
new
ImagePlus
(
srcPath
);
// convert to 8-bit color?
int
width
=
imp
.
getWidth
();
int
height
=
imp
.
getHeight
();
float
[]
pixels
=
(
float
[])
imp
.
getProcessor
().
getPixels
();
String
title
=
imp
.
getTitle
();
if
(
title
.
lastIndexOf
(
"."
)
>
0
)
{
title
=
title
.
substring
(
0
,
title
.
lastIndexOf
(
"."
));
}
String
title_annot
=
title
+
"-annot"
;
if
(
numImg
>=
0
)
{
// check if it is a bad image
int
num_above
=
0
;
GridImageParameters
gip
=
dcd
.
gIP
[
numImg
];
double
[][]
pXY
=
gip
.
pixelsXY
;
for
(
int
i
=
0
;
i
<
pXY
.
length
;
i
++
)
{
if
(
pXY
[
i
][
CONTRAST_INDEX
]
>
threshold_contrast
)
num_above
++;
}
if
(
num_above
<
threshold_number
)
{
title_annot
=
title
+
"-annot"
+
"-BAD"
;
}
}
double
[][]
pseudo_pixels
=
new
double
[
4
]
[
pixels
.
length
];
ThermalColor
tc
=
new
ThermalColor
(
illustrationParameters
.
getPalette
(),
// public int lwir_palette = 0; // 0 - white - hot, 1 - black - hot, 2+ - colored
illustrationParameters
.
getLwirRange
(
nChn
-
lwir0
)[
0
],
illustrationParameters
.
getLwirRange
(
nChn
-
lwir0
)[
1
],
255.0
);
for
(
int
i
=
0
;
i
<
pixels
.
length
;
i
++)
{
double
[]
rgb
=
tc
.
getRGB
((
double
)
pixels
[
i
]);
pseudo_pixels
[
0
][
i
]
=
rgb
[
0
];
// red
pseudo_pixels
[
1
][
i
]
=
rgb
[
1
];
// green
pseudo_pixels
[
2
][
i
]
=
rgb
[
2
];
// blue
pseudo_pixels
[
3
][
i
]
=
1.0
;
// alpha
}
String
[]
rgb_titles
=
{
"red"
,
"green"
,
"blue"
,
"alpha"
};
ImageStack
stack
=
(
new
ShowDoubleFloatArrays
()).
makeStack
(
pseudo_pixels
,
// iclt_data,
width
,
// (tilesX + 0) * clt_parameters.transform_size,
height
,
// (tilesY + 0) * clt_parameters.transform_size,
rgb_titles
,
// or use null to get chn-nn slice names
true
);
// replace NaN with 0.0
ImagePlus
imp_annot
=
EyesisCorrections
.
convertRGBAFloatToRGBA32
(
stack
,
// ImageStack stackFloat, //r,g,b,a
// name+"ARGB"+suffix, // String title,
title_annot
,
// String title,
0.0
,
// double r_min,
255.0
,
// double r_max,
0.0
,
// double g_min,
255.0
,
// double g_max,
0.0
,
// double b_min,
255.0
,
// double b_max,
0.0
,
// double alpha_min,
1.0
);
// double alpha_max)
if
(
numImg
>=
0
)
{
plotGrid
(
numImg
,
imp_annot
,
new
Color
(
250
,
0
,
0
),
// color_grid,
new
Color
(
200
,
200
,
0
)
// null // //at least one end points to extra (unreliable) nodes
);
}
// imp_pseudo.getProcessor().resetMinAndMax();
// imp_pseudo.show();
String
illustrations_dir
=
eyesisAberrations
.
aberrationParameters
.
illustrationsDirectory
;
String
chn_ill_dir
=
illustrations_dir
+
Prefs
.
getFileSeparator
()+
illustrationParameters
.
channel_dir_prefix
+
String
.
format
(
"%02d"
,
nChn
);
// create directory if it does not exist
File
destDir
=
new
File
(
chn_ill_dir
);
if
(!
destDir
.
exists
()){
if
(!
destDir
.
mkdirs
())
{
IJ
.
showMessage
(
"Error"
,
"Failed to create results directory "
+
chn_ill_dir
);
continue
;
}
}
EyesisCorrections
.
saveAndShow
(
imp_annot
,
chn_ill_dir
,
illustrationParameters
.
save_png
,
false
,
// show
illustrationParameters
.
JPEG_quality
,
// <0 - keep current, 0 - force Tiff, >0 use for JPEG
0
);
// debug_level);
}
}
}
return
true
;
}
/*
public CalibrationIllustration (
LwirReaderParameters lwirReaderParameters,
LensDistortionParameters lensDistortionParameters,
PatternParameters patternParameters,
RefineParameters refineParameters,
DistortionProcessConfiguration distortionProcessConfiguration,
EyesisCameraParameters eyesisCameraParameters,
AtomicInteger stopRequested,
int debug_level) {
this.lwirReaderParameters = lwirReaderParameters;
this.lensDistortionParameters = lensDistortionParameters;
this.patternParameters = patternParameters;
this.refineParameters = refineParameters;
this.distortionProcessConfiguration = distortionProcessConfiguration;
this.eyesisCameraParameters = eyesisCameraParameters;
this.stopRequested = stopRequested;
this.debug_level = debug_level;
}
*/
}
src/main/java/com/elphel/imagej/calibration/CalibrationIllustrationParameters.java
0 → 100644
View file @
7c9b8ed9
package
com
.
elphel
.
imagej
.
calibration
;
import
java.util.Properties
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
import
com.elphel.imagej.lwir.LwirReaderParameters
;
public
class
CalibrationIllustrationParameters
{
double
dflt_lwir_lo
=
22500.0
;
double
dflt_lwir_hi
=
23500.0
;
LwirReaderParameters
lwirReaderParameters
;
double
[][]
lwir_ranges
;
// = new double [lwirReaderParameters.getLwirChannels(false).length][2];
int
palette
=
0
;
// 0 - white - hot, 1 - black - hot, 2+ - colored
String
src_chn_prefix
=
"src_chn-"
;
boolean
save_png
=
true
;
int
JPEG_quality
=
90
;
String
channel_dir_prefix
=
"chn_"
;
public
CalibrationIllustrationParameters
(
LwirReaderParameters
lwirReaderParameters
)
{
this
.
lwirReaderParameters
=
lwirReaderParameters
;
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
// properties.setProperty(prefix+"camera_name", this.camera_name+"");
set_parameters
();
for
(
int
i
=
0
;
i
<
lwir_ranges
.
length
;
i
++)
{
properties
.
setProperty
(
prefix
+
"lwir_range_lo_"
+
i
,
this
.
lwir_ranges
[
i
][
0
]+
""
);
properties
.
setProperty
(
prefix
+
"lwir_range_hi_"
+
i
,
this
.
lwir_ranges
[
i
][
1
]+
""
);
}
properties
.
setProperty
(
prefix
+
"palette"
,
this
.
palette
+
""
);
properties
.
setProperty
(
prefix
+
"save_png"
,
this
.
save_png
+
""
);
properties
.
setProperty
(
prefix
+
"JPEG_quality"
,
this
.
JPEG_quality
+
""
);
properties
.
setProperty
(
prefix
+
"channel_dir_prefix"
,
this
.
channel_dir_prefix
);
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
set_parameters
();
for
(
int
i
=
0
;
i
<
lwir_ranges
.
length
;
i
++)
{
if
(
properties
.
getProperty
(
prefix
+
"lwir_range_lo_"
+
i
)!=
null
)
{
this
.
lwir_ranges
[
i
][
0
]
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lwir_range_lo_"
+
i
));
}
if
(
properties
.
getProperty
(
prefix
+
"lwir_range_hi_"
+
i
)!=
null
)
{
this
.
lwir_ranges
[
i
][
1
]
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lwir_range_hi_"
+
i
));
}
}
if
(
properties
.
getProperty
(
prefix
+
"palette"
)!=
null
)
this
.
palette
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"palette"
));
if
(
properties
.
getProperty
(
prefix
+
"save_png"
)!=
null
)
this
.
save_png
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"save_png"
));
if
(
properties
.
getProperty
(
prefix
+
"JPEG_quality"
)!=
null
)
this
.
JPEG_quality
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"JPEG_quality"
));
if
(
properties
.
getProperty
(
prefix
+
"channel_dir_prefix"
)!=
null
)
this
.
channel_dir_prefix
=
(
String
)
properties
.
getProperty
(
prefix
+
"channel_dir_prefix"
);
}
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
for
(
int
i
=
0
;
i
<
lwir_ranges
.
length
;
i
++)
{
gd
.
addNumericField
(
"LWIR chn:"
+
i
+
" low range"
,
this
.
lwir_ranges
[
i
][
0
],
0
,
8
,
""
,
"LWIR sensor range low level "
);
gd
.
addNumericField
(
"LWIR chn:"
+
i
+
" high range"
,
this
.
lwir_ranges
[
i
][
1
],
0
,
8
,
""
,
"LWIR sensor range high level "
);
}
gd
.
addNumericField
(
"Thermal color palette"
,
this
.
palette
,
0
,
3
,
""
,
"0 - white-hot, 1 - black-hot, 2+ - colored"
);
gd
.
addCheckbox
(
"Save as PNG instead of JPEG"
,
save_png
);
gd
.
addNumericField
(
"JPEG quality"
,
this
.
JPEG_quality
,
0
,
3
,
""
,
"Jpeg quality, 0 - use Tiff"
);
gd
.
addStringField
(
"Channel directory prefix"
,
this
.
channel_dir_prefix
,
15
,
"prefix to a directory name to save channel annotated files"
);
}
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
for
(
int
i
=
0
;
i
<
lwir_ranges
.
length
;
i
++)
{
this
.
lwir_ranges
[
i
][
0
]
=
gd
.
getNextNumber
();
this
.
lwir_ranges
[
i
][
1
]
=
gd
.
getNextNumber
();
}
this
.
palette
=
(
int
)
gd
.
getNextNumber
();
this
.
save_png
=
gd
.
getNextBoolean
();
this
.
JPEG_quality
=
(
int
)
gd
.
getNextNumber
();
this
.
channel_dir_prefix
=
gd
.
getNextString
();
}
public
boolean
showJDialog
()
{
set_parameters
();
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Set illustration parameters"
,
800
,
900
);
dialogQuestions
(
gd
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
dialogAnswers
(
gd
);
return
true
;
}
public
void
set_parameters
()
{
// this.lwirReaderParameters = lwirReaderParameters;
if
((
lwir_ranges
==
null
)
||
(
lwir_ranges
.
length
!=
lwirReaderParameters
.
getLwirChannels
(
false
).
length
)){
lwir_ranges
=
new
double
[
lwirReaderParameters
.
getLwirChannels
(
false
).
length
][
2
];
for
(
int
i
=
0
;
i
<
lwir_ranges
.
length
;
i
++)
{
this
.
lwir_ranges
[
i
][
0
]
=
dflt_lwir_lo
;
this
.
lwir_ranges
[
i
][
1
]
=
dflt_lwir_hi
;
}
}
}
public
int
getPalette
()
{
return
this
.
palette
;
}
public
double
[]
getLwirRange
(
int
lwir_index
)
{
return
lwir_ranges
[
lwir_index
];
}
public
LwirReaderParameters
getLwirReaderParameters
()
{
return
lwirReaderParameters
;
}
}
src/main/java/com/elphel/imagej/calibration/DistortionCalibrationData.java
View file @
7c9b8ed9
...
@@ -1039,16 +1039,6 @@ import ij.text.TextWindow;
...
@@ -1039,16 +1039,6 @@ import ij.text.TextWindow;
System
.
out
.
println
(
"sfiles == null"
);
System
.
out
.
println
(
"sfiles == null"
);
}
}
for
(
String
spath:
sfiles
)
{
for
(
String
spath:
sfiles
)
{
/*
int last_dash = spath.lastIndexOf('-');
int last = spath.lastIndexOf('_');
if (last_dash >last) last = last_dash;
int last_dot = spath.lastIndexOf('.');
if (last_dot < 0) {
last_dot = spath.length();
}
int chn = Integer.parseInt(spath.substring(last+1, last_dot));
*/
int
chn
=
pathToChannel
(
spath
);
int
chn
=
pathToChannel
(
spath
);
spaths
[
chn
]
=
(
new
File
(
set_dir
,
spath
)).
getPath
();
spaths
[
chn
]
=
(
new
File
(
set_dir
,
spath
)).
getPath
();
}
}
...
...
src/main/java/com/elphel/imagej/calibration/EyesisAberrations.java
View file @
7c9b8ed9
...
@@ -4784,6 +4784,7 @@ public class EyesisAberrations {
...
@@ -4784,6 +4784,7 @@ public class EyesisAberrations {
public
static
class
AberrationParameters
{
public
static
class
AberrationParameters
{
public
String
sourceDirectory
=
""
;
public
String
sourceDirectory
=
""
;
public
String
partialKernelDirectory
=
""
;
public
String
partialKernelDirectory
=
""
;
public
String
illustrationsDirectory
=
""
;
public
String
psfKernelDirectory
=
""
;
public
String
psfKernelDirectory
=
""
;
public
String
aberrationsKernelDirectory
=
""
;
public
String
aberrationsKernelDirectory
=
""
;
public
String
calibrationDirectory
=
""
;
public
String
calibrationDirectory
=
""
;
...
@@ -4821,6 +4822,7 @@ public class EyesisAberrations {
...
@@ -4821,6 +4822,7 @@ public class EyesisAberrations {
public
void
setProperties
(
String
prefix
,
Properties
properties
){
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"sourceDirectory"
,
this
.
sourceDirectory
);
properties
.
setProperty
(
prefix
+
"sourceDirectory"
,
this
.
sourceDirectory
);
properties
.
setProperty
(
prefix
+
"partialKernelDirectory"
,
this
.
partialKernelDirectory
);
properties
.
setProperty
(
prefix
+
"partialKernelDirectory"
,
this
.
partialKernelDirectory
);
properties
.
setProperty
(
prefix
+
"illustrationsDirectory"
,
this
.
illustrationsDirectory
);
properties
.
setProperty
(
prefix
+
"psfKernelDirectory"
,
this
.
psfKernelDirectory
);
properties
.
setProperty
(
prefix
+
"psfKernelDirectory"
,
this
.
psfKernelDirectory
);
properties
.
setProperty
(
prefix
+
"aberrationsKernelDirectory"
,
this
.
aberrationsKernelDirectory
);
properties
.
setProperty
(
prefix
+
"aberrationsKernelDirectory"
,
this
.
aberrationsKernelDirectory
);
properties
.
setProperty
(
prefix
+
"calibrationDirectory"
,
this
.
calibrationDirectory
);
properties
.
setProperty
(
prefix
+
"calibrationDirectory"
,
this
.
calibrationDirectory
);
...
@@ -4866,6 +4868,7 @@ public class EyesisAberrations {
...
@@ -4866,6 +4868,7 @@ public class EyesisAberrations {
public
void
getProperties
(
String
prefix
,
Properties
properties
){
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"sourceDirectory"
)!=
null
)
this
.
sourceDirectory
=
properties
.
getProperty
(
prefix
+
"sourceDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"sourceDirectory"
)!=
null
)
this
.
sourceDirectory
=
properties
.
getProperty
(
prefix
+
"sourceDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"partialKernelDirectory"
)!=
null
)
this
.
partialKernelDirectory
=
properties
.
getProperty
(
prefix
+
"partialKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"partialKernelDirectory"
)!=
null
)
this
.
partialKernelDirectory
=
properties
.
getProperty
(
prefix
+
"partialKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"illustrationsDirectory"
)!=
null
)
this
.
illustrationsDirectory
=
properties
.
getProperty
(
prefix
+
"illustrationsDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"psfKernelDirectory"
)!=
null
)
this
.
psfKernelDirectory
=
properties
.
getProperty
(
prefix
+
"psfKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"psfKernelDirectory"
)!=
null
)
this
.
psfKernelDirectory
=
properties
.
getProperty
(
prefix
+
"psfKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"aberrationsKernelDirectory"
)!=
null
)
this
.
aberrationsKernelDirectory
=
properties
.
getProperty
(
prefix
+
"aberrationsKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"aberrationsKernelDirectory"
)!=
null
)
this
.
aberrationsKernelDirectory
=
properties
.
getProperty
(
prefix
+
"aberrationsKernelDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"calibrationDirectory"
)!=
null
)
this
.
calibrationDirectory
=
properties
.
getProperty
(
prefix
+
"calibrationDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"calibrationDirectory"
)!=
null
)
this
.
calibrationDirectory
=
properties
.
getProperty
(
prefix
+
"calibrationDirectory"
);
...
@@ -5018,6 +5021,8 @@ public class EyesisAberrations {
...
@@ -5018,6 +5021,8 @@ public class EyesisAberrations {
gd
.
addCheckbox
(
"Select source directory"
,
false
);
gd
.
addCheckbox
(
"Select source directory"
,
false
);
gd
.
addStringField
(
"Partial kernels directory"
,
this
.
partialKernelDirectory
,
60
);
gd
.
addStringField
(
"Partial kernels directory"
,
this
.
partialKernelDirectory
,
60
);
gd
.
addCheckbox
(
"Select partial kernels directory"
,
false
);
gd
.
addCheckbox
(
"Select partial kernels directory"
,
false
);
gd
.
addStringField
(
"Illustrations directory"
,
this
.
illustrationsDirectory
,
60
);
gd
.
addCheckbox
(
"Select illustrations directory"
,
false
);
gd
.
addStringField
(
"Combined kernels directory"
,
this
.
psfKernelDirectory
,
60
);
gd
.
addStringField
(
"Combined kernels directory"
,
this
.
psfKernelDirectory
,
60
);
gd
.
addCheckbox
(
"Select combined kernsls directory"
,
false
);
gd
.
addCheckbox
(
"Select combined kernsls directory"
,
false
);
gd
.
addStringField
(
"Aberrations kernels directory"
,
this
.
aberrationsKernelDirectory
,
60
);
gd
.
addStringField
(
"Aberrations kernels directory"
,
this
.
aberrationsKernelDirectory
,
60
);
...
@@ -5071,6 +5076,8 @@ public class EyesisAberrations {
...
@@ -5071,6 +5076,8 @@ public class EyesisAberrations {
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
this
.
sourceDirectory
,
false
);
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
this
.
sourceDirectory
,
false
);
this
.
partialKernelDirectory
=
gd
.
getNextString
();
this
.
partialKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectPartialKernelDirectory
(
false
,
this
.
partialKernelDirectory
,
false
);
if
(
gd
.
getNextBoolean
())
selectPartialKernelDirectory
(
false
,
this
.
partialKernelDirectory
,
false
);
this
.
illustrationsDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectIllustrationsDirectory
(
false
,
this
.
illustrationsDirectory
,
false
);
this
.
psfKernelDirectory
=
gd
.
getNextString
();
this
.
psfKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectPSFKernelDirectory
(
false
,
this
.
psfKernelDirectory
,
false
);
if
(
gd
.
getNextBoolean
())
selectPSFKernelDirectory
(
false
,
this
.
psfKernelDirectory
,
false
);
this
.
aberrationsKernelDirectory
=
gd
.
getNextString
();
this
.
aberrationsKernelDirectory
=
gd
.
getNextString
();
...
@@ -5133,6 +5140,19 @@ public class EyesisAberrations {
...
@@ -5133,6 +5140,19 @@ public class EyesisAberrations {
if
(
dir
!=
null
)
this
.
partialKernelDirectory
=
dir
;
if
(
dir
!=
null
)
this
.
partialKernelDirectory
=
dir
;
return
dir
;
return
dir
;
}
}
public
String
selectIllustrationsDirectory
(
boolean
smart
,
String
defaultPath
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
newAllowed
,
// save
"Illustrations directory"
,
// title
"Select illustrations directory"
,
// button
null
,
// filter
defaultPath
);
//this.sourceDirectory);
if
(
dir
!=
null
)
this
.
illustrationsDirectory
=
dir
;
return
dir
;
}
public
String
selectPSFKernelDirectory
(
boolean
smart
,
String
defaultPath
,
boolean
newAllowed
)
{
public
String
selectPSFKernelDirectory
(
boolean
smart
,
String
defaultPath
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
smart
,
...
...
src/main/java/com/elphel/imagej/correction/EyesisCorrections.java
View file @
7c9b8ed9
...
@@ -2696,7 +2696,7 @@ public class EyesisCorrections {
...
@@ -2696,7 +2696,7 @@ public class EyesisCorrections {
}
}
public
void
saveAndShow
(
public
static
void
saveAndShow
(
ImagePlus
imp
,
ImagePlus
imp
,
String
path
,
String
path
,
boolean
png
,
boolean
png
,
...
@@ -2716,12 +2716,12 @@ public class EyesisCorrections {
...
@@ -2716,12 +2716,12 @@ public class EyesisCorrections {
}
}
}
}
if
(
hasAlphaHighByte
&&
(
jpegQuality
<=
0
)){
if
(
hasAlphaHighByte
&&
(
(
jpegQuality
<=
0
)
||
png
)){
if
(
png
){
if
(
png
){
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Saving RGBA result to "
+
path
+
".png"
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Saving RGBA result to "
+
path
+
".png"
);
(
new
EyesisTiff
()).
savePNG_ARGB32
(
(
new
EyesisTiff
()).
savePNG_ARGB32
(
imp
,
imp
,
path
+
".png"
path
+
".png"
);
);
}
else
{
}
else
{
...
@@ -2729,7 +2729,7 @@ public class EyesisCorrections {
...
@@ -2729,7 +2729,7 @@ public class EyesisCorrections {
try
{
try
{
(
new
EyesisTiff
()).
saveTiffARGB32
(
(
new
EyesisTiff
()).
saveTiffARGB32
(
imp
,
imp
,
path
+
".tiff"
,
path
,
//
+".tiff",
false
,
// correctionsParameters.imageJTags,
false
,
// correctionsParameters.imageJTags,
debugLevel
);
debugLevel
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
src/main/java/com/elphel/imagej/lwir/LwirReaderParameters.java
View file @
7c9b8ed9
...
@@ -102,6 +102,26 @@ public class LwirReaderParameters {
...
@@ -102,6 +102,26 @@ public class LwirReaderParameters {
public
LwirReaderParameters
()
{
public
LwirReaderParameters
()
{
}
}
public
int
[]
getLwirChannels
(
boolean
absolote
)
{
int
[]
absolute_chn
=
new
int
[
lwir_channels
.
length
];
for
(
int
i
=
0
;
i
<
absolute_chn
.
length
;
i
++)
{
absolute_chn
[
i
]
=
lwir_channels
[
i
]
+
(
absolote
?
getLwirChn0
()
:
0
);
}
return
absolute_chn
;
}
public
int
[]
getAbsoluteEoChannels
(
boolean
absolote
)
{
int
[]
absolute_chn
=
new
int
[
eo_channels
.
length
];
for
(
int
i
=
0
;
i
<
absolute_chn
.
length
;
i
++)
{
absolute_chn
[
i
]
=
eo_channels
[
i
]
+
+
(
absolote
?
getEoChn0
():
0
);
}
return
absolute_chn
;
}
// protected int [] lwir_channels = {0, 1, 2 ,3};
// protected int [] eo_channels = {0, 1, 2 ,3};
public
LwirReaderParameters
(
String
name
)
{
public
LwirReaderParameters
(
String
name
)
{
if
(
NAME_TALON
.
equals
(
name
))
camera_name
=
NAME_TALON
;
if
(
NAME_TALON
.
equals
(
name
))
camera_name
=
NAME_TALON
;
else
if
(
NAME_LWIR16
.
equals
(
name
))
camera_name
=
NAME_LWIR16
;
else
if
(
NAME_LWIR16
.
equals
(
name
))
camera_name
=
NAME_LWIR16
;
...
@@ -133,11 +153,11 @@ public class LwirReaderParameters {
...
@@ -133,11 +153,11 @@ public class LwirReaderParameters {
public
int
getNumFrames
()
{
public
int
getNumFrames
()
{
return
num_frames
;
return
num_frames
;
}
}
public
int
getLwirChn0
()
{
public
int
getLwirChn0
()
{
return
lwir_chn0
;
return
lwir_chn0
;
}
}
public
int
getEoChn0
()
{
public
int
getEoChn0
()
{
return
isLwir16
()
?
16
:
4
;
// eo_chn0;
return
isLwir16
()
?
16
:
4
;
// eo_chn0;
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
7c9b8ed9
...
@@ -2191,7 +2191,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2191,7 +2191,7 @@ public class QuadCLT extends QuadCLTCPU {
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
imps_RGB
[
sub_img
],
imps_RGB
[
sub_img
],
x3d_path
,
x3d_path
,
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
...
@@ -2720,7 +2720,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2720,7 +2720,7 @@ public class QuadCLT extends QuadCLTCPU {
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
quadCLT_main
.
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
imps_RGB
[
sub_img
],
imps_RGB
[
sub_img
],
x3d_path
,
x3d_path
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
7c9b8ed9
...
@@ -5159,7 +5159,7 @@ public class QuadCLTCPU {
...
@@ -5159,7 +5159,7 @@ public class QuadCLTCPU {
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
for
(
int
sub_img
=
0
;
sub_img
<
4
;
sub_img
++){
for
(
int
sub_img
=
0
;
sub_img
<
4
;
sub_img
++){
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
imps_RGB
[
sub_img
],
imps_RGB
[
sub_img
],
x3d_path
,
x3d_path
,
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
...
@@ -12185,7 +12185,7 @@ public class QuadCLTCPU {
...
@@ -12185,7 +12185,7 @@ public class QuadCLTCPU {
}
}
ImagePlus
ip_thumb
=
new
ImagePlus
(
name
,
ip
);
ImagePlus
ip_thumb
=
new
ImagePlus
(
name
,
ip
);
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
ip_thumb
,
ip_thumb
,
dir
,
dir
,
false
,
false
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
7c9b8ed9
...
@@ -50,6 +50,7 @@ import com.elphel.imagej.cameras.EyesisCorrectionParameters;
...
@@ -50,6 +50,7 @@ import com.elphel.imagej.cameras.EyesisCorrectionParameters;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
import
com.elphel.imagej.common.ShowDoubleFloatArrays
;
import
com.elphel.imagej.common.ShowDoubleFloatArrays
;
import
com.elphel.imagej.correction.CorrectionColorProc
;
import
com.elphel.imagej.correction.CorrectionColorProc
;
import
com.elphel.imagej.correction.EyesisCorrections
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.jp4.JP46_Reader_camera
;
import
com.elphel.imagej.jp4.JP46_Reader_camera
;
...
@@ -1030,7 +1031,7 @@ public class TwoQuadCLT {
...
@@ -1030,7 +1031,7 @@ public class TwoQuadCLT {
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
quadCLT_main
.
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
imps_RGB
[
sub_img
],
imps_RGB
[
sub_img
],
x3d_path
,
x3d_path
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
...
@@ -1916,7 +1917,7 @@ public class TwoQuadCLT {
...
@@ -1916,7 +1917,7 @@ public class TwoQuadCLT {
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
for
(
int
sub_img
=
0
;
sub_img
<
imps_RGB
.
length
;
sub_img
++){
quadCLT_main
.
e
yesisCorrections
.
saveAndShow
(
E
yesisCorrections
.
saveAndShow
(
imps_RGB
[
sub_img
],
imps_RGB
[
sub_img
],
x3d_path
,
x3d_path
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
quadCLT_main
.
correctionsParameters
.
png
&&
!
clt_parameters
.
black_back
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment