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
31d4cc0f
Commit
31d4cc0f
authored
Oct 21, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding new classes
parent
4e6966e0
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
814 additions
and
0 deletions
+814
-0
MultiThreading.java
src/main/java/com/elphel/imagej/common/MultiThreading.java
+37
-0
MultiLayerDSL.java
...n/java/com/elphel/imagej/tileprocessor/MultiLayerDSL.java
+28
-0
LwocLeaf.java
...n/java/com/elphel/imagej/tileprocessor/lwoc/LwocLeaf.java
+65
-0
LwocMesh.java
...n/java/com/elphel/imagej/tileprocessor/lwoc/LwocMesh.java
+61
-0
LwocOctree.java
...java/com/elphel/imagej/tileprocessor/lwoc/LwocOctree.java
+507
-0
LwocScene.java
.../java/com/elphel/imagej/tileprocessor/lwoc/LwocScene.java
+116
-0
No files found.
src/main/java/com/elphel/imagej/common/MultiThreading.java
0 → 100644
View file @
31d4cc0f
package
com
.
elphel
.
imagej
.
common
;
public
class
MultiThreading
{
public
static
int
THREADS_MAX
=
100
;
/* Create a Thread[] array as large as the number of processors available.
* From Stephan Preibisch's Multithreading.java class. See:
* http://repo.or.cz/w/trakem2.git?a=blob;f=mpi/fruitfly/general/MultiThreading.java;hb=HEAD
*/
public
static
Thread
[]
newThreadArray
()
{
return
newThreadArray
(
THREADS_MAX
);
}
public
static
Thread
[]
newThreadArray
(
int
maxCPUs
)
{
int
n_cpus
=
Runtime
.
getRuntime
().
availableProcessors
();
if
(
n_cpus
>
maxCPUs
)
n_cpus
=
maxCPUs
;
return
new
Thread
[
n_cpus
];
}
/* Start all given threads and wait on each of them until all are done.
* From Stephan Preibisch's Multithreading.java class. See:
* http://repo.or.cz/w/trakem2.git?a=blob;f=mpi/fruitfly/general/MultiThreading.java;hb=HEAD
*/
public
static
void
startAndJoin
(
Thread
[]
threads
)
// USED in lwir
{
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
++
ithread
)
{
threads
[
ithread
].
setPriority
(
Thread
.
NORM_PRIORITY
);
threads
[
ithread
].
start
();
}
try
{
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
++
ithread
)
threads
[
ithread
].
join
();
}
catch
(
InterruptedException
ie
)
{
throw
new
RuntimeException
(
ie
);
}
}
}
src/main/java/com/elphel/imagej/tileprocessor/MultiLayerDSL.java
0 → 100644
View file @
31d4cc0f
/**
** MultiLayerDSL - Handle multilayer/multivalue disparity/strength/lma values
**
** Copyright (C) 2022 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** TexturedModel.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
package
com
.
elphel
.
imagej
.
tileprocessor
;
public
class
MultiLayerDSL
{
}
src/main/java/com/elphel/imagej/tileprocessor/lwoc/LwocLeaf.java
0 → 100644
View file @
31d4cc0f
/**
**
** LwocLeaf.java - Octree leaf of the world built from LWIR16 images
**
** Copyright (C) 2022 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** LwocLeaf.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
package
com
.
elphel
.
imagej
.
tileprocessor
.
lwoc
;
import
java.util.ArrayList
;
public
class
LwocLeaf
{
ArrayList
<
LwocMesh
>
meshes
;
ArrayList
<
LwocMesh
>
mesh_centers
;
ArrayList
<
LwocScene
>
scenes
;
public
LwocLeaf
()
{
meshes
=
new
ArrayList
<
LwocMesh
>();
// all meshes BB intersecting this node
mesh_centers
=
new
ArrayList
<
LwocMesh
>();
// mesh centers in this node
scenes
=
new
ArrayList
<
LwocScene
>();
// cameras located in this node
}
public
void
addScene
(
LwocScene
scene
)
{
scenes
.
add
(
scene
);
}
public
void
addMeshCenter
(
LwocMesh
mesh
)
{
mesh_centers
.
add
(
mesh
);
}
public
void
addMesh
(
LwocMesh
mesh
,
boolean
check_existed
)
{
if
(!
check_existed
||
meshes
.
contains
(
mesh
))
{
meshes
.
add
(
mesh
);
}
}
public
ArrayList
<
LwocMesh
>
getMeshes
(){
return
meshes
;
}
public
ArrayList
<
LwocMesh
>
getMeshCenters
(){
return
mesh_centers
;
}
public
ArrayList
<
LwocScene
>
getScenes
(){
return
scenes
;
}
}
src/main/java/com/elphel/imagej/tileprocessor/lwoc/LwocMesh.java
0 → 100644
View file @
31d4cc0f
/**
**
** LwocMesh.java - Single mesh of the world built from LWIR16 images
**
** Copyright (C) 2022 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** LwocMesh.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
package
com
.
elphel
.
imagej
.
tileprocessor
.
lwoc
;
import
java.util.ArrayList
;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
LwocMesh
{
static
AtomicInteger
MESH_ID
=
new
AtomicInteger
();
static
ArrayList
<
LwocMesh
>
LWOC_MESHES
;
int
id
;
// assign unique ID
String
stimestamp
;
// mesh is always referenced to a single scene
double
[]
world_xyz
;
// world coordinates of the center
double
[]
hdims_xyz
;
// world bounding box half-dimensions along x,y,z
public
static
void
resetMeshes
()
{
MESH_ID
.
set
(
0
);
LWOC_MESHES
=
new
ArrayList
<
LwocMesh
>();
}
// maybe use mesh properties instead of id?
public
boolean
equals
(
LwocMesh
other_mesh
)
{
return
id
==
other_mesh
.
id
;
}
public
LwocMesh
(
String
stimestamp
)
{
this
.
stimestamp
=
stimestamp
;
id
=
MESH_ID
.
getAndIncrement
();
LWOC_MESHES
.
add
(
this
);
}
public
double
[]
getCenter
()
{
return
world_xyz
;
}
public
double
[]
getDims
()
{
return
hdims_xyz
;
}
}
src/main/java/com/elphel/imagej/tileprocessor/lwoc/LwocOctree.java
0 → 100644
View file @
31d4cc0f
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/lwoc/LwocScene.java
0 → 100644
View file @
31d4cc0f
/**
**
** LwocScene.java - Scene of the world built from LWIR16 images
**
** Copyright (C) 2022 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** LwocScene.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
package
com
.
elphel
.
imagej
.
tileprocessor
.
lwoc
;
import
java.util.ArrayList
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
com.elphel.imagej.tileprocessor.GeometryCorrection
;
public
class
LwocScene
{
static
AtomicInteger
SCENE_ID
=
new
AtomicInteger
();
static
ArrayList
<
LwocScene
>
LWOC_SCENES
;
int
id
;
// assign unique ID
String
stimestamp
;
GeometryCorrection
geometryCorrection
;
double
[]
camera_xyz
;
double
[]
camera_atr
;
double
[]
camera_xyz_dt
;
double
[]
camera_atr_dt
;
double
[][][]
tile_layers_dsm
;
// per tile, per layer, {disparity, strength, mode}. For mode -
// interpret as Double doubleToLongBits(), [22] - used LMA, 0..15 - which sensors were used
public
static
void
resetScenes
()
{
SCENE_ID
.
set
(
0
);
LWOC_SCENES
=
new
ArrayList
<
LwocScene
>();
}
public
LwocScene
(
String
stimestamp
,
GeometryCorrection
geometryCorrection
,
double
[]
camera_xyz
,
double
[]
camera_atr
,
double
[]
camera_xyz_dt
,
double
[]
camera_atr_dt
,
double
[][][]
tile_layers_dsm
)
{
this
.
stimestamp
=
stimestamp
;
this
.
geometryCorrection
=
geometryCorrection
;
this
.
camera_xyz
=
camera_xyz
;
this
.
camera_atr
=
camera_atr
;
this
.
camera_xyz_dt
=
camera_xyz_dt
;
this
.
camera_atr_dt
=
camera_atr_dt
;
this
.
tile_layers_dsm
=
tile_layers_dsm
;
id
=
SCENE_ID
.
getAndIncrement
();
LWOC_SCENES
.
add
(
this
);
};
// add functionality to save/restore
public
double
[]
getCameraXYZ
()
{
return
camera_xyz
;
}
public
double
[]
getCameraATR
()
{
return
camera_atr
;
}
public
double
[]
getCameraXYZdt
()
{
return
camera_xyz_dt
;
}
public
double
[]
getCameraATRdt
()
{
return
camera_atr_dt
;
}
public
double
[][][]
getTileLayersDSM
()
{
return
tile_layers_dsm
;
}
public
String
getTimestamp
()
{
return
stimestamp
;
}
public
static
String
getTimestamp
(
double
dts
)
{
return
String
.
format
(
"%.6f"
,
dts
).
replace
(
'.'
,
'-'
);
}
public
double
getDoubleTimestamp
()
{
return
Double
.
parseDouble
(
stimestamp
.
replace
(
'_'
,
'.'
));
}
public
static
double
getDoubleTimestamp
(
String
sts
)
{
return
Double
.
parseDouble
(
sts
.
replace
(
'_'
,
'.'
));
}
public
int
getIntTimestamp
()
{
return
(
int
)
Math
.
round
(
1
E6
*
getDoubleTimestamp
());
}
public
void
setTimeStamp
(
String
ts
)
{
stimestamp
=
ts
;
}
public
void
setTimeStamp
(
double
dts
)
{
stimestamp
=
getTimestamp
(
dts
);
}
public
void
setTimeStamp
(
int
its
)
{
stimestamp
=
String
.
format
(
"%d_%06d"
,
its
/
1000000
,
its
%
1000000
);
}
}
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