Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Core_Extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
BigDataViewer_Core_Extension
Commits
2da346c8
Commit
2da346c8
authored
10 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
moved hdf5 partition setup from Scripting to Partition and fixed a bug
parent
b7a57646
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/java/bdv/img/hdf5/Partition.java
+84
-0
84 additions, 0 deletions
core/src/main/java/bdv/img/hdf5/Partition.java
fiji/src/main/java/bdv/ij/export/Scripting.java
+1
-56
1 addition, 56 deletions
fiji/src/main/java/bdv/ij/export/Scripting.java
with
85 additions
and
56 deletions
core/src/main/java/bdv/img/hdf5/Partition.java
+
84
−
0
View file @
2da346c8
package
bdv.img.hdf5
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
mpicbg.spim.data.generic.sequence.BasicViewSetup
;
...
...
@@ -112,4 +114,86 @@ public class Partition
timepointIdSequenceToPartition
.
containsKey
(
viewId
.
getTimePointId
()
)
&&
setupIdSequenceToPartition
.
containsKey
(
viewId
.
getViewSetupId
()
);
}
/**
* Split a sequence into partitions, each containing a specified number of
* timepoints and setups.
*
* @param timepoints
* list of all {@link TimePoint}s.
* @param setups
* list of all {@link BasicViewSetup}s.
* @param timepointsPerPartition
* how many timepoints should each partition contain (if this is
* ≤0, put do not split timepoints across partitions).
* @param setupsPerPartition
* how many setups should each partition contain (if this is
* ≤0, put do not split setups across partitions).
* @param basename
* This is used to generate paths for the partitions. Partitions
* are named "basename-TT-SS.h5" where TT and SS are the index of
* the timepoint and setup batch, respectively.
* @return list of partitions.
*/
public
static
ArrayList
<
Partition
>
split
(
final
List
<
TimePoint
>
timepoints
,
final
List
<
?
extends
BasicViewSetup
>
setups
,
final
int
timepointsPerPartition
,
final
int
setupsPerPartition
,
final
String
basename
)
{
final
String
partitionFilenameFormat
=
basename
+
"-%02d-%02d.h5"
;
final
int
numTimepoints
=
timepoints
.
size
();
final
int
numSetups
=
setups
.
size
();
final
ArrayList
<
Integer
>
timepointSplits
=
new
ArrayList
<
Integer
>();
timepointSplits
.
add
(
0
);
if
(
timepointsPerPartition
>
0
)
for
(
int
t
=
timepointsPerPartition
;
t
<
numTimepoints
;
t
+=
timepointsPerPartition
)
timepointSplits
.
add
(
t
);
timepointSplits
.
add
(
numTimepoints
);
final
ArrayList
<
HashMap
<
Integer
,
Integer
>
>
timepointMaps
=
new
ArrayList
<
HashMap
<
Integer
,
Integer
>
>();
for
(
int
i
=
0
;
i
<
timepointSplits
.
size
()
-
1
;
++
i
)
{
final
HashMap
<
Integer
,
Integer
>
timepointIdSequenceToPartition
=
new
HashMap
<
Integer
,
Integer
>();
for
(
int
t
=
timepointSplits
.
get
(
i
);
t
<
timepointSplits
.
get
(
i
+
1
);
++
t
)
{
final
int
id
=
timepoints
.
get
(
t
).
getId
();
timepointIdSequenceToPartition
.
put
(
id
,
id
);
}
timepointMaps
.
add
(
timepointIdSequenceToPartition
);
}
final
ArrayList
<
Integer
>
setupSplits
=
new
ArrayList
<
Integer
>();
setupSplits
.
add
(
0
);
if
(
setupsPerPartition
>
0
)
for
(
int
s
=
setupsPerPartition
;
s
<
numSetups
;
s
+=
setupsPerPartition
)
setupSplits
.
add
(
s
);
setupSplits
.
add
(
numSetups
);
final
ArrayList
<
HashMap
<
Integer
,
Integer
>
>
setupMaps
=
new
ArrayList
<
HashMap
<
Integer
,
Integer
>
>();
for
(
int
i
=
0
;
i
<
setupSplits
.
size
()
-
1
;
++
i
)
{
final
HashMap
<
Integer
,
Integer
>
setupIdSequenceToPartition
=
new
HashMap
<
Integer
,
Integer
>();
for
(
int
s
=
setupSplits
.
get
(
i
);
s
<
setupSplits
.
get
(
i
+
1
);
++
s
)
{
final
int
id
=
setups
.
get
(
s
).
getId
();
setupIdSequenceToPartition
.
put
(
id
,
id
);
}
setupMaps
.
add
(
setupIdSequenceToPartition
);
}
final
ArrayList
<
Partition
>
partitions
=
new
ArrayList
<
Partition
>();
for
(
int
t
=
0
;
t
<
timepointMaps
.
size
();
++
t
)
{
for
(
int
s
=
0
;
s
<
setupMaps
.
size
();
++
s
)
{
final
String
path
=
String
.
format
(
partitionFilenameFormat
,
t
,
s
);
partitions
.
add
(
new
Partition
(
path
,
timepointMaps
.
get
(
t
),
setupMaps
.
get
(
s
)
)
);
}
}
return
partitions
;
}
}
This diff is collapsed.
Click to expand it.
fiji/src/main/java/bdv/ij/export/Scripting.java
+
1
−
56
View file @
2da346c8
...
...
@@ -2,12 +2,10 @@ package bdv.ij.export;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
mpicbg.spim.data.SpimDataException
;
import
mpicbg.spim.data.sequence.TimePoint
;
import
mpicbg.spim.io.ConfigurationParserException
;
import
net.imglib2.realtransform.AffineTransform3D
;
import
bdv.export.ExportMipmapInfo
;
...
...
@@ -167,60 +165,7 @@ public class Scripting
final
String
xmlFilename
)
{
final
String
basename
=
xmlFilename
.
endsWith
(
".xml"
)
?
xmlFilename
.
substring
(
0
,
xmlFilename
.
length
()
-
4
)
:
xmlFilename
;
final
String
partitionFilenameFormat
=
basename
+
"-%02d-%02d.h5"
;
final
int
numTimepoints
=
aggregator
.
timepoints
.
size
();
final
int
numSetups
=
aggregator
.
setups
.
size
();
final
ArrayList
<
Integer
>
timepointSplits
=
new
ArrayList
<
Integer
>();
timepointSplits
.
add
(
0
);
if
(
timepointsPerPartition
>
0
)
for
(
int
t
=
timepointsPerPartition
;
t
<
numTimepoints
;
t
+=
timepointsPerPartition
)
timepointSplits
.
add
(
t
);
timepointSplits
.
add
(
numTimepoints
);
final
ArrayList
<
HashMap
<
Integer
,
Integer
>
>
timepointMaps
=
new
ArrayList
<
HashMap
<
Integer
,
Integer
>
>();
final
List
<
TimePoint
>
timepoints
=
aggregator
.
timepoints
.
getTimePointsOrdered
();
for
(
int
i
=
0
;
i
<
timepointSplits
.
size
()
-
1
;
++
i
)
{
final
HashMap
<
Integer
,
Integer
>
timepointIdSequenceToPartition
=
new
HashMap
<
Integer
,
Integer
>();
for
(
int
t
=
timepointSplits
.
get
(
i
);
t
<
timepointSplits
.
get
(
i
+
1
);
++
t
)
{
final
int
id
=
timepoints
.
get
(
t
).
getId
();
timepointIdSequenceToPartition
.
put
(
id
,
id
);
}
timepointMaps
.
add
(
timepointIdSequenceToPartition
);
}
final
ArrayList
<
Integer
>
setupSplits
=
new
ArrayList
<
Integer
>();
setupSplits
.
add
(
0
);
if
(
setupsPerPartition
>
0
)
for
(
int
s
=
setupsPerPartition
;
s
<
numSetups
;
s
+=
setupsPerPartition
)
setupSplits
.
add
(
s
);
setupSplits
.
add
(
numSetups
);
final
ArrayList
<
HashMap
<
Integer
,
Integer
>
>
setupMaps
=
new
ArrayList
<
HashMap
<
Integer
,
Integer
>
>();
for
(
int
i
=
0
;
i
<
timepointSplits
.
size
()
-
1
;
++
i
)
{
final
HashMap
<
Integer
,
Integer
>
setupIdSequenceToPartition
=
new
HashMap
<
Integer
,
Integer
>();
for
(
int
s
=
setupSplits
.
get
(
i
);
s
<
setupSplits
.
get
(
i
+
1
);
++
s
)
{
final
int
id
=
aggregator
.
setups
.
get
(
s
).
getId
();
setupIdSequenceToPartition
.
put
(
id
,
id
);
}
setupMaps
.
add
(
setupIdSequenceToPartition
);
}
final
ArrayList
<
Partition
>
partitions
=
new
ArrayList
<
Partition
>();
for
(
int
t
=
0
;
t
<
timepointMaps
.
size
();
++
t
)
{
for
(
int
s
=
0
;
s
<
setupMaps
.
size
();
++
s
)
{
final
String
path
=
String
.
format
(
partitionFilenameFormat
,
t
,
s
);
partitions
.
add
(
new
Partition
(
path
,
timepointMaps
.
get
(
t
),
setupMaps
.
get
(
s
)
)
);
}
}
return
partitions
;
return
Partition
.
split
(
aggregator
.
timepoints
.
getTimePointsOrdered
(),
aggregator
.
setups
,
timepointsPerPartition
,
setupsPerPartition
,
basename
);
}
public
static
class
PartitionedSequenceWriter
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment