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
825895a1
Commit
825895a1
authored
Nov 10, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to "Calculate grids" to skip re-calculation of existing
grid files
parent
95e22adf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
6 deletions
+37
-6
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+22
-3
Distortions.java
src/main/java/Distortions.java
+9
-0
Goniometer.java
src/main/java/Goniometer.java
+1
-1
MatchSimulatedPattern.java
src/main/java/MatchSimulatedPattern.java
+5
-2
No files found.
src/main/java/Aberration_Calibration.java
View file @
825895a1
...
@@ -2027,7 +2027,7 @@ if (MORE_BUTTONS) {
...
@@ -2027,7 +2027,7 @@ if (MORE_BUTTONS) {
COMPONENTS
.
equalizeGreens
,
COMPONENTS
.
equalizeGreens
,
imp_sel
,
//distortions, // image to process
imp_sel
,
//distortions, // image to process
THREADS_MAX
);
THREADS_MAX
);
ImagePlus
imp_calibrated0
=
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
numAbsolutePoints
);
ImagePlus
imp_calibrated0
=
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
"grid-"
,
numAbsolutePoints
);
imp_calibrated0
.
show
();
imp_calibrated0
.
show
();
// }
// }
// } else {
// } else {
...
@@ -2683,12 +2683,14 @@ if (MORE_BUTTONS) {
...
@@ -2683,12 +2683,14 @@ if (MORE_BUTTONS) {
}
}
long
startTime
=
System
.
nanoTime
();
long
startTime
=
System
.
nanoTime
();
boolean
noMessageBoxes
=
true
;
boolean
noMessageBoxes
=
true
;
String
prefix
=
"grid-"
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DISTORTION_PROCESS_CONFIGURATION
.
debugLevel
=
MASTER_DEBUG_LEVEL
;
DISTORTION_PROCESS_CONFIGURATION
.
debugLevel
=
MASTER_DEBUG_LEVEL
;
if
(
matchSimulatedPattern
==
null
)
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
DISTORTION
.
FFTSize
);
if
(
matchSimulatedPattern
==
null
)
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
DISTORTION
.
FFTSize
);
matchSimulatedPattern
.
debugLevel
=
MASTER_DEBUG_LEVEL
;
matchSimulatedPattern
.
debugLevel
=
MASTER_DEBUG_LEVEL
;
String
[]
sourceFilesList
=
DISTORTION_PROCESS_CONFIGURATION
.
selectSourceFiles
();
// select files - with/without dialog
String
[]
sourceFilesList
=
DISTORTION_PROCESS_CONFIGURATION
.
selectSourceFiles
();
// select files - with/without dialog
boolean
saveGrids
=
DISTORTION_PROCESS_CONFIGURATION
.
saveGridImages
;
boolean
saveGrids
=
DISTORTION_PROCESS_CONFIGURATION
.
saveGridImages
;
boolean
overwriteGrids
=
DISTORTION_PROCESS_CONFIGURATION
.
overwriteResultFiles
;
if
(
sourceFilesList
==
null
)
return
;
if
(
sourceFilesList
==
null
)
return
;
showPatternMinMaxPeriodDialog
(
PATTERN_DETECT
);
showPatternMinMaxPeriodDialog
(
PATTERN_DETECT
);
for
(
int
numFile
=
0
;
numFile
<
sourceFilesList
.
length
;
numFile
++){
for
(
int
numFile
=
0
;
numFile
<
sourceFilesList
.
length
;
numFile
++){
...
@@ -2696,6 +2698,23 @@ if (MORE_BUTTONS) {
...
@@ -2696,6 +2698,23 @@ if (MORE_BUTTONS) {
if
(
DEBUG_LEVEL
>
0
){
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
"s: Processing file # "
+(
numFile
+
1
)+
" (of "
+
sourceFilesList
.
length
+
"): "
+
sourceFilesList
[
numFile
]);
System
.
out
.
println
(
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
"s: Processing file # "
+(
numFile
+
1
)+
" (of "
+
sourceFilesList
.
length
+
"): "
+
sourceFilesList
[
numFile
]);
}
}
if
(
saveGrids
&&
!
overwriteGrids
){
// check if result already exists
int
i
=
sourceFilesList
[
numFile
].
lastIndexOf
(
'/'
);
if
(
i
>
0
){
String
path
=
prefix
+
sourceFilesList
[
numFile
].
substring
(
i
+
1
);
String
srcDir
=
DISTORTION_PROCESS_CONFIGURATION
.
selectGridFileDirectory
(
true
,
DISTORTION_PROCESS_CONFIGURATION
.
gridDirectory
,
true
);
if
(
srcDir
==
null
){
saveGrids
=
false
;
// do not ask about the next ones too
}
else
{
path
=
DISTORTION_PROCESS_CONFIGURATION
.
gridDirectory
+
Prefs
.
getFileSeparator
()+
path
;
File
rsltFile
=
new
File
(
path
);
if
((
new
File
(
path
)).
exists
()){
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"-->>> Skipping existing "
+
path
+
" (as requested in \"Configure Process Distortions\")"
);
continue
;
}
}
}
}
imp_sel
=
new
ImagePlus
(
sourceFilesList
[
numFile
]);
// read source file
imp_sel
=
new
ImagePlus
(
sourceFilesList
[
numFile
]);
// read source file
JP4_INSTANCE
.
decodeProperiesFromInfo
(
imp_sel
);
JP4_INSTANCE
.
decodeProperiesFromInfo
(
imp_sel
);
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
DISTORTION
.
FFTSize
);
// TODO: is it needed each time?
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
DISTORTION
.
FFTSize
);
// TODO: is it needed each time?
...
@@ -2743,7 +2762,7 @@ if (MORE_BUTTONS) {
...
@@ -2743,7 +2762,7 @@ if (MORE_BUTTONS) {
COMPONENTS
.
equalizeGreens
,
COMPONENTS
.
equalizeGreens
,
imp_sel
,
// image to process
imp_sel
,
// image to process
THREADS_MAX
);
THREADS_MAX
);
ImagePlus
imp_calibrated
=
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
numAbsolutePoints
);
ImagePlus
imp_calibrated
=
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
prefix
,
numAbsolutePoints
);
if
(
DISTORTION_PROCESS_CONFIGURATION
.
showGridImages
)
imp_calibrated
.
show
();
if
(
DISTORTION_PROCESS_CONFIGURATION
.
showGridImages
)
imp_calibrated
.
show
();
if
(
saveGrids
){
if
(
saveGrids
){
FileSaver
fs
=
new
FileSaver
(
imp_calibrated
);
FileSaver
fs
=
new
FileSaver
(
imp_calibrated
);
...
@@ -3695,7 +3714,7 @@ if (MORE_BUTTONS) {
...
@@ -3695,7 +3714,7 @@ if (MORE_BUTTONS) {
return
;
return
;
}
}
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"Matched "
+
numAbsolutePoints
+
" laser pointers, grid generated at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"Matched "
+
numAbsolutePoints
+
" laser pointers, grid generated at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
ImagePlus
[]
imp_calibrated
={
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
numAbsolutePoints
)};
ImagePlus
[]
imp_calibrated
={
matchSimulatedPattern
.
getCalibratedPatternAsImage
(
imp_sel
,
"grid-"
,
numAbsolutePoints
)};
if
(
FOCUS_MEASUREMENT_PARAMETERS
.
showAcquiredImages
)
imp_calibrated
[
0
].
show
();
// DISTORTION_PROCESS_CONFIGURATION.showGridImages
if
(
FOCUS_MEASUREMENT_PARAMETERS
.
showAcquiredImages
)
imp_calibrated
[
0
].
show
();
// DISTORTION_PROCESS_CONFIGURATION.showGridImages
if
(
findCenter
){
if
(
findCenter
){
// Read required calibration files
// Read required calibration files
...
...
src/main/java/Distortions.java
View file @
825895a1
...
@@ -20272,6 +20272,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -20272,6 +20272,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
public boolean removeOutOfGridPointers=true;
public boolean removeOutOfGridPointers=true;
public boolean showGridImages=false;
public boolean showGridImages=false;
public boolean saveGridImages=true;
public boolean saveGridImages=true;
public boolean overwriteResultFiles=false;
public int debugLevel=1;
public int debugLevel=1;
public String selectSourceDirectory(boolean smart, String defaultPath, boolean newAllowed) {
public String selectSourceDirectory(boolean smart, String defaultPath, boolean newAllowed) {
...
@@ -20308,6 +20309,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -20308,6 +20309,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
properties.setProperty(prefix+"removeOutOfGridPointers",this.removeOutOfGridPointers+"");
properties.setProperty(prefix+"removeOutOfGridPointers",this.removeOutOfGridPointers+"");
properties.setProperty(prefix+"showGridImages", this.showGridImages+"");
properties.setProperty(prefix+"showGridImages", this.showGridImages+"");
properties.setProperty(prefix+"saveGridImages", this.saveGridImages+"");
properties.setProperty(prefix+"saveGridImages", this.saveGridImages+"");
properties.setProperty(prefix+"overwriteResultFiles", this.overwriteResultFiles+"");
properties.setProperty(prefix+"debugLevel", this.debugLevel+"");
properties.setProperty(prefix+"debugLevel", this.debugLevel+"");
}
}
public void getProperties(String prefix,Properties properties){
public void getProperties(String prefix,Properties properties){
...
@@ -20331,6 +20333,8 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -20331,6 +20333,8 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
this.showGridImages=Boolean.parseBoolean(properties.getProperty(prefix+"showGridImages"));
this.showGridImages=Boolean.parseBoolean(properties.getProperty(prefix+"showGridImages"));
if (properties.getProperty(prefix+"saveGridImages")!=null)
if (properties.getProperty(prefix+"saveGridImages")!=null)
this.saveGridImages=Boolean.parseBoolean(properties.getProperty(prefix+"saveGridImages"));
this.saveGridImages=Boolean.parseBoolean(properties.getProperty(prefix+"saveGridImages"));
if (properties.getProperty(prefix+"overwriteResultFiles")!=null)
this.overwriteResultFiles=Boolean.parseBoolean(properties.getProperty(prefix+"overwriteResultFiles"));
if (properties.getProperty(prefix+"debugLevel")!=null)
if (properties.getProperty(prefix+"debugLevel")!=null)
this.debugLevel=Integer.parseInt(properties.getProperty(prefix+"debugLevel"));
this.debugLevel=Integer.parseInt(properties.getProperty(prefix+"debugLevel"));
}
}
...
@@ -20346,6 +20350,10 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -20346,6 +20350,10 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
gd.addCheckbox ("Remove detected laser pointers if they are outside of the grid", this.removeOutOfGridPointers);
gd.addCheckbox ("Remove detected laser pointers if they are outside of the grid", this.removeOutOfGridPointers);
gd.addCheckbox ("Show grid files as images", this.showGridImages);
gd.addCheckbox ("Show grid files as images", this.showGridImages);
gd.addCheckbox ("Save grid files", this.saveGridImages);
gd.addCheckbox ("Save grid files", this.saveGridImages);
gd.addCheckbox ("Overwrite existing result files", this.overwriteResultFiles);
gd.addNumericField("Debug level", this.debugLevel,0);
gd.addNumericField("Debug level", this.debugLevel,0);
WindowTools.addScrollBars(gd);
WindowTools.addScrollBars(gd);
gd.showDialog();
gd.showDialog();
...
@@ -20360,6 +20368,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -20360,6 +20368,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
this.removeOutOfGridPointers=gd.getNextBoolean();
this.removeOutOfGridPointers=gd.getNextBoolean();
this.showGridImages= gd.getNextBoolean();
this.showGridImages= gd.getNextBoolean();
this.saveGridImages= gd.getNextBoolean();
this.saveGridImages= gd.getNextBoolean();
this.overwriteResultFiles= gd.getNextBoolean();
this.debugLevel= (int) gd.getNextNumber();
this.debugLevel= (int) gd.getNextNumber();
System.out.println("1.newSourceDirectory = "+newSourceDirectory);
System.out.println("1.newSourceDirectory = "+newSourceDirectory);
System.out.println("1.newGridDirectory = "+ newGridDirectory);
System.out.println("1.newGridDirectory = "+ newGridDirectory);
src/main/java/Goniometer.java
View file @
825895a1
...
@@ -848,7 +848,7 @@ horizontal axis:
...
@@ -848,7 +848,7 @@ horizontal axis:
// TODO - here - multiple images possible, not just one!
// TODO - here - multiple images possible, not just one!
// First - create sparse, then remove nulls
// First - create sparse, then remove nulls
imp_calibrated
[
numSensor
]
=
this
.
matchSimulatedPatterns
[
numSensor
].
getCalibratedPatternAsImage
(
images
[
numSensor
],
numAbsolutePoints
);
imp_calibrated
[
numSensor
]
=
this
.
matchSimulatedPatterns
[
numSensor
].
getCalibratedPatternAsImage
(
images
[
numSensor
],
"grid-"
,
numAbsolutePoints
);
if
(
this
.
goniometerParameters
.
showAcquiredImages
)
if
(
this
.
goniometerParameters
.
showAcquiredImages
)
imp_calibrated
[
numSensor
].
show
();
// DISTORTION_PROCESS_CONFIGURATION.showGridImages
imp_calibrated
[
numSensor
].
show
();
// DISTORTION_PROCESS_CONFIGURATION.showGridImages
}
// for (int numSensor=0;numSensor<images.length;numSensor++) if
}
// for (int numSensor=0;numSensor<images.length;numSensor++) if
...
...
src/main/java/MatchSimulatedPattern.java
View file @
825895a1
...
@@ -7168,8 +7168,11 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -7168,8 +7168,11 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
ImagePlus
imp
=
new
ImagePlus
(
title
,
stack
);
ImagePlus
imp
=
new
ImagePlus
(
title
,
stack
);
return
imp
;
return
imp
;
}
}
public
ImagePlus
getCalibratedPatternAsImage
(
ImagePlus
imp_src
,
int
numUsedPointers
){
public
ImagePlus
getCalibratedPatternAsImage
(
ImagePlus
imp_result
=
getCalibratedPatternAsImage
(
"grid-"
+
imp_src
.
getTitle
(),
numUsedPointers
);
ImagePlus
imp_src
,
String
prefix
,
int
numUsedPointers
){
// ImagePlus imp_result=getCalibratedPatternAsImage("grid-"+imp_src.getTitle(), numUsedPointers);
ImagePlus
imp_result
=
getCalibratedPatternAsImage
(
prefix
+
imp_src
.
getTitle
(),
numUsedPointers
);
// copy all the properties to the new image
// copy all the properties to the new image
JP46_Reader_camera
jp4_instance
=
new
JP46_Reader_camera
(
false
);
JP46_Reader_camera
jp4_instance
=
new
JP46_Reader_camera
(
false
);
jp4_instance
.
copyProperties
(
imp_src
,
imp_result
);
jp4_instance
.
copyProperties
(
imp_src
,
imp_result
);
...
...
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