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
3e7f255e
Commit
3e7f255e
authored
Feb 11, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aberration correction with clt
parent
2e50bfb7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1373 additions
and
123 deletions
+1373
-123
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+104
-52
EyesisCorrections.java
src/main/java/EyesisCorrections.java
+46
-1
EyesisDCT.java
src/main/java/EyesisDCT.java
+702
-29
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+88
-14
ImageDtt.java
src/main/java/ImageDtt.java
+433
-27
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
3e7f255e
This diff is collapsed.
Click to expand it.
src/main/java/EyesisCorrections.java
View file @
3e7f255e
...
@@ -2076,8 +2076,53 @@ public class EyesisCorrections {
...
@@ -2076,8 +2076,53 @@ public class EyesisCorrections {
outStack
.
addSlice
(
chnNames
[
chn
],
outPixels
[
chn
]);
outStack
.
addSlice
(
chnNames
[
chn
],
outPixels
[
chn
]);
}
}
return
outStack
;
return
outStack
;
}
}
// return 2-d double array instead of the stack
public
double
[][]
bayerToDoubleStack
(
ImagePlus
imp
,
// source bayer image, linearized, 32-bit (float))
EyesisCorrectionParameters
.
SplitParameters
splitParameters
){
// if null - no margins, no oversample
if
(
imp
==
null
)
return
null
;
boolean
adv
=
splitParameters
!=
null
;
int
oversample
=
adv
?
splitParameters
.
oversample
:
1
;
int
addTop
=
adv
?
splitParameters
.
addTop
:
0
;
int
addLeft
=
adv
?
splitParameters
.
addLeft
:
0
;
int
addBottom
=
adv
?
splitParameters
.
addBottom
:
0
;
int
addRight
=
adv
?
splitParameters
.
addRight
:
0
;
String
[]
chnNames
={
"Red"
,
"Blue"
,
"Green"
};
//Different sequence than RGB!!
int
nChn
=
chnNames
.
length
;
ImageProcessor
ip
=
imp
.
getProcessor
();
int
inWidth
=
imp
.
getWidth
();
int
inHeight
=
imp
.
getHeight
();
int
outHeight
=
inHeight
*
oversample
+
addTop
+
addBottom
;
int
outWidth
=
inWidth
*
oversample
+
addLeft
+
addRight
;
int
outLength
=
outWidth
*
outHeight
;
double
[][]
outPixels
=
new
double
[
nChn
][
outLength
];
float
[]
pixels
=
(
float
[])
ip
.
getPixels
();
int
chn
,
y
,
x
,
i
,
index
;
int
bayerPeriod
=
2
*
oversample
;
int
ovrWidth
=
inWidth
*
oversample
;
int
ovrHeight
=
inHeight
*
oversample
;
for
(
chn
=
0
;
chn
<
nChn
;
chn
++)
for
(
i
=
0
;
i
<
outPixels
[
chn
].
length
;
i
++)
outPixels
[
chn
][
i
]=
0.0f
;
/* Can be optimized - now it calculate input address for all those 0-es */
for
(
index
=
0
;
index
<
outLength
;
index
++)
{
y
=(
index
/
outWidth
)
-
addTop
;
x
=(
index
%
outWidth
)
-
addLeft
;
if
(
y
<
0
)
y
=
(
bayerPeriod
-((-
y
)
%
bayerPeriod
))%
bayerPeriod
;
else
if
(
y
>=
ovrHeight
)
y
=
ovrHeight
-
bayerPeriod
+((
y
-
ovrHeight
)
%
bayerPeriod
);
if
(
x
<
0
)
x
=
(
bayerPeriod
-((-
x
)
%
bayerPeriod
))%
bayerPeriod
;
else
if
(
x
>=
ovrWidth
)
x
=
ovrWidth
-
bayerPeriod
+((
x
-
ovrWidth
)
%
bayerPeriod
);
if
(((
y
%
oversample
)==
0
)
&&
((
x
%
oversample
)==
0
))
{
x
/=
oversample
;
y
/=
oversample
;
chn
=((
x
&
1
)==(
y
&
1
))?
2
:(((
x
&
1
)!=
0
)?
0
:
1
);
outPixels
[
chn
][
index
]=
pixels
[
y
*
inWidth
+
x
];
}
}
return
outPixels
;
}
//double [] DENOISE_MASK=null;
//double [] DENOISE_MASK=null;
...
...
src/main/java/EyesisDCT.java
View file @
3e7f255e
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
3e7f255e
...
@@ -2890,16 +2890,7 @@ private Panel panel1,
...
@@ -2890,16 +2890,7 @@ private Panel panel1,
int
numChannels
=
EYESIS_CORRECTIONS
.
getNumChannels
();
int
numChannels
=
EYESIS_CORRECTIONS
.
getNumChannels
();
NONLIN_PARAMETERS
.
modifyNumChannels
(
numChannels
);
NONLIN_PARAMETERS
.
modifyNumChannels
(
numChannels
);
CHANNEL_GAINS_PARAMETERS
.
modifyNumChannels
(
numChannels
);
CHANNEL_GAINS_PARAMETERS
.
modifyNumChannels
(
numChannels
);
/*
if (CORRECTION_PARAMETERS.deconvolve && (NONLIN_PARAMETERS.noiseGainPower!=0)) {
EYESIS_CORRECTIONS.updateImageNoiseGains(
NONLIN_PARAMETERS, //EyesisCorrectionParameters.NonlinParameters nonlinParameters,
CONVOLVE_FFT_SIZE, //int fftSize, // 128 - fft size, kernel size should be size/2
THREADS_MAX, // int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // boolean updateStatus,
DEBUG_LEVEL); //int globalDebugLevel){
}
*/
if
(!
EYESIS_DCT
.
DCTKernelsAvailable
()){
if
(!
EYESIS_DCT
.
DCTKernelsAvailable
()){
if
(
DEBUG_LEVEL
>
0
){
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Reading/converting DCT kernels"
);
System
.
out
.
println
(
"Reading/converting DCT kernels"
);
...
@@ -2914,11 +2905,7 @@ private Panel panel1,
...
@@ -2914,11 +2905,7 @@ private Panel panel1,
EYESIS_DCT
.
showKernels
();
// show restored kernels
EYESIS_DCT
.
showKernels
();
// show restored kernels
}
}
}
}
// EYESIS_CORRECTIONS.processChannelImages(
EYESIS_DCT
.
processDCTChannelImages
(
EYESIS_DCT
.
processDCTChannelImages
(
// SPLIT_PARAMETERS, // EyesisCorrectionParameters.SplitParameters splitParameters,
DCT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DCT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
NONLIN_PARAMETERS
,
//EyesisCorrectionParameters.NonlinParameters nonlinParameters,
NONLIN_PARAMETERS
,
//EyesisCorrectionParameters.NonlinParameters nonlinParameters,
...
@@ -4096,6 +4083,7 @@ private Panel panel1,
...
@@ -4096,6 +4083,7 @@ private Panel panel1,
if
(
EYESIS_DCT
!=
null
){
if
(
EYESIS_DCT
!=
null
){
EYESIS_DCT
.
resetCLTKernels
();
EYESIS_DCT
.
resetCLTKernels
();
}
}
}
else
if
(
label
.
equals
(
"Read CLT kernels"
))
{
}
else
if
(
label
.
equals
(
"Read CLT kernels"
))
{
if
(!
CLT_PARAMETERS
.
showDialog
())
return
;
if
(!
CLT_PARAMETERS
.
showDialog
())
return
;
if
(
EYESIS_DCT
==
null
){
if
(
EYESIS_DCT
==
null
){
...
@@ -4145,6 +4133,92 @@ private Panel panel1,
...
@@ -4145,6 +4133,92 @@ private Panel panel1,
DEBUG_LEVEL
);
DEBUG_LEVEL
);
}
}
return
;
}
else
if
(
label
.
equals
(
"CLT process files"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
if
(
EYESIS_DCT
==
null
){
EYESIS_DCT
=
new
EyesisDCT
(
EYESIS_CORRECTIONS
,
CORRECTION_PARAMETERS
,
DCT_PARAMETERS
);
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Created new EyesisDCT instance, will need to read CLT kernels"
);
}
}
String
configPath
=
null
;
if
(
EYESIS_CORRECTIONS
.
correctionsParameters
.
saveSettings
)
{
configPath
=
EYESIS_CORRECTIONS
.
correctionsParameters
.
selectResultsDirectory
(
true
,
true
);
if
(
configPath
==
null
){
String
msg
=
"No results directory selected, command aborted"
;
System
.
out
.
println
(
"Warning: "
+
msg
);
IJ
.
showMessage
(
"Warning"
,
msg
);
return
;
}
configPath
+=
Prefs
.
getFileSeparator
()+
"autoconfig"
;
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
;
}
}
EYESIS_CORRECTIONS
.
initSensorFiles
(
DEBUG_LEVEL
);
int
numChannels
=
EYESIS_CORRECTIONS
.
getNumChannels
();
NONLIN_PARAMETERS
.
modifyNumChannels
(
numChannels
);
CHANNEL_GAINS_PARAMETERS
.
modifyNumChannels
(
numChannels
);
if
(!
EYESIS_DCT
.
CLTKernelsAvailable
()){
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Reading CLT kernels"
);
}
EYESIS_DCT
.
readCLTKernels
(
CLT_PARAMETERS
,
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
if
(
DEBUG_LEVEL
>
1
){
EYESIS_DCT
.
showCLTKernels
(
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
}
}
///========================================
EYESIS_DCT
.
processCLTChannelImages
(
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
NONLIN_PARAMETERS
,
//EyesisCorrectionParameters.NonlinParameters nonlinParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS
,
//CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
CONVOLVE_FFT_SIZE
,
//int convolveFFTSize, // 128 - fft size, kernel size should be size/2
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
//final int debugLevel);
if
(
configPath
!=
null
)
{
saveTimestampedProperties
(
// save config again
configPath
,
// full path or null
null
,
// use as default directory if path==null
true
,
PROPERTIES
);
}
return
;
return
;
// End of buttons code
// End of buttons code
...
...
src/main/java/ImageDtt.java
View file @
3e7f255e
This diff is collapsed.
Click to expand it.
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