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
681a226e
Commit
681a226e
authored
Jul 02, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved ML output, testing batch execution
parent
77684393
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1663 additions
and
703 deletions
+1663
-703
EyesisCorrectionParameters.java
...com/elphel/imagej/cameras/EyesisCorrectionParameters.java
+57
-1
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+5
-2
ElphelJp4Reader.java
src/main/java/com/elphel/imagej/readers/ElphelJp4Reader.java
+20
-20
ElphelTiffReader.java
...main/java/com/elphel/imagej/readers/ElphelTiffReader.java
+31
-25
ImagejJp4Tiff.java
src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java
+3
-3
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+1
-1
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+347
-149
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+963
-410
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+3
-3
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+95
-50
TileProcessor.java
...n/java/com/elphel/imagej/tileprocessor/TileProcessor.java
+7
-6
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+131
-33
No files found.
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java
View file @
681a226e
...
...
@@ -201,7 +201,10 @@ public class EyesisCorrectionParameters {
public
String
x3dModelVersion
=
"v01"
;
public
String
jp4SubDir
=
"jp4"
;
// FIXME:
public
String
linkedModels
=
""
;
// linked models with reference scenes
public
String
x3dDirectory
=
""
;
public
String
videoDirectory
=
""
;
// combined (with MPEG) from multiple scene sequences video files
public
String
mlDirectory
=
"ml"
;
...
...
@@ -308,6 +311,8 @@ public class EyesisCorrectionParameters {
cp
.
referenceExposure
=
this
.
referenceExposure
;
cp
.
relativeExposure
=
this
.
relativeExposure
;
cp
.
swapSubchannels01
=
this
.
swapSubchannels01
;
cp
.
linkedModels
=
this
.
linkedModels
;
cp
.
videoDirectory
=
this
.
videoDirectory
;
cp
.
x3dDirectory
=
this
.
x3dDirectory
;
cp
.
mlDirectory
=
this
.
mlDirectory
;
cp
.
use_x3d_subdirs
=
this
.
use_x3d_subdirs
;
...
...
@@ -514,6 +519,8 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"cltKernelPrefix"
,
this
.
cltKernelPrefix
);
properties
.
setProperty
(
prefix
+
"cltSuffix"
,
this
.
cltSuffix
);
properties
.
setProperty
(
prefix
+
"linkedModels"
,
this
.
linkedModels
);
properties
.
setProperty
(
prefix
+
"videoDirectory"
,
this
.
videoDirectory
);
properties
.
setProperty
(
prefix
+
"x3dDirectory"
,
this
.
x3dDirectory
);
properties
.
setProperty
(
prefix
+
"use_x3d_subdirs"
,
this
.
use_x3d_subdirs
+
""
);
...
...
@@ -701,6 +708,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"cltKernelPrefix"
)!=
null
)
this
.
cltKernelPrefix
=
properties
.
getProperty
(
prefix
+
"cltKernelPrefix"
);
if
(
properties
.
getProperty
(
prefix
+
"cltSuffix"
)!=
null
)
this
.
cltSuffix
=
properties
.
getProperty
(
prefix
+
"cltSuffix"
);
if
(
properties
.
getProperty
(
prefix
+
"linkedModels"
)!=
null
)
this
.
linkedModels
=
properties
.
getProperty
(
prefix
+
"linkedModels"
);
if
(
properties
.
getProperty
(
prefix
+
"videoDirectory"
)!=
null
)
this
.
videoDirectory
=
properties
.
getProperty
(
prefix
+
"videoDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"x3dDirectory"
)!=
null
)
this
.
x3dDirectory
=
properties
.
getProperty
(
prefix
+
"x3dDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
)!=
null
)
this
.
use_x3d_subdirs
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"use_x3d_subdirs"
));
...
...
@@ -870,8 +879,18 @@ public class EyesisCorrectionParameters {
gd
.
addStringField
(
"x3d model version"
,
this
.
x3dModelVersion
,
20
);
// 10a
gd
.
addStringField
(
"JP4 source image copy model subdirectory"
,
this
.
jp4SubDir
,
20
);
// 10b
gd
.
addStringField
(
"Linked reference models"
,
this
.
linkedModels
,
60
,
"Directory where links to reference models directories will be created."
);
gd
.
addCheckbox
(
"Select linked reference models directory"
,
false
);
gd
.
addStringField
(
"Video directory"
,
this
.
videoDirectory
,
60
,
"Directory to store combined video files."
);
gd
.
addCheckbox
(
"Select video directory"
,
false
);
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
gd
.
addCheckbox
(
"Select x3d output directory"
,
false
);
gd
.
addCheckbox
(
"Use individual subdirectory for each 3d model (timestamp as name)"
,
this
.
use_x3d_subdirs
);
gd
.
addStringField
(
"x3d subdirectory prefix"
,
this
.
x3dSubdirPrefix
,
10
,
...
...
@@ -994,6 +1013,8 @@ public class EyesisCorrectionParameters {
this
.
cltKernelDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectCLTKernelDirectory
(
false
,
true
);
this
.
x3dModelVersion
=
gd
.
getNextString
();
// 10a
this
.
jp4SubDir
=
gd
.
getNextString
();
// 10b
this
.
linkedModels
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectLinkedModelsDirectory
(
false
,
true
);
this
.
videoDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectVideoDirectory
(
false
,
true
);
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
...
...
@@ -1065,6 +1086,15 @@ public class EyesisCorrectionParameters {
gd
.
addStringField
(
"x3d model version"
,
this
.
x3dModelVersion
,
60
);
// 10a
gd
.
addStringField
(
"jp4 source copy subdirectory"
,
this
.
jp4SubDir
,
60
);
// 10b
gd
.
addStringField
(
"Linked reference models"
,
this
.
linkedModels
,
60
,
"Directory where links to reference models directories will be created."
);
gd
.
addCheckbox
(
"Select linked reference models directory"
,
false
);
gd
.
addStringField
(
"Video directory"
,
this
.
videoDirectory
,
60
,
"Directory to store combined video files."
);
gd
.
addCheckbox
(
"Select video directory"
,
false
);
gd
.
addStringField
(
"x3d output directory"
,
this
.
x3dDirectory
,
60
);
// 8
gd
.
addCheckbox
(
"Select x3d output (top model) directory"
,
false
);
// 9
...
...
@@ -1230,6 +1260,8 @@ public class EyesisCorrectionParameters {
this
.
x3dModelVersion
=
gd
.
getNextString
();
// 10a
this
.
jp4SubDir
=
gd
.
getNextString
();
// 10b
this
.
linkedModels
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectLinkedModelsDirectory
(
false
,
true
);
this
.
videoDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectVideoDirectory
(
false
,
true
);
this
.
x3dDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectX3dDirectory
(
false
,
true
);
// 9
this
.
use_x3d_subdirs
=
gd
.
getNextBoolean
();
// 10
// this.sourcePrefix= gd.getNextString(); // 13
...
...
@@ -2192,6 +2224,31 @@ public class EyesisCorrectionParameters {
return
dir
;
}
public
String
selectLinkedModelsDirectory
(
boolean
smart
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
newAllowed
,
// save
"linked models directory"
,
// title
"Select linked models directory"
,
// button
null
,
// filter
this
.
linkedModels
);
//this.sourceDirectory);
if
(
dir
!=
null
)
this
.
linkedModels
=
dir
;
return
dir
;
}
public
String
selectVideoDirectory
(
boolean
smart
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
newAllowed
,
// save
"video directory"
,
// title
"Select video directory"
,
// button
null
,
// filter
this
.
videoDirectory
);
//this.sourceDirectory);
if
(
dir
!=
null
)
this
.
videoDirectory
=
dir
;
return
dir
;
}
public
String
selectMlDirectory
(
String
name
,
boolean
smart
,
boolean
newAllowed
)
{
if
((
name
!=
null
)
&&
(
this
.
mlDirectory
.
length
()>
0
)
&&
(!
this
.
mlDirectory
.
contains
(
Prefs
.
getFileSeparator
())))
{
// relative to the X3D model version
...
...
@@ -2218,7 +2275,6 @@ public class EyesisCorrectionParameters {
// select qualified (by 'name' - quad timestamp) x3d subdirectory
public
String
selectX3dDirectory
(
String
name
,
String
version
,
boolean
smart
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
newAllowed
,
// save
...
...
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
681a226e
...
...
@@ -1118,14 +1118,17 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
default
:
LOG_LEVEL
=
"OFF"
;
}
LOG_LEVEL
=
"ERROR"
;
// setting it here to shut up?
boolean
LOG_LEVEL_SET
=
loci
.
common
.
DebugTools
.
enableLogging
(
LOG_LEVEL
);
if
(!
LOG_LEVEL_SET
)
{
// only first time true
loci
.
common
.
DebugTools
.
setRootLevel
(
LOG_LEVEL
);
}
System
.
out
.
println
(
"DEBUG_LEVEL = "
+
DEBUG_LEVEL
+
", CLT_PARAMETERS.lwir.getDebugLevel() = "
+
CLT_PARAMETERS
.
lwir
.
getDebugLevel
()
+
" LOG_LEVEL="
+
LOG_LEVEL
+
"LOG_LEVEL_SET="
+
CLT_PARAMETERS
.
lwir
.
getDebugLevel
()
+
" LOG_LEVEL="
+
LOG_LEVEL
+
"
LOG_LEVEL_SET="
+
LOG_LEVEL_SET
);
//https://www.javadoc.io/doc/org.openmicroscopy/ome-common/6.0.5/loci/common/DebugTools.html#enableLogging(java.lang.String)
// Temporary overwrite with public static boolean enableIJLogging(boolean debug)
loci
.
common
.
DebugTools
.
enableIJLogging
(
false
);
}
/* ======================================================================== */
...
...
src/main/java/com/elphel/imagej/readers/ElphelJp4Reader.java
View file @
681a226e
...
...
@@ -107,7 +107,7 @@ public class ElphelJp4Reader extends ImageIOReader{
// or these readers are combined with all other readers in readers.txt
suffixNecessary
=
true
;
// false
suffixSufficient
=
true
;
// false;
LOGGER
.
debug
(
"ElphelTiffReader(), after super()"
);
LOGGER
.
info
(
"ElphelTiffReader(), after super()"
);
if
(
REPLACEMENT_TAG_MAP
==
null
)
{
REPLACEMENT_TAG_MAP
=
new
HashMap
<
String
,
String
>();
for
(
String
[]
line:
REPLACEMENT_TAGS
)
{
...
...
@@ -156,15 +156,15 @@ public class ElphelJp4Reader extends ImageIOReader{
public
void
setId
(
String
id
)
throws
FormatException
,
IOException
{
// same as for tiff?
image_bytes
=
null
;
// buffered_data = null;
LOGGER
.
debug
(
"setId("
+
id
+
"). before super"
);
LOGGER
.
info
(
"setId("
+
id
+
"). before super"
);
file_initialized
=
false
;
mapped_externally
=
false
;
if
(
Location
.
getIdMap
().
containsKey
(
id
))
{
LOGGER
.
debug
(
"id '"
+
id
+
"' is already mapped"
);
LOGGER
.
info
(
"id '"
+
id
+
"' is already mapped"
);
content_fileName
=
id
;
// id; // maybe set to null to handle externally?
mapped_externally
=
true
;
LOGGER
.
debug
(
"Starting initFile() method, read file directly"
);
LOGGER
.
info
(
"Starting initFile() method, read file directly"
);
super
.
setId
(
id
);
}
else
{
// If URL, then read to memory, if normal file - use direct access
...
...
@@ -177,7 +177,7 @@ public class ElphelJp4Reader extends ImageIOReader{
// LOGGER.warn("Bad URL1: " + id); // will try direct file, not an error
}
if
(
url
!=
null
)
{
LOGGER
.
debug
(
"Starting initFile() method, read "
+
id
+
" to memory first"
);
LOGGER
.
info
(
"Starting initFile() method, read "
+
id
+
" to memory first"
);
//https://www.rgagnon.com/javadetails/java-0487.html
URLConnection
connection
=
url
.
openConnection
();
...
...
@@ -194,44 +194,44 @@ public class ElphelJp4Reader extends ImageIOReader{
content_fileName
=
"unknown."
+
suffix
;
}
// currentId = fileName; //???
// LOGGER.
debug
("Mime type = "+mime);
// LOGGER.
info
("Mime type = "+mime);
// https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
//https://stackoverflow.com/questions/2295221/java-net-url-read-stream-to-byte
InputStream
is
=
url
.
openStream
();
//
byte
[]
inBytes
=
IOUtils
.
toByteArray
(
is
);
if
(
is
!=
null
)
is
.
close
();
LOGGER
.
debug
(
"Bytes read: "
+
inBytes
.
length
);
LOGGER
.
info
(
"Bytes read: "
+
inBytes
.
length
);
Location
.
mapFile
(
content_fileName
,
new
ByteArrayHandle
(
inBytes
));
// HashMap<String,Object> dbg_loc = Location.getIdMap();
super
.
setId
(
content_fileName
);
}
else
{
// read file normally
content_fileName
=
id
;
LOGGER
.
debug
(
"read file directly"
);
LOGGER
.
info
(
"read file directly"
);
super
.
setId
(
id
);
}
}
//getReader
// super.setId(id);
LOGGER
.
debug
(
"setId("
+
id
+
"). after super"
);
LOGGER
.
info
(
"setId("
+
id
+
"). after super"
);
file_initialized
=
true
;
}
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected
void
initFile
(
String
id
)
throws
FormatException
,
IOException
{
LOGGER
.
debug
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", before super"
);
LOGGER
.
info
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", before super"
);
try
{
super
.
initFile
(
id
);
// fails class_not_found
}
catch
(
IllegalArgumentException
e
)
{
throw
new
FormatException
(
e
);
}
LOGGER
.
debug
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", after super"
);
LOGGER
.
info
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", after super"
);
// Below needs to be modified - EXIFService does not work with mapFile
MetadataStore
store
=
makeFilterMetadata
();
LOGGER
.
debug
(
"Parsing JPEG EXIF data"
);
LOGGER
.
info
(
"Parsing JPEG EXIF data"
);
HashMap
<
String
,
String
>
tags
=
null
;
try
{
// Reimplementing ExifServiceImpl as original does not have ExifIFD0Directory
...
...
@@ -295,7 +295,7 @@ public class ElphelJp4Reader extends ImageIOReader{
}
catch
(
ServiceException
e
)
{
LOGGER
.
debug
(
"Could not parse EXIF data"
,
e
);
LOGGER
.
info
(
"Could not parse EXIF data"
,
e
);
}
long
[]
maker_note
=
null
;
double
exposure
=
Double
.
NaN
;
...
...
@@ -324,14 +324,14 @@ public class ElphelJp4Reader extends ImageIOReader{
int
bytes_per_pixel
=
1
;
Hashtable
<
String
,
String
>
property_table
=
ElphelMeta
.
getMeta
(
null
,
maker_note
,
exposure
,
date_time
,
bytes_per_pixel
,
true
);
LOGGER
.
debug
(
"Created elphelMeta table, size="
+
property_table
.
size
());
LOGGER
.
info
(
"Created elphelMeta table, size="
+
property_table
.
size
());
for
(
String
key:
property_table
.
keySet
())
{
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
key
,
property_table
.
get
(
key
));
}
MetadataLevel
level
=
getMetadataOptions
().
getMetadataLevel
();
if
(
level
!=
MetadataLevel
.
MINIMUM
)
{
// Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
// LOGGER.
debug
("initStandardMetadata() - got "+tags.length+" tags");
// LOGGER.
info
("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
CONTENT_FILENAME
,
content_fileName
);
}
...
...
@@ -343,9 +343,9 @@ public class ElphelJp4Reader extends ImageIOReader{
// HashMap<String,Object> dbg_loc = Location.getIdMap();
String
saveCurrentId
=
currentId
;
currentId
=
null
;
LOGGER
.
debug
(
"close("
+
fileOnly
+
") before super"
);
LOGGER
.
info
(
"close("
+
fileOnly
+
") before super"
);
super
.
close
(
fileOnly
);
// curerent_id == null only during actual close?
LOGGER
.
debug
(
"close("
+
fileOnly
+
") after super"
);
LOGGER
.
info
(
"close("
+
fileOnly
+
") after super"
);
currentId
=
saveCurrentId
;
// if ((content_fileName != null) && file_initialized){
if
(!
mapped_externally
&&
file_initialized
){
// will try to unmap non-mapped file, OK
...
...
@@ -385,7 +385,7 @@ public class ElphelJp4Reader extends ImageIOReader{
public
byte
[]
openBytes
(
int
no
,
byte
[]
buf
,
int
x
,
int
y
,
int
w
,
int
h
)
throws
FormatException
,
IOException
{
LOGGER
.
debug
(
"openBytes() - before super()"
);
LOGGER
.
info
(
"openBytes() - before super()"
);
FormatTools
.
checkPlaneParameters
(
this
,
no
,
buf
.
length
,
x
,
y
,
w
,
h
);
if
(
image_bytes
==
null
)
{
jp4Decode
(
no
);
...
...
@@ -401,7 +401,7 @@ public class ElphelJp4Reader extends ImageIOReader{
w
);
dest
+=
w
;
}
LOGGER
.
debug
(
"openBytes() - after super()"
);
LOGGER
.
info
(
"openBytes() - after super()"
);
return
buf
;
}
public
void
jp4Decode
(
int
no
)
throws
FormatException
,
IOException
{
...
...
@@ -436,7 +436,7 @@ public class ElphelJp4Reader extends ImageIOReader{
}
else
{
image_bytes
=
ib
;
// temporary
}
LOGGER
.
debug
(
"jp4Decode()"
);
LOGGER
.
info
(
"jp4Decode()"
);
}
}
src/main/java/com/elphel/imagej/readers/ElphelTiffReader.java
View file @
681a226e
...
...
@@ -40,6 +40,8 @@ import org.apache.commons.compress.utils.IOUtils;
import
org.joda.time.DateTime
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
///import ch.qos.logback.classic.Level;
///import ch.qos.logback.classic.Logger;
import
com.drew.imaging.ImageMetadataReader
;
import
com.drew.metadata.Metadata
;
...
...
@@ -162,10 +164,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
// mergeSubIFDs = true; // false;
// TODO: See if the selection is just between 2 readers (jp4 and tiff - just Elphel cameras),
// or these readers are combined with all other readers in readers.txt
//https://stackoverflow.com/questions/3837801/how-to-change-root-logging-level-programmatically-for-logback
// LOGGER.setLevel(Level.ERROR);
// Logger root = (Logger)LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
// root.setLevel(Level.ERROR);
suffixNecessary
=
true
;
// false
suffixSufficient
=
true
;
// false;
/// mergeSubIFDs = true; // false;
LOGGER
.
debug
(
"ElphelTiffReader(), after supper(), mergeSubIFDs = true;"
);
LOGGER
.
info
(
"ElphelTiffReader(), after supper(), mergeSubIFDs = true;"
);
if
(
REPLACEMENT_TAG_MAP
==
null
)
{
REPLACEMENT_TAG_MAP
=
new
HashMap
<
String
,
String
>();
for
(
String
[]
line:
REPLACEMENT_TAGS
)
{
...
...
@@ -211,14 +217,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
@Override
public
void
setId
(
String
id
)
throws
FormatException
,
IOException
{
LOGGER
.
debug
(
"setId("
+
id
+
"). before super"
);
LOGGER
.
info
(
"setId("
+
id
+
"). before super"
);
file_initialized
=
false
;
mapped_externally
=
false
;
if
(
Location
.
getIdMap
().
containsKey
(
id
))
{
LOGGER
.
debug
(
"id '"
+
id
+
"' is already mapped"
);
LOGGER
.
info
(
"id '"
+
id
+
"' is already mapped"
);
content_fileName
=
id
;
// id; // maybe set to null to handle externally?
mapped_externally
=
true
;
LOGGER
.
debug
(
"Starting setId() method, read file directly"
);
LOGGER
.
info
(
"Starting setId() method, read file directly"
);
super
.
setId
(
id
);
}
else
{
// If URL, then read to memory, if normal file - use direct access
...
...
@@ -244,7 +250,7 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
}
if
(
url
!=
null
)
{
LOGGER
.
debug
(
"Starting initFile() method, read "
+
id
+
" to memory first"
);
LOGGER
.
info
(
"Starting initFile() method, read "
+
id
+
" to memory first"
);
//https://www.rgagnon.com/javadetails/java-0487.html
URLConnection
connection
=
url
.
openConnection
();
...
...
@@ -261,27 +267,27 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
content_fileName
=
"unknown."
+
suffix
;
}
// currentId = fileName; //???
// LOGGER.
debug
("Mime type = "+mime);
// LOGGER.
info
("Mime type = "+mime);
// https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
//https://stackoverflow.com/questions/2295221/java-net-url-read-stream-to-byte
InputStream
is
=
url
.
openStream
();
//
byte
[]
inBytes
=
IOUtils
.
toByteArray
(
is
);
if
(
is
!=
null
)
is
.
close
();
LOGGER
.
debug
(
"Bytes read: "
+
inBytes
.
length
);
LOGGER
.
info
(
"Bytes read: "
+
inBytes
.
length
);
Location
.
mapFile
(
content_fileName
,
new
ByteArrayHandle
(
inBytes
));
// HashMap<String,Object> dbg_loc = Location.getIdMap();
super
.
setId
(
content_fileName
);
}
else
{
// read file normally
content_fileName
=
id
;
LOGGER
.
debug
(
"read file directly"
);
LOGGER
.
info
(
"read file directly"
);
super
.
setId
(
id
);
}
}
//getReader
// super.setId(id);
LOGGER
.
debug
(
"setId("
+
id
+
"). after super"
);
LOGGER
.
info
(
"setId("
+
id
+
"). after super"
);
file_initialized
=
true
;
}
...
...
@@ -292,26 +298,26 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
{
// Trying ServiceFactory before it is going to be initialized, so static defaultFactory will be initialized
// with small set of services - only needed for Elphel
LOGGER
.
debug
(
"Starting initFile() method"
);
LOGGER
.
info
(
"Starting initFile() method"
);
super
.
initFile
(
id
);
LOGGER
.
debug
(
"Ending initFile() method"
);
LOGGER
.
info
(
"Ending initFile() method"
);
}
/* @see loci.formats.FormatReader#initFile(String) */
// copied from ElphelJp4Reader
@Override
protected
void
initFile
(
String
id
)
throws
FormatException
,
IOException
{
LOGGER
.
debug
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", before super"
);
LOGGER
.
info
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", before super"
);
try
{
super
.
initFile
(
id
);
// fails class_not_found
}
catch
(
IllegalArgumentException
e
)
{
throw
new
FormatException
(
e
);
}
LOGGER
.
debug
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", after super"
);
LOGGER
.
info
(
"initFile("
+
id
+
"), currentId="
+
currentId
+
", after super"
);
// Below needs to be modified - EXIFService does not work with mapFile
MetadataStore
store
=
makeFilterMetadata
();
LOGGER
.
debug
(
"Parsing TIFF EXIF data"
);
LOGGER
.
info
(
"Parsing TIFF EXIF data"
);
HashMap
<
String
,
String
>
tags
=
null
;
try
{
// Reimplementing ExifServiceImpl as original does not have ExifIFD0Directory
...
...
@@ -378,7 +384,7 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
}
catch
(
ServiceException
e
)
{
LOGGER
.
debug
(
"Could not parse EXIF data"
,
e
);
LOGGER
.
info
(
"Could not parse EXIF data"
,
e
);
}
long
[]
maker_note
=
null
;
double
exposure
=
Double
.
NaN
;
...
...
@@ -409,14 +415,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
int
bytes_per_pixel
=
(
bpp
+
7
)
/
9
;
Hashtable
<
String
,
String
>
property_table
=
ElphelMeta
.
getMeta
(
null
,
maker_note
,
exposure
,
date_time
,
bytes_per_pixel
,
true
);
LOGGER
.
debug
(
"Created elphelMeta table, size="
+
property_table
.
size
());
LOGGER
.
info
(
"Created elphelMeta table, size="
+
property_table
.
size
());
for
(
String
key:
property_table
.
keySet
())
{
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
key
,
property_table
.
get
(
key
));
}
MetadataLevel
level
=
getMetadataOptions
().
getMetadataLevel
();
if
(
level
!=
MetadataLevel
.
MINIMUM
)
{
// Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
// LOGGER.
debug
("initStandardMetadata() - got "+tags.length+" tags");
// LOGGER.
info
("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
CONTENT_FILENAME
,
content_fileName
);
}
...
...
@@ -436,9 +442,9 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
/* @see loci.formats.IFormatReader#close(boolean) */
@Override
public
void
close
(
boolean
fileOnly
)
throws
IOException
{
LOGGER
.
debug
(
"close("
+
fileOnly
+
") before super"
);
LOGGER
.
info
(
"close("
+
fileOnly
+
") before super"
);
super
.
close
(
fileOnly
);
// curerent_id == null only during actual close?
LOGGER
.
debug
(
"close("
+
fileOnly
+
") after super"
);
LOGGER
.
info
(
"close("
+
fileOnly
+
") after super"
);
// if ((content_fileName != null) && file_initialized){
if
(!
mapped_externally
&&
file_initialized
){
// will try to unmap non-mapped file, OK
Location
.
mapFile
(
content_fileName
,
null
);
...
...
@@ -463,10 +469,10 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
/* Removed 08/03/2021 to match IP4
@Override
protected void initStandardMetadata() throws FormatException, IOException {
LOGGER.
debug
("initStandardMetadata() - before super()");
LOGGER.
info
("initStandardMetadata() - before super()");
super.initStandardMetadata();
String comment = ifds.get(0).getComment(); // IMAGE_DESCRIPTION
LOGGER.
debug
("initStandardMetadata() - after super()");
LOGGER.
info
("initStandardMetadata() - after super()");
long[] maker_note = null;
double exposure = Double.NaN;
String date_time = null;
...
...
@@ -505,14 +511,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
null, maker_note, exposure, date_time, bytes_per_pixel, true );
LOGGER.
debug
("Created elphelMeta table, size="+property_table.size());
LOGGER.
info
("Created elphelMeta table, size="+property_table.size());
for (String key:property_table.keySet()) {
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+key,property_table.get(key));
}
MetadataLevel level = getMetadataOptions().getMetadataLevel();
if (level != MetadataLevel.MINIMUM) {
Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
LOGGER.
debug
("initStandardMetadata() - got "+tags.length+" tags");
LOGGER.
info
("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+CONTENT_FILENAME,content_fileName);
// convert MAKER_NOTE to the same text format as in com.drew.metadata
...
...
@@ -549,9 +555,9 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
public
byte
[]
openBytes
(
int
no
,
byte
[]
buf
,
int
x
,
int
y
,
int
w
,
int
h
)
throws
FormatException
,
IOException
{
LOGGER
.
debug
(
"openBytes() - before super()"
);
LOGGER
.
info
(
"openBytes() - before super()"
);
super
.
openBytes
(
no
,
buf
,
x
,
y
,
w
,
h
);
LOGGER
.
debug
(
"openBytes() - after super()"
);
LOGGER
.
info
(
"openBytes() - after super()"
);
return
buf
;
}
...
...
src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java
View file @
681a226e
...
...
@@ -645,17 +645,17 @@ public class ImagejJp4Tiff {
}
if
(
num_diff
==
0
)
{
System
.
out
.
println
(
"No discontinuities remain"
);
///
System.out.println ("No discontinuities remain");
return
center
;
}
System
.
out
.
println
(
"Discontinuities remain, will fix by clusters"
);
///
System.out.println ("Discontinuities remain, will fix by clusters");
boolean
OK
=
fixByClusters
(
width
,
height
,
FIXCH6_BIT
,
// int bad_bit,
idata
,
// int [] data)
(
dbg_img
!=
null
));
// boolean debug)
System
.
out
.
println
(
"FixByClusters -> "
+
OK
);
///
System.out.println ("FixByClusters -> "+OK);
for
(
int
i
=
0
;
i
<
idata
.
length
;
i
++)
{
pixels
[
i
+
640
]
=
idata
[
i
];
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
681a226e
...
...
@@ -801,7 +801,7 @@ public class GeometryCorrection {
int
[]
full_par_index
;
public
RigOffset
()
{
System
.
out
.
println
(
"created RigOffset"
);
///
System.out.println("created RigOffset");
par_scales
=
new
double
[
VECTOR_LENGTH
];
par_scales
[
AUX_AZIMUTH_INDEX
]
=
1000.0
*
focalLength
/
pixelSize
;
par_scales
[
AUX_TILT_INDEX
]
=
1000.0
*
focalLength
/
pixelSize
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
681a226e
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
681a226e
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
681a226e
...
...
@@ -2025,16 +2025,16 @@ public class QuadCLT extends QuadCLTCPU {
false
,
// final boolean updateStatus,
debugLevel
);
// final int debugLevel);
if
(
debugLevel
>-
1
)
System
.
out
.
println
(
"Processing set "
+(
nSet
+
1
)+
" (of "
+
set_channels
.
length
+
") finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory
1
="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
if
(
eyesisCorrections
.
stopRequested
.
get
()>
0
)
{
System
.
out
.
println
(
"User requested stop"
);
System
.
out
.
println
(
"Processing "
+(
nSet
+
1
)+
" file sets (of "
+
set_channels
.
length
+
") finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory
2
="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
return
;
}
}
System
.
out
.
println
(
"processCLTQuadCorrs(): processing "
+
getTotalFiles
(
set_channels
)+
" files ("
+
set_channels
.
length
+
" file sets) finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory
3
="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
}
public
static
ImagePlus
renderGPUFromDSI
(
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
681a226e
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TileProcessor.java
View file @
681a226e
...
...
@@ -37,7 +37,7 @@ import com.elphel.imagej.common.PolynomialApproximation;
import
com.elphel.imagej.common.ShowDoubleFloatArrays
;
public
class
TileProcessor
{
public
boolean
run_garbage_collection
=
false
;
public
static
String
[]
SCAN_TITLES4
=
{
"tile_op"
,
// 0
"final"
,
// 1 - calculated, filtered, combined disparity
...
...
@@ -251,10 +251,11 @@ public class TileProcessor {
rig_pre_poles_sel
=
null
;
rig_post_poles_sel
=
null
;
clt_3d_passes_rig_size
=
0
;
if
(
run_garbage_collection
)
{
Runtime
runtime
=
Runtime
.
getRuntime
();
runtime
.
gc
();
System
.
out
.
println
(
"--- Free memory="
+
runtime
.
freeMemory
()+
" (of "
+
runtime
.
totalMemory
()+
")"
);
System
.
out
.
println
(
"--- Free memory30="
+
runtime
.
freeMemory
()+
" (of "
+
runtime
.
totalMemory
()+
")"
);
}
}
public
void
saveCLTPasses
(
boolean
rig
){
...
...
@@ -309,7 +310,7 @@ public class TileProcessor {
}
Runtime
runtime
=
Runtime
.
getRuntime
();
runtime
.
gc
();
System
.
out
.
println
(
"--- Free memory="
+
runtime
.
freeMemory
()+
" (of "
+
runtime
.
totalMemory
()+
")"
);
System
.
out
.
println
(
"--- Free memory
31
="
+
runtime
.
freeMemory
()+
" (of "
+
runtime
.
totalMemory
()+
")"
);
}
public
void
removeNonMeasurement
(){
// executed during expansion (CLT 3D)
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
681a226e
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