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
9e5d4e97
Commit
9e5d4e97
authored
Apr 03, 2018
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added x3d model versions
parent
47feee12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
87 deletions
+183
-87
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+24
-10
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+55
-4
JP46_Reader_camera.java
src/main/java/JP46_Reader_camera.java
+100
-73
QuadCLT.java
src/main/java/QuadCLT.java
+4
-0
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
9e5d4e97
...
@@ -128,6 +128,7 @@ public class EyesisCorrectionParameters {
...
@@ -128,6 +128,7 @@ public class EyesisCorrectionParameters {
public
String
x3dModelVersion
=
"v01"
;
public
String
x3dDirectory
=
""
;
public
String
x3dDirectory
=
""
;
public
void
setProperties
(
String
prefix
,
Properties
properties
){
public
void
setProperties
(
String
prefix
,
Properties
properties
){
...
@@ -219,6 +220,8 @@ public class EyesisCorrectionParameters {
...
@@ -219,6 +220,8 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"x3dDirectory"
,
this
.
x3dDirectory
);
properties
.
setProperty
(
prefix
+
"x3dDirectory"
,
this
.
x3dDirectory
);
properties
.
setProperty
(
prefix
+
"use_x3d_subdirs"
,
this
.
use_x3d_subdirs
+
""
);
properties
.
setProperty
(
prefix
+
"use_x3d_subdirs"
,
this
.
use_x3d_subdirs
+
""
);
properties
.
setProperty
(
prefix
+
"x3dModelVersion"
,
this
.
x3dModelVersion
);
properties
.
setProperty
(
prefix
+
"clt_batch_apply_man"
,
this
.
clt_batch_apply_man
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_apply_man"
,
this
.
clt_batch_apply_man
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_extrinsic"
,
this
.
clt_batch_extrinsic
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_extrinsic"
,
this
.
clt_batch_extrinsic
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_poly"
,
this
.
clt_batch_poly
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_poly"
,
this
.
clt_batch_poly
+
""
);
...
@@ -323,6 +326,8 @@ public class EyesisCorrectionParameters {
...
@@ -323,6 +326,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
)!=
null
)
this
.
use_x3d_subdirs
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
));
if
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
)!=
null
)
this
.
use_x3d_subdirs
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
));
if
(
properties
.
getProperty
(
prefix
+
"x3dModelVersion"
)!=
null
)
this
.
x3dModelVersion
=
properties
.
getProperty
(
prefix
+
"x3dModelVersion"
);
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_apply_man"
)!=
null
)
this
.
clt_batch_apply_man
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_apply_man"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_apply_man"
)!=
null
)
this
.
clt_batch_apply_man
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_apply_man"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_extrinsic"
)!=
null
)
this
.
clt_batch_extrinsic
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_extrinsic"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_extrinsic"
)!=
null
)
this
.
clt_batch_extrinsic
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_extrinsic"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_poly"
)!=
null
)
this
.
clt_batch_poly
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_poly"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_poly"
)!=
null
)
this
.
clt_batch_poly
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_poly"
));
...
@@ -401,6 +406,7 @@ public class EyesisCorrectionParameters {
...
@@ -401,6 +406,7 @@ public class EyesisCorrectionParameters {
gd
.
addStringField
(
"Aberration kernels for CLT directory"
,
this
.
cltKernelDirectory
,
60
);
gd
.
addStringField
(
"Aberration kernels for CLT directory"
,
this
.
cltKernelDirectory
,
60
);
gd
.
addCheckbox
(
"Select aberration kernels for CLT directory"
,
false
);
gd
.
addCheckbox
(
"Select aberration kernels for CLT directory"
,
false
);
gd
.
addStringField
(
"x3d model version"
,
this
.
x3dModelVersion
,
20
);
// 10a
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
gd
.
addCheckbox
(
"Select x3d output directory"
,
false
);
gd
.
addCheckbox
(
"Select x3d output directory"
,
false
);
gd
.
addCheckbox
(
"Use individual subdirectory for each 3d model (timestamp as name)"
,
this
.
use_x3d_subdirs
);
gd
.
addCheckbox
(
"Use individual subdirectory for each 3d model (timestamp as name)"
,
this
.
use_x3d_subdirs
);
...
@@ -488,6 +494,7 @@ public class EyesisCorrectionParameters {
...
@@ -488,6 +494,7 @@ public class EyesisCorrectionParameters {
this
.
smoothKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSmoothKernelDirectory
(
false
,
true
);
this
.
smoothKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSmoothKernelDirectory
(
false
,
true
);
this
.
dctKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectDCTKernelDirectory
(
false
,
true
);
this
.
dctKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectDCTKernelDirectory
(
false
,
true
);
this
.
cltKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectCLTKernelDirectory
(
false
,
true
);
this
.
cltKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectCLTKernelDirectory
(
false
,
true
);
this
.
x3dModelVersion
=
gd
.
getNextString
();
// 10a
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
this
.
equirectangularDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectEquirectangularDirectory
(
false
,
false
);
this
.
equirectangularDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectEquirectangularDirectory
(
false
,
false
);
...
@@ -533,11 +540,13 @@ public class EyesisCorrectionParameters {
...
@@ -533,11 +540,13 @@ public class EyesisCorrectionParameters {
gd
.
addStringField
(
"Aberration kernels for CLT directory"
,
this
.
cltKernelDirectory
,
60
);
// 6
gd
.
addStringField
(
"Aberration kernels for CLT directory"
,
this
.
cltKernelDirectory
,
60
);
// 6
gd
.
addCheckbox
(
"Select aberration kernels for CLT directory"
,
false
);
// 7
gd
.
addCheckbox
(
"Select aberration kernels for CLT directory"
,
false
);
// 7
gd
.
addStringField
(
"x3d model version"
,
this
.
x3dModelVersion
,
60
);
// 10a
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
// 8
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
// 8
gd
.
addCheckbox
(
"Select x3d output
directory"
,
false
);
// 9
gd
.
addCheckbox
(
"Select x3d output
(top model) directory"
,
false
);
// 9
gd
.
addCheckbox
(
"Use individual subdirectory for each 3d model (timestamp as name)"
,
this
.
use_x3d_subdirs
);
//10
gd
.
addCheckbox
(
"Use individual subdirectory for each 3d model (timestamp as name)"
,
this
.
use_x3d_subdirs
);
//10
gd
.
addStringField
(
"Results directory"
,
this
.
resultsDirectory
,
60
);
// 11
gd
.
addStringField
(
"Results directory"
,
this
.
resultsDirectory
,
60
);
// 11
gd
.
addCheckbox
(
"Select results directory"
,
false
);
// 12
gd
.
addCheckbox
(
"Select results directory"
,
false
);
// 12
...
@@ -581,6 +590,7 @@ public class EyesisCorrectionParameters {
...
@@ -581,6 +590,7 @@ public class EyesisCorrectionParameters {
this
.
sourceDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
false
);
// 3
this
.
sourceDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
false
);
// 3
this
.
sensorDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSensorDirectory
(
false
,
false
);
// 5
this
.
sensorDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSensorDirectory
(
false
,
false
);
// 5
this
.
cltKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectCLTKernelDirectory
(
false
,
true
);
// 7
this
.
cltKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectCLTKernelDirectory
(
false
,
true
);
// 7
this
.
x3dModelVersion
=
gd
.
getNextString
();
// 10a
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
// 9
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
// 9
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
// 10
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
// 10
this
.
resultsDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectResultsDirectory
(
false
,
true
);
// 12
this
.
resultsDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectResultsDirectory
(
false
,
true
);
// 12
...
@@ -1148,7 +1158,7 @@ public class EyesisCorrectionParameters {
...
@@ -1148,7 +1158,7 @@ public class EyesisCorrectionParameters {
}
}
// select qualified (by 'name' - quad timestamp) x3d subdirectory
// select qualified (by 'name' - quad timestamp) x3d subdirectory
public
String
selectX3dDirectory
(
String
name
,
boolean
smart
,
boolean
newAllowed
)
{
public
String
selectX3dDirectory
(
String
name
,
String
version
,
boolean
smart
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
smart
,
...
@@ -1159,14 +1169,18 @@ public class EyesisCorrectionParameters {
...
@@ -1159,14 +1169,18 @@ public class EyesisCorrectionParameters {
this
.
x3dDirectory
);
//this.sourceDirectory);
this
.
x3dDirectory
);
//this.sourceDirectory);
if
(
dir
!=
null
)
{
if
(
dir
!=
null
)
{
this
.
x3dDirectory
=
dir
;
this
.
x3dDirectory
=
dir
;
if
(
this
.
use_x3d_subdirs
&&(
name
!=
null
)
&&
!
name
.
equals
(
""
))
{
if
(
this
.
use_x3d_subdirs
&&
(
name
!=
null
)
&&
!
name
.
equals
(
""
))
{
dir
=
CalibrationFileManagement
.
selectDirectory
(
name
=
this
.
x3dDirectory
+
Prefs
.
getFileSeparator
()+
name
;
smart
,
if
((
version
!=
null
)
&&
!
version
.
equals
(
""
))
{
newAllowed
,
// save
name
=
name
+
Prefs
.
getFileSeparator
()+
version
;
"x3d output sub-directory"
,
// title
}
"Select x3d output sub-directory"
,
// button
dir
=
CalibrationFileManagement
.
selectDirectory
(
null
,
// filter
smart
,
this
.
x3dDirectory
+
Prefs
.
getFileSeparator
()+
name
);
//this.sourceDirectory);
newAllowed
,
// save
"x3d output sub-directory"
,
// title
"Select x3d output sub-directory"
,
// button
null
,
// filter
name
);
//this.x3dDirectory + Prefs.getFileSeparator()+name); //this.sourceDirectory);
}
}
}
}
return
dir
;
return
dir
;
...
...
src/main/java/Eyesis_Correction.java
View file @
9e5d4e97
...
@@ -27,12 +27,19 @@
...
@@ -27,12 +27,19 @@
import
java.awt.Button
;
import
java.awt.Button
;
import
java.awt.Color
;
import
java.awt.Color
;
import
java.awt.Component
;
import
java.awt.Dialog
;
import
java.awt.Frame
;
import
java.awt.Frame
;
import
java.awt.GridLayout
;
import
java.awt.GridLayout
;
import
java.awt.Label
;
import
java.awt.MouseInfo
;
import
java.awt.Panel
;
import
java.awt.Panel
;
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.Rectangle
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.WindowEvent
;
import
java.awt.event.WindowEvent
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -394,10 +401,10 @@ private Panel panel1,
...
@@ -394,10 +401,10 @@ private Panel panel1,
panel6
=
new
Panel
();
panel6
=
new
Panel
();
panel6
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
panel6
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
addButton
(
"Save"
,
panel6
);
addButton
(
"Save"
,
panel6
,
color_process
);
//, "Save configuration"
);
addButton
(
"Restore"
,
panel6
,
color_restore
);
addButton
(
"Restore"
,
panel6
,
color_restore
);
// , "Restore configuration"
);
addButton
(
"Stop"
,
panel6
,
color_stop
);
addButton
(
"Stop"
,
panel6
,
color_stop
);
addButton
(
"Abort"
,
panel6
,
color_stop
);
addButton
(
"Abort"
,
panel6
,
color_stop
);
add
(
panel6
);
add
(
panel6
);
...
@@ -666,18 +673,62 @@ private Panel panel1,
...
@@ -666,18 +673,62 @@ private Panel panel1,
}
}
}
}
public
class
AwtToolTip
extends
MouseAdapter
{
private
String
toolTipText
=
"..."
;
private
Component
component
=
null
;
private
Dialog
dialog
;
public
AwtToolTip
(
String
toolTipText
,
Component
component
){
this
.
toolTipText
=
toolTipText
;
this
.
component
=
component
;
dialog
=
new
Dialog
(
new
Frame
());
dialog
.
add
(
new
Label
(
toolTipText
));
dialog
.
setLocationRelativeTo
(
component
);
dialog
.
pack
();
}
@Override
public
void
mouseEntered
(
MouseEvent
mouseEvent
){
Point
location
=
MouseInfo
.
getPointerInfo
().
getLocation
();
int
x
=
(
int
)
location
.
getX
();
int
y
=
(
int
)
location
.
getY
();
dialog
.
setLocation
(
x
,
y
);
dialog
.
setVisible
(
true
);
}
@Override
public
void
mouseExited
(
MouseEvent
mouseEvent
){
dialog
.
setVisible
(
false
);
}
}
void
addButton
(
String
label
,
Panel
panel
,
Color
color
,
String
toolTip
)
{
Button
b
=
new
Button
(
label
);
b
.
setBackground
(
color
);
b
.
addActionListener
(
this
);
b
.
addKeyListener
(
IJ
.
getInstance
());
b
.
addMouseListener
(
new
AwtToolTip
(
toolTip
,
b
));
panel
.
add
(
b
);
}
void
addButton
(
String
label
,
Panel
panel
,
Color
color
)
{
void
addButton
(
String
label
,
Panel
panel
,
Color
color
)
{
Button
b
=
new
Button
(
label
);
Button
b
=
new
Button
(
label
);
b
.
setBackground
(
color
);
b
.
setBackground
(
color
);
b
.
addActionListener
(
this
);
b
.
addActionListener
(
this
);
b
.
addKeyListener
(
IJ
.
getInstance
());
b
.
addKeyListener
(
IJ
.
getInstance
());
// b.addMouseListener(new AwtToolTip(label, b));
panel
.
add
(
b
);
panel
.
add
(
b
);
}
}
void
addButton
(
String
label
,
Panel
panel
)
{
void
addButton
(
String
label
,
Panel
panel
)
{
Button
b
=
new
Button
(
label
);
Button
b
=
new
Button
(
label
);
b
.
addActionListener
(
this
);
b
.
addActionListener
(
this
);
b
.
addKeyListener
(
IJ
.
getInstance
());
b
.
addKeyListener
(
IJ
.
getInstance
());
// b.addMouseListener(new AwtToolTip(label, b));
panel
.
add
(
b
);
panel
.
add
(
b
);
}
}
@Override
@Override
...
...
src/main/java/JP46_Reader_camera.java
View file @
9e5d4e97
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
** Copyright (C) 2010 Elphel, Inc.
** Copyright (C) 2010 Elphel, Inc.
**
**
** -----------------------------------------------------------------------------**
** -----------------------------------------------------------------------------**
**
**
** JP46_Reader.java is free software: you can redistribute it and/or modify
** JP46_Reader.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** the Free Software Foundation, either version 3 of the License, or
...
@@ -24,22 +24,29 @@
...
@@ -24,22 +24,29 @@
**
**
*/
*/
import
ij.*
;
import
java.awt.Button
;
import
ij.io.*
;
import
java.awt.Frame
;
import
ij.process.*
;
import
java.awt.GridLayout
;
import
ij.gui.*
;
import
java.awt.Image
;
import
ij.plugin.frame.*
;
import
java.awt.Panel
;
import
ij.text.*
;
import
java.awt.Rectangle
;
import
java.awt.Toolkit
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.*
;
import
java.awt.event.ActionListener
;
import
java.net.*
;
import
java.io.BufferedInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.RandomAccessFile
;
import
java.io.StringReader
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.io.*
;
import
javax.swing.
*
;
import
javax.swing.
JFileChooser
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.ParserConfigurationException
;
import
javax.xml.parsers.ParserConfigurationException
;
...
@@ -49,13 +56,28 @@ import org.w3c.dom.NodeList;
...
@@ -49,13 +56,28 @@ import org.w3c.dom.NodeList;
import
org.xml.sax.InputSource
;
import
org.xml.sax.InputSource
;
import
org.xml.sax.SAXException
;
import
org.xml.sax.SAXException
;
import
ij.IJ
;
import
ij.ImageJ
;
import
ij.ImagePlus
;
import
ij.ImageStack
;
import
ij.Prefs
;
import
ij.WindowManager
;
import
ij.gui.GUI
;
import
ij.gui.GenericDialog
;
import
ij.io.FileInfo
;
import
ij.io.OpenDialog
;
import
ij.plugin.frame.PlugInFrame
;
import
ij.process.ImageConverter
;
import
ij.process.ImageProcessor
;
import
ij.text.TextWindow
;
/* This plugin opens images in Elphel JP4/JP46 format (opens as JPEG, reads MakerNote and converts). */
/* This plugin opens images in Elphel JP4/JP46 format (opens as JPEG, reads MakerNote and converts). */
public
class
JP46_Reader_camera
extends
PlugInFrame
implements
ActionListener
{
public
class
JP46_Reader_camera
extends
PlugInFrame
implements
ActionListener
{
/**
/**
*
*
*/
*/
private
static
final
long
serialVersionUID
=
390855361964415147L
;
private
static
final
long
serialVersionUID
=
390855361964415147L
;
Panel
panel1
;
Panel
panel1
;
...
@@ -90,13 +112,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -90,13 +112,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel1
.
setLayout
(
new
GridLayout
(
6
,
1
,
50
,
5
));
panel1
.
setLayout
(
new
GridLayout
(
6
,
1
,
50
,
5
));
addButton
(
"Open JP4/JP46..."
,
panel1
);
addButton
(
"Open JP4/JP46..."
,
panel1
);
addButton
(
"Open JP4/JP46 from camera"
,
panel1
);
addButton
(
"Open JP4/JP46 from camera"
,
panel1
);
addButton
(
"Configure..."
,
panel1
);
addButton
(
"Configure..."
,
panel1
);
addButton
(
"Show image properties"
,
panel1
);
addButton
(
"Show image properties"
,
panel1
);
addButton
(
"Decode image info to properties"
,
panel1
);
addButton
(
"Decode image info to properties"
,
panel1
);
addButton
(
"Split Bayer"
,
panel1
);
addButton
(
"Split Bayer"
,
panel1
);
add
(
panel1
);
add
(
panel1
);
...
@@ -118,7 +140,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -118,7 +140,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel1
.
setLayout
(
new
GridLayout
(
6
,
1
,
50
,
5
));
panel1
.
setLayout
(
new
GridLayout
(
6
,
1
,
50
,
5
));
addButton
(
"Open JP4/JP46..."
,
panel1
);
addButton
(
"Open JP4/JP46..."
,
panel1
);
addButton
(
"Open JP4/JP46 from camera"
,
panel1
);
addButton
(
"Open JP4/JP46 from camera"
,
panel1
);
addButton
(
"Configure..."
,
panel1
);
addButton
(
"Configure..."
,
panel1
);
addButton
(
"Show image properties"
,
panel1
);
addButton
(
"Show image properties"
,
panel1
);
...
@@ -137,6 +159,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -137,6 +159,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
panel
.
add
(
b
);
panel
.
add
(
b
);
}
}
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
String
label
=
e
.
getActionCommand
();
String
label
=
e
.
getActionCommand
();
...
@@ -144,16 +167,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -144,16 +167,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if
(
label
==
null
)
return
;
if
(
label
==
null
)
return
;
/* button */
/* button */
if
(
label
.
equals
(
"Open JP4/JP46..."
))
{
if
(
label
.
equals
(
"Open JP4/JP46..."
))
{
read_jp46
(
arg
,
true
);
read_jp46
(
arg
,
true
);
}
else
if
(
label
.
equals
(
"Open JP4/JP46 (no scale)..."
))
{
}
else
if
(
label
.
equals
(
"Open JP4/JP46 (no scale)..."
))
{
read_jp46
(
arg
,
false
);
read_jp46
(
arg
,
false
);
}
else
if
(
label
.
equals
(
"Configure..."
))
{
}
else
if
(
label
.
equals
(
"Configure..."
))
{
showConfigDialog
();
// open configure dialog
showConfigDialog
();
// open configure dialog
}
else
if
(
label
.
equals
(
"Open JP4/JP46 from camera"
))
{
}
else
if
(
label
.
equals
(
"Open JP4/JP46 from camera"
))
{
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
}
else
if
(
label
.
equals
(
"Open JP4/JP46 from camera (no scale)"
))
{
}
else
if
(
label
.
equals
(
"Open JP4/JP46 from camera (no scale)"
))
{
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
false
);
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
false
);
}
else
if
(
label
.
equals
(
"Show image properties"
))
{
}
else
if
(
label
.
equals
(
"Show image properties"
))
{
ImagePlus
imp_sel
=
WindowManager
.
getCurrentImage
();
ImagePlus
imp_sel
=
WindowManager
.
getCurrentImage
();
if
(
imp_sel
==
null
){
if
(
imp_sel
==
null
){
...
@@ -202,7 +225,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -202,7 +225,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp_stack
.
getProcessor
().
resetMinAndMax
();
imp_stack
.
getProcessor
().
resetMinAndMax
();
imp_stack
.
show
();
imp_stack
.
show
();
}
}
public
void
read_jp46
(
String
arg
,
boolean
scale
)
{
public
void
read_jp46
(
String
arg
,
boolean
scale
)
{
JFileChooser
fc
=
null
;
JFileChooser
fc
=
null
;
//try {fc = new JFileChooser();}
//try {fc = new JFileChooser();}
...
@@ -249,7 +272,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -249,7 +272,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
confpanel
=
new
Panel
();
confpanel
=
new
Panel
();
gd
.
addPanel
(
confpanel
);
gd
.
addPanel
(
confpanel
);
addButton
(
"Open JP4/JP46 (no scale)..."
,
confpanel
);
addButton
(
"Open JP4/JP46 (no scale)..."
,
confpanel
);
addButton
(
"Open JP4/JP46 from camera (no scale)"
,
confpanel
);
addButton
(
"Open JP4/JP46 from camera (no scale)"
,
confpanel
);
//Vector textfields = gd.getStringFields();
//Vector textfields = gd.getStringFields();
...
@@ -310,7 +333,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -310,7 +333,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if
(
reuse_imp
)
{
if
(
reuse_imp
)
{
imp
=
imp_src
;
imp
=
imp_src
;
}
else
if
((
imp_src
!=
null
)&&
showImage
)
{
/* tried to reuse, but wrong size */
}
else
if
((
imp_src
!=
null
)&&
showImage
)
{
/* tried to reuse, but wrong size */
imp
.
show
();
/* never did that before */
imp
.
show
();
/* never did that before */
}
}
if
((
xtraExif
!=
null
)
&&
!
Double
.
isNaN
(
xtraExif
[
0
])){
if
((
xtraExif
!=
null
)
&&
!
Double
.
isNaN
(
xtraExif
[
0
])){
imp
.
setProperty
(
"EXPOSURE"
,
String
.
format
(
"%f"
,
xtraExif
[
0
]));
imp
.
setProperty
(
"EXPOSURE"
,
String
.
format
(
"%f"
,
xtraExif
[
0
]));
...
@@ -328,16 +351,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -328,16 +351,16 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return
imp
;
return
imp
;
}
}
return
null
;
return
null
;
}
}
public
ImagePlus
openURL
(
ImagePlus
imp_src
)
{
public
ImagePlus
openURL
(
ImagePlus
imp_src
)
{
if
(
imp_src
==
null
)
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
if
(
imp_src
==
null
)
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
,
imp_src
,
true
);
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
,
imp_src
,
true
);
}
}
public
ImagePlus
openURL
()
{
public
ImagePlus
openURL
()
{
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
return
openURL
(
camera_url
+
camera_img_new
+
camera_jp46settings
,
arg
,
true
);
}
}
public
ImagePlus
openURL
(
String
url
,
String
arg
,
boolean
scale
)
{
public
ImagePlus
openURL
(
String
url
,
String
arg
,
boolean
scale
)
{
...
@@ -356,7 +379,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -356,7 +379,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
boolean
showDemux
=
showImage
&&
demux
;
boolean
showDemux
=
showImage
&&
demux
;
if
(
demux
)
showImage
=
false
;
if
(
demux
)
showImage
=
false
;
double
[]
xtraExif
=
new
double
[
1
];
// ExposureTime
double
[]
xtraExif
=
new
double
[
1
];
// ExposureTime
// System.out.println("imp_src is "+((imp_src!=null)?"not ":"")+"null");
// System.out.println("imp_src is "+((imp_src!=null)?"not ":"")+"null");
try
{
try
{
...
@@ -389,7 +412,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -389,7 +412,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp
=
imp_src
;
imp
=
imp_src
;
}
else
if
((
imp_src
!=
null
)
&&
showImage
)
{
/* tried to reuse, but wrong size */
}
else
if
((
imp_src
!=
null
)
&&
showImage
)
{
/* tried to reuse, but wrong size */
// System.out.println("show() 2");
// System.out.println("show() 2");
imp
.
show
();
/* never did that before */
imp
.
show
();
/* never did that before */
}
}
if
((
xtraExif
!=
null
)
&&
!
Double
.
isNaN
(
xtraExif
[
0
])){
if
((
xtraExif
!=
null
)
&&
!
Double
.
isNaN
(
xtraExif
[
0
])){
imp
.
setProperty
(
"EXPOSURE"
,
String
.
format
(
"%f"
,
xtraExif
[
0
]));
imp
.
setProperty
(
"EXPOSURE"
,
String
.
format
(
"%f"
,
xtraExif
[
0
]));
...
@@ -428,7 +451,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -428,7 +451,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
double
[]
blacks
=
new
double
[
4
];
double
[]
blacks
=
new
double
[
4
];
double
[]
blacks256
=
new
double
[
4
];
double
[]
blacks256
=
new
double
[
4
];
double
[]
gammas
=
new
double
[
4
];
double
[]
gammas
=
new
double
[
4
];
long
[]
gamma_scales
=
new
long
[
4
];
/* now not used, was scale _after_ gamma is applied, 0x400(default) cor
er
sponds to 1.0 */
long
[]
gamma_scales
=
new
long
[
4
];
/* now not used, was scale _after_ gamma is applied, 0x400(default) cor
re
sponds to 1.0 */
int
i
;
int
i
;
double
[][]
rgammas
=
new
double
[
4
][];
double
[][]
rgammas
=
new
double
[
4
][];
double
min_gain
;
double
min_gain
;
...
@@ -564,7 +587,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -564,7 +587,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if
(
i
==
0
)
info
+=
"SYSTEM TEMPERATURE\t"
+
temperature
+
"\t\t\t\n"
;
if
(
i
==
0
)
info
+=
"SYSTEM TEMPERATURE\t"
+
temperature
+
"\t\t\t\n"
;
else
info
+=
"SFE "
+
i
+
" TEMPERATURE\t"
+
temperature
+
"\t\t\t\n"
;
else
info
+=
"SFE "
+
i
+
" TEMPERATURE\t"
+
temperature
+
"\t\t\t\n"
;
imp
.
setProperty
(
"TEMPERATURE_"
+
i
,
""
+
temperature
);
imp
.
setProperty
(
"TEMPERATURE_"
+
i
,
""
+
temperature
);
}
}
}
}
if
(
COMPOSITE
)
{
if
(
COMPOSITE
)
{
...
@@ -618,13 +641,15 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -618,13 +641,15 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
min_gain
=
2.0
*
gains
[
0
];
min_gain
=
2.0
*
gains
[
0
];
for
(
i
=
0
;
i
<
4
;
i
++)
{
for
(
i
=
0
;
i
<
4
;
i
++)
{
if
(
min_gain
>
gains
[
i
]*(
1.0
-
blacks
[
i
]))
min_gain
=
gains
[
i
]*(
1.0
-
blacks
[
i
]);
if
(
min_gain
>
gains
[
i
]*(
1.0
-
blacks
[
i
]))
min_gain
=
gains
[
i
]*(
1.0
-
blacks
[
i
]);
//
System.out.println("gains["+i+"]="+gains[i]+" min_gain="+min_gain);
System
.
out
.
println
(
"gains["
+
i
+
"]="
+
gains
[
i
]+
" min_gain="
+
min_gain
);
}
}
imp
.
setProperty
(
"GAIN"
,
String
.
format
(
"%f"
,
min_gain
));
// common gain
for
(
i
=
0
;
i
<
4
;
i
++)
gains
[
i
]/=
min_gain
;
for
(
i
=
0
;
i
<
4
;
i
++)
gains
[
i
]/=
min_gain
;
for
(
i
=
0
;
i
<
4
;
i
++)
blacks256
[
i
]=
256.0
*
blacks
[
i
];
for
(
i
=
0
;
i
<
4
;
i
++)
blacks256
[
i
]=
256.0
*
blacks
[
i
];
//
for (i=0;i<4;i++) {
for
(
i
=
0
;
i
<
4
;
i
++)
{
//
System.out.println("scaled gains["+i+"]="+gains[i]);
System
.
out
.
println
(
"scaled gains["
+
i
+
"]="
+
gains
[
i
]);
//
}
}
for
(
i
=
0
;
i
<
4
;
i
++)
{
for
(
i
=
0
;
i
<
4
;
i
++)
{
...
@@ -633,9 +658,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -633,9 +658,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
else
satValue
[
i
]=((
rgammas
[
i
][
255
])-
blacks256
[
i
]);
else
satValue
[
i
]=((
rgammas
[
i
][
255
])-
blacks256
[
i
]);
}
else
satValue
[
i
]=
255.0
;
}
else
satValue
[
i
]=
255.0
;
imp
.
setProperty
(
"saturation_"
+
i
,
String
.
format
(
"%f"
,
satValue
[
i
]));
imp
.
setProperty
(
"saturation_"
+
i
,
String
.
format
(
"%f"
,
satValue
[
i
]));
//
System.out.println("scaled gains["+i+"]="+gains[i]+" satValue["+i+"]="+satValue[i]);
System
.
out
.
println
(
"scaled gains["
+
i
+
"]="
+
gains
[
i
]+
" satValue["
+
i
+
"]="
+
satValue
[
i
]);
}
}
// swap satValue to match FLIPH,FLIPV again
// swap satValue to match FLIPH,FLIPV again
if
(
FLIPV
!=
0
)
{
if
(
FLIPV
!=
0
)
{
swapArrayElements
(
satValue
,
1
,
3
);
swapArrayElements
(
satValue
,
1
,
3
);
...
@@ -645,13 +670,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -645,13 +670,13 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
swapArrayElements
(
satValue
,
1
,
0
);
swapArrayElements
(
satValue
,
1
,
0
);
swapArrayElements
(
satValue
,
3
,
2
);
swapArrayElements
(
satValue
,
3
,
2
);
}
}
for
(
i
=
0
;
i
<
4
;
i
++)
{
for
(
i
=
0
;
i
<
4
;
i
++)
{
imp
.
setProperty
(
"saturation_"
+
i
,
String
.
format
(
"%f"
,
satValue
[
i
]));
imp
.
setProperty
(
"saturation_"
+
i
,
String
.
format
(
"%f"
,
satValue
[
i
]));
//System.out.println("saturation_"+i+"\t"+String.format("%f",satValue[i]));
//System.out.println("saturation_"+i+"\t"+String.format("%f",satValue[i]));
}
}
ImageProcessor
ip
=
imp
.
getProcessor
();
ImageProcessor
ip
=
imp
.
getProcessor
();
...
@@ -745,11 +770,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -745,11 +770,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
if
(
FLIPH
!=
0
)
ip_src
.
flipHorizontal
();
/* To correct Bayer */
if
(
FLIPH
!=
0
)
ip_src
.
flipHorizontal
();
/* To correct Bayer */
if
(
FLIPV
!=
0
)
ip_src
.
flipVertical
();
/* To correct Bayer */
if
(
FLIPV
!=
0
)
ip_src
.
flipVertical
();
/* To correct Bayer */
/* Is it needed here ? */
/* Is it needed here ? */
/* imp.draw();
/* imp.draw();
imp.show(); **/
imp.show(); **/
if
(
use_imp_src
)
copyProperties
(
imp
,
imp_src
);
if
(
use_imp_src
)
copyProperties
(
imp
,
imp_src
);
return
use_imp_src
;
return
use_imp_src
;
}
}
...
@@ -834,7 +859,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -834,7 +859,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
try
{
try
{
camURL
=
new
URL
(
url
);
camURL
=
new
URL
(
url
);
urlConn
=
camURL
.
openConnection
();
urlConn
=
camURL
.
openConnection
();
int
contentLength
=
4096
;
/* just read the beginning of the file */
//urlConn.getContentLength();
int
contentLength
=
4096
;
/* just read the beginning of the file */
//urlConn.getContentLength();
//inStream = new InputStreamReader(urlConn.getInputStream());
//inStream = new InputStreamReader(urlConn.getInputStream());
int
bytesRead
=
0
;
int
bytesRead
=
0
;
...
@@ -852,7 +877,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -852,7 +877,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
catch
(
MalformedURLException
e
){
}
catch
(
MalformedURLException
e
){
System
.
out
.
println
(
"Please check the URL:"
+
e
.
toString
()
);
System
.
out
.
println
(
"Please check the URL:"
+
e
.
toString
()
);
}
catch
(
IOException
e1
){
}
catch
(
IOException
e1
){
System
.
out
.
println
(
"Can't read from the Internet: "
+
e1
.
toString
()
);
System
.
out
.
println
(
"Can't read from the Internet: "
+
e1
.
toString
()
);
}
}
byte
[]
sig
=
{(
byte
)
0x92
,
0x7c
,
/* MakerNote*/
byte
[]
sig
=
{(
byte
)
0x92
,
0x7c
,
/* MakerNote*/
0x00
,
0x04
,
/* type (long)*/
0x00
,
0x04
,
/* type (long)*/
...
@@ -891,9 +916,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -891,9 +916,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return
note
;
return
note
;
}
}
long
[]
getExifData
(
byte
[]
sig
,
byte
[]
head
,
int
len
){
long
[]
getExifData
(
byte
[]
sig
,
byte
[]
head
,
int
len
){
/* search for sig array */
/* search for sig array */
int
i
=
this
.
ExifOffset
+
2
;
int
i
=
this
.
ExifOffset
+
2
;
...
@@ -934,7 +959,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -934,7 +959,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
imp
=
new
ImagePlus
(
name
,
img
);
imp
=
new
ImagePlus
(
name
,
img
);
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
return
null
;
// error loading image
return
null
;
// error loading image
}
}
if
(
imp
.
getType
()==
ImagePlus
.
COLOR_RGB
)
{
if
(
imp
.
getType
()==
ImagePlus
.
COLOR_RGB
)
{
checkGrayJpegTo32Bits
(
imp
);
checkGrayJpegTo32Bits
(
imp
);
...
@@ -951,9 +976,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -951,9 +976,11 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
return
imp
;
return
imp
;
}
}
@Override
public
void
setTitle
(
String
title
)
{
public
void
setTitle
(
String
title
)
{
imageTitle
=
title
;
imageTitle
=
title
;
}
}
@Override
public
String
getTitle
()
{
public
String
getTitle
()
{
return
imageTitle
;
return
imageTitle
;
}
}
...
@@ -964,8 +991,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -964,8 +991,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
return
camera_url
;
return
camera_url
;
}
}
ImagePlus
openJpegOrGifUsingURL
(
String
cameraurl
)
{
ImagePlus
openJpegOrGifUsingURL
(
String
cameraurl
)
{
URL
url
=
null
;
URL
url
=
null
;
ImagePlus
imp
=
null
;
ImagePlus
imp
=
null
;
Image
img
=
null
;
Image
img
=
null
;
...
@@ -1062,7 +1089,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1062,7 +1089,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
for
(
i
=
y0
;
i
<
y1
;
i
++)
{
for
(
i
=
y0
;
i
<
y1
;
i
++)
{
index
=
i
*
mapWidth
+
x0
;
index
=
i
*
mapWidth
+
x0
;
for
(
j
=
0
;
j
<
width
;
j
++)
if
(
map
[
index
++]>
0.0
)
over
++;
for
(
j
=
0
;
j
<
width
;
j
++)
if
(
map
[
index
++]>
0.0
)
over
++;
}
}
return
(
1.0
*
over
)/
width
/
height
;
return
(
1.0
*
over
)/
width
/
height
;
}
}
...
@@ -1086,7 +1113,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1086,7 +1113,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
if
(
noProperties
)
return
null
;
if
(
noProperties
)
return
null
;
//0 - red, 1,2 - green (use Math.min()), 3 - blue
//0 - red, 1,2 - green (use Math.min()), 3 - blue
for
(
i
=
0
;
i
<
4
;
i
++)
satValues
[
i
]*=
relativeThreshold
;
for
(
i
=
0
;
i
<
4
;
i
++)
satValues
[
i
]*=
relativeThreshold
;
ImageProcessor
ip
=
imp
.
getProcessor
();
ImageProcessor
ip
=
imp
.
getProcessor
();
int
width
=
imp
.
getWidth
();
int
width
=
imp
.
getWidth
();
float
[]
pixels
=(
float
[])
ip
.
getPixels
();
float
[]
pixels
=(
float
[])
ip
.
getPixels
();
...
@@ -1098,12 +1125,12 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1098,12 +1125,12 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
return
overexposed
;
return
overexposed
;
}
}
public
ImagePlus
demuxImageOrClone
(
ImagePlus
imp
,
int
numImg
)
{
public
ImagePlus
demuxImageOrClone
(
ImagePlus
imp
,
int
numImg
)
{
ImagePlus
imp_new
=
demuxImage
(
imp
,
numImg
);
ImagePlus
imp_new
=
demuxImage
(
imp
,
numImg
);
if
(
imp_new
!=
null
)
return
imp_new
;
if
(
imp_new
!=
null
)
return
imp_new
;
return
demuxClone
(
imp
);
return
demuxClone
(
imp
);
}
}
public
ImagePlus
demuxClone
(
ImagePlus
imp
)
{
public
ImagePlus
demuxClone
(
ImagePlus
imp
)
{
ImageProcessor
ip
=
imp
.
getProcessor
().
duplicate
();
ImageProcessor
ip
=
imp
.
getProcessor
().
duplicate
();
...
@@ -1122,9 +1149,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1122,9 +1149,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
}
}
return
imp_new
;
return
imp_new
;
}
}
public
ImagePlus
demuxImage
(
ImagePlus
imp
,
int
numImg
)
{
public
ImagePlus
demuxImage
(
ImagePlus
imp
,
int
numImg
)
{
int
width
=
imp
.
getWidth
();
int
width
=
imp
.
getWidth
();
// int height=imp.getHeight();
// int height=imp.getHeight();
...
@@ -1147,8 +1174,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1147,8 +1174,8 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
}
}
timestamp
=
imp
.
getProperty
(
"timestamp"
);
timestamp
=
imp
.
getProperty
(
"timestamp"
);
if
(
timestamp
!=
null
);
if
(
timestamp
!=
null
);
/*
/*
System.out.println("FLIPV="+FLIPGV+" FLIPH="+FLIPGH);
System.out.println("FLIPV="+FLIPGV+" FLIPH="+FLIPGH);
for (i=0;i<3;i++) System.out.println("FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
for (i=0;i<3;i++) System.out.println("FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
for (i=0;i<3;i++) System.out.println("HEIGHTS["+i+"]="+HEIGHTS[i]);
for (i=0;i<3;i++) System.out.println("HEIGHTS["+i+"]="+HEIGHTS[i]);
...
@@ -1178,9 +1205,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1178,9 +1205,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
// for (i=0;i<3;i++) System.out.println("Final: FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
// for (i=0;i<3;i++) System.out.println("Final: FLIPV["+i+"]= "+FLIPV[i]+" FLIPH["+i+"]= "+FLIPH[i]);
// if needed, we'll cut one pixel line. later can modify to add one extra, but then we need to duplicate the pre-last one (same Bayer),
// if needed, we'll cut one pixel line. later can modify to add one extra, but then we need to duplicate the pre-last one (same Bayer),
// not just add zeros - later before sliding FHT the two border lines are repeated for 16 times to reduce border effects.
// not just add zeros - later before sliding FHT the two border lines are repeated for 16 times to reduce border effects.
for
(
i
=
0
;
i
<
3
;
i
++)
{
for
(
i
=
0
;
i
<
3
;
i
++)
{
// System.out.println("before r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("before r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("before r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
// System.out.println("before r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
if
(((
r
[
i
].
height
&
1
)==
0
)
&
(((
r
[
i
].
y
+
FLIPV
[
i
])&
1
)!=
0
))
r
[
i
].
height
-=
2
;
if
(((
r
[
i
].
height
&
1
)==
0
)
&
(((
r
[
i
].
y
+
FLIPV
[
i
])&
1
)!=
0
))
r
[
i
].
height
-=
2
;
r
[
i
].
height
&=~
1
;
r
[
i
].
height
&=~
1
;
...
@@ -1190,10 +1217,10 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
...
@@ -1190,10 +1217,10 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
r
[
i
].
width
&=~
1
;
r
[
i
].
width
&=~
1
;
if
(((
r
[
i
].
x
+
FLIPH
[
i
])&
1
)!=
0
)
r
[
i
].
x
+=
1
;
if
(((
r
[
i
].
x
+
FLIPH
[
i
])&
1
)!=
0
)
r
[
i
].
x
+=
1
;
// System.out.println("after r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("after r["+i+"].x= "+r[i].x+" r["+i+"].width= "+r[i].width);
// System.out.println("after r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
// System.out.println("after r["+i+"].y= "+r[i].y+" r["+i+"].height= "+r[i].height);
}
}
if
(
r
[
numImg
].
height
<=
0
)
return
null
;
if
(
r
[
numImg
].
height
<=
0
)
return
null
;
// ImageProcessor ip=imp.getProcessor();
// ImageProcessor ip=imp.getProcessor();
...
@@ -1205,7 +1232,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1205,7 +1232,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
at ij.process.FloatProcessor.crop(FloatProcessor.java:706)
at ij.process.FloatProcessor.crop(FloatProcessor.java:706)
at JP46_Reader_camera.demuxImage(JP46_Reader_camera.java:1104)
at JP46_Reader_camera.demuxImage(JP46_Reader_camera.java:1104)
at CalibrationHardwareInterface$CamerasInterface$4.run(CalibrationHardwareInterface.java:1101)
at CalibrationHardwareInterface$CamerasInterface$4.run(CalibrationHardwareInterface.java:1101)
*/
*/
// ImageProcessor ip=imp.getProcessor();
// ImageProcessor ip=imp.getProcessor();
// ip.setRoi(r[numImg]);
// ip.setRoi(r[numImg]);
...
@@ -1241,7 +1268,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1241,7 +1268,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
}
}
if (timestamp!=null)imp_result.setProperty("timestamp", timestamp);
if (timestamp!=null)imp_result.setProperty("timestamp", timestamp);
*/
*/
// fill in meta data
// fill in meta data
return
imp_result
;
return
imp_result
;
}
}
public
void
copyProperties
(
ImagePlus
imp_src
,
ImagePlus
imp_dst
){
public
void
copyProperties
(
ImagePlus
imp_src
,
ImagePlus
imp_dst
){
...
@@ -1260,8 +1287,8 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1260,8 +1287,8 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
}
}
}
}
}
}
public
ImagePlus
encodeProperiesToInfo
(
ImagePlus
imp
){
public
ImagePlus
encodeProperiesToInfo
(
ImagePlus
imp
){
String
info
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties>"
;
String
info
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties>"
;
Set
<
Object
>
jp4_set
;
Set
<
Object
>
jp4_set
;
...
@@ -1285,7 +1312,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1285,7 +1312,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
public
boolean
decodeProperiesFromInfo
(
ImagePlus
imp
){
public
boolean
decodeProperiesFromInfo
(
ImagePlus
imp
){
if
(
imp
.
getProperty
(
"Info"
)==
null
)
return
false
;
if
(
imp
.
getProperty
(
"Info"
)==
null
)
return
false
;
String
xml
=
(
String
)
imp
.
getProperty
(
"Info"
);
String
xml
=
(
String
)
imp
.
getProperty
(
"Info"
);
DocumentBuilder
db
=
null
;
DocumentBuilder
db
=
null
;
try
{
try
{
db
=
DocumentBuilderFactory
.
newInstance
().
newDocumentBuilder
();
db
=
DocumentBuilderFactory
.
newInstance
().
newDocumentBuilder
();
...
@@ -1307,9 +1334,9 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1307,9 +1334,9 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
String
name
=
allNodes
.
item
(
i
).
getNodeName
();
String
name
=
allNodes
.
item
(
i
).
getNodeName
();
String
value
=
allNodes
.
item
(
i
).
getFirstChild
().
getNodeValue
();
String
value
=
allNodes
.
item
(
i
).
getFirstChild
().
getNodeValue
();
imp
.
setProperty
(
name
,
value
);
imp
.
setProperty
(
name
,
value
);
}
}
return
true
;
return
true
;
}
}
/**
/**
...
@@ -1331,7 +1358,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
...
@@ -1331,7 +1358,7 @@ Exception in thread "Thread-3564" java.lang.ArrayIndexOutOfBoundsException: 8970
// run the plugin
// run the plugin
IJ
.
runPlugIn
(
clazz
.
getName
(),
""
);
IJ
.
runPlugIn
(
clazz
.
getName
(),
""
);
}
}
}
}
...
...
src/main/java/QuadCLT.java
View file @
9e5d4e97
...
@@ -4069,6 +4069,7 @@ public class QuadCLT {
...
@@ -4069,6 +4069,7 @@ public class QuadCLT {
// Save as individual JPEG images in the model directory
// Save as individual JPEG images in the model directory
String
x3d_path
=
correctionsParameters
.
selectX3dDirectory
(
String
x3d_path
=
correctionsParameters
.
selectX3dDirectory
(
name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters
.
x3dModelVersion
,
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
++){
...
@@ -7039,6 +7040,7 @@ public class QuadCLT {
...
@@ -7039,6 +7040,7 @@ public class QuadCLT {
}
}
String
x3d_path
=
correctionsParameters
.
selectX3dDirectory
(
// for x3d and obj
String
x3d_path
=
correctionsParameters
.
selectX3dDirectory
(
// for x3d and obj
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters
.
x3dModelVersion
,
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
...
@@ -7559,6 +7561,7 @@ public class QuadCLT {
...
@@ -7559,6 +7561,7 @@ public class QuadCLT {
String
path
=
correctionsParameters
.
selectX3dDirectory
(
String
path
=
correctionsParameters
.
selectX3dDirectory
(
//TODO: Which one to use - name or this.image_name ?
//TODO: Which one to use - name or this.image_name ?
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters
.
x3dModelVersion
,
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
...
@@ -7707,6 +7710,7 @@ public class QuadCLT {
...
@@ -7707,6 +7710,7 @@ public class QuadCLT {
String
path
=
correctionsParameters
.
selectX3dDirectory
(
String
path
=
correctionsParameters
.
selectX3dDirectory
(
//TODO: Which one to use - name or this.image_name ?
//TODO: Which one to use - name or this.image_name ?
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
this
.
image_name
,
// quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters
.
x3dModelVersion
,
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
// name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
...
...
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