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
d5e7380a
Commit
d5e7380a
authored
10 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
add hdf5 splitting to ExportImagePlusPlugIn
parent
cd12c6c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fiji/src/main/java/bdv/ij/ExportImagePlusPlugIn.java
+75
-13
75 additions, 13 deletions
fiji/src/main/java/bdv/ij/ExportImagePlusPlugIn.java
with
75 additions
and
13 deletions
fiji/src/main/java/bdv/ij/ExportImagePlusPlugIn.java
+
75
−
13
View file @
d5e7380a
...
...
@@ -17,6 +17,7 @@ import java.awt.event.ItemEvent;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
mpicbg.spim.data.generic.sequence.BasicImgLoader
;
import
mpicbg.spim.data.generic.sequence.BasicViewSetup
;
...
...
@@ -39,6 +40,7 @@ import bdv.ij.export.imgloader.ImagePlusImgLoader.MinMaxOption;
import
bdv.ij.util.PluginHelper
;
import
bdv.ij.util.ProgressWriterIJ
;
import
bdv.img.hdf5.Hdf5ImageLoader
;
import
bdv.img.hdf5.Partition
;
import
bdv.spimdata.SequenceDescriptionMinimal
;
import
bdv.spimdata.SpimDataMinimal
;
import
bdv.spimdata.XmlIoSpimDataMinimal
;
...
...
@@ -137,12 +139,6 @@ public class ExportImagePlusPlugIn implements PlugIn
sourceTransform
.
set
(
pw
,
0
,
0
,
0
,
0
,
ph
,
0
,
0
,
0
,
0
,
pd
,
0
);
// write hdf5
final
File
seqFile
=
params
.
seqFile
;
final
File
hdf5File
=
params
.
hdf5File
;
final
int
[][]
resolutions
=
params
.
resolutions
;
final
int
[][]
subdivisions
=
params
.
subdivisions
;
final
boolean
deflate
=
params
.
deflate
;
final
HashMap
<
Integer
,
BasicViewSetup
>
setups
=
new
HashMap
<
Integer
,
BasicViewSetup
>(
numSetups
);
for
(
int
s
=
0
;
s
<
numSetups
;
++
s
)
{
...
...
@@ -155,10 +151,35 @@ public class ExportImagePlusPlugIn implements PlugIn
timepoints
.
add
(
new
TimePoint
(
t
)
);
final
SequenceDescriptionMinimal
seq
=
new
SequenceDescriptionMinimal
(
new
TimePoints
(
timepoints
),
setups
,
imgLoader
,
null
);
WriteSequenceToHdf5
.
writeHdf5File
(
seq
,
resolutions
,
subdivisions
,
deflate
,
hdf5File
,
new
SubTaskProgressWriter
(
progressWriter
,
0
,
0.95
)
);
Map
<
Integer
,
ExportMipmapInfo
>
perSetupExportMipmapInfo
;
perSetupExportMipmapInfo
=
new
HashMap
<
Integer
,
ExportMipmapInfo
>();
final
ExportMipmapInfo
mipmapInfo
=
new
ExportMipmapInfo
(
params
.
resolutions
,
params
.
subdivisions
);
for
(
final
BasicViewSetup
setup
:
seq
.
getViewSetupsOrdered
()
)
perSetupExportMipmapInfo
.
put
(
setup
.
getId
(),
mipmapInfo
);
final
ArrayList
<
Partition
>
partitions
;
if
(
params
.
split
)
{
final
String
xmlFilename
=
params
.
seqFile
.
getAbsolutePath
();
final
String
basename
=
xmlFilename
.
endsWith
(
".xml"
)
?
xmlFilename
.
substring
(
0
,
xmlFilename
.
length
()
-
4
)
:
xmlFilename
;
partitions
=
Partition
.
split
(
timepoints
,
seq
.
getViewSetupsOrdered
(),
params
.
timepointsPerPartition
,
params
.
setupsPerPartition
,
basename
);
for
(
int
i
=
0
;
i
<
partitions
.
size
();
++
i
)
{
final
Partition
partition
=
partitions
.
get
(
i
);
final
ProgressWriter
p
=
new
SubTaskProgressWriter
(
progressWriter
,
0
,
0.95
*
i
/
partitions
.
size
()
);
WriteSequenceToHdf5
.
writeHdf5PartitionFile
(
seq
,
perSetupExportMipmapInfo
,
params
.
deflate
,
partition
,
p
);
}
WriteSequenceToHdf5
.
writeHdf5PartitionLinkFile
(
seq
,
perSetupExportMipmapInfo
,
partitions
,
params
.
hdf5File
);
}
else
{
partitions
=
null
;
WriteSequenceToHdf5
.
writeHdf5File
(
seq
,
perSetupExportMipmapInfo
,
params
.
deflate
,
params
.
hdf5File
,
new
SubTaskProgressWriter
(
progressWriter
,
0
,
0.95
)
);
}
// write xml sequence description
final
Hdf5ImageLoader
hdf5Loader
=
new
Hdf5ImageLoader
(
hdf5File
,
null
,
null
,
false
);
final
Hdf5ImageLoader
hdf5Loader
=
new
Hdf5ImageLoader
(
params
.
hdf5File
,
partitions
,
null
,
false
);
final
SequenceDescriptionMinimal
seqh5
=
new
SequenceDescriptionMinimal
(
seq
,
hdf5Loader
);
final
ArrayList
<
ViewRegistration
>
registrations
=
new
ArrayList
<
ViewRegistration
>();
...
...
@@ -166,12 +187,12 @@ public class ExportImagePlusPlugIn implements PlugIn
for
(
int
s
=
0
;
s
<
numSetups
;
++
s
)
registrations
.
add
(
new
ViewRegistration
(
t
,
s
,
sourceTransform
)
);
final
File
basePath
=
seqFile
.
getParentFile
();
final
File
basePath
=
params
.
seqFile
.
getParentFile
();
final
SpimDataMinimal
spimData
=
new
SpimDataMinimal
(
basePath
,
seqh5
,
new
ViewRegistrations
(
registrations
)
);
try
{
new
XmlIoSpimDataMinimal
().
save
(
spimData
,
seqFile
.
getAbsolutePath
()
);
new
XmlIoSpimDataMinimal
().
save
(
spimData
,
params
.
seqFile
.
getAbsolutePath
()
);
progressWriter
.
setProgress
(
1.0
);
}
catch
(
final
Exception
e
)
...
...
@@ -201,7 +222,17 @@ public class ExportImagePlusPlugIn implements PlugIn
final
boolean
deflate
;
public
Parameters
(
final
boolean
setMipmapManual
,
final
int
[][]
resolutions
,
final
int
[][]
subdivisions
,
final
File
seqFile
,
final
File
hdf5File
,
final
MinMaxOption
minMaxOption
,
final
double
rangeMin
,
final
double
rangeMax
,
final
boolean
deflate
)
final
boolean
split
;
final
int
timepointsPerPartition
;
final
int
setupsPerPartition
;
public
Parameters
(
final
boolean
setMipmapManual
,
final
int
[][]
resolutions
,
final
int
[][]
subdivisions
,
final
File
seqFile
,
final
File
hdf5File
,
final
MinMaxOption
minMaxOption
,
final
double
rangeMin
,
final
double
rangeMax
,
final
boolean
deflate
,
final
boolean
split
,
final
int
timepointsPerPartition
,
final
int
setupsPerPartition
)
{
this
.
setMipmapManual
=
setMipmapManual
;
this
.
resolutions
=
resolutions
;
...
...
@@ -212,6 +243,9 @@ public class ExportImagePlusPlugIn implements PlugIn
this
.
rangeMin
=
rangeMin
;
this
.
rangeMax
=
rangeMax
;
this
.
deflate
=
deflate
;
this
.
split
=
split
;
this
.
timepointsPerPartition
=
timepointsPerPartition
;
this
.
setupsPerPartition
=
setupsPerPartition
;
}
}
...
...
@@ -227,6 +261,12 @@ public class ExportImagePlusPlugIn implements PlugIn
static
double
lastMax
=
65535
;
static
boolean
lastSplit
=
false
;
static
int
lastTimepointsPerPartition
=
0
;
static
int
lastSetupsPerPartition
=
0
;
static
boolean
lastDeflate
=
true
;
static
String
lastExportPath
=
"./export.xml"
;
...
...
@@ -259,6 +299,14 @@ public class ExportImagePlusPlugIn implements PlugIn
gd
.
addNumericField
(
"Max"
,
lastMax
,
0
);
final
TextField
tfMax
=
(
TextField
)
gd
.
getNumericFields
().
lastElement
();
gd
.
addMessage
(
""
);
gd
.
addCheckbox
(
"split hdf5"
,
lastSplit
);
final
Checkbox
cSplit
=
(
Checkbox
)
gd
.
getCheckboxes
().
lastElement
();
gd
.
addNumericField
(
"timepoints per partition"
,
lastTimepointsPerPartition
,
0
,
25
,
""
);
final
TextField
tfSplitTimepoints
=
(
TextField
)
gd
.
getNumericFields
().
lastElement
();
gd
.
addNumericField
(
"setups per partition"
,
lastSetupsPerPartition
,
0
,
25
,
""
);
final
TextField
tfSplitSetups
=
(
TextField
)
gd
.
getNumericFields
().
lastElement
();
gd
.
addMessage
(
""
);
gd
.
addCheckbox
(
"use deflate compression"
,
lastDeflate
);
...
...
@@ -283,6 +331,9 @@ public class ExportImagePlusPlugIn implements PlugIn
gd
.
getNextNumber
();
gd
.
getNextNumber
();
gd
.
getNextBoolean
();
gd
.
getNextNumber
();
gd
.
getNextNumber
();
gd
.
getNextBoolean
();
gd
.
getNextString
();
if
(
e
instanceof
ItemEvent
&&
e
.
getID
()
==
ItemEvent
.
ITEM_STATE_CHANGED
&&
e
.
getSource
()
==
cMinMaxChoices
)
{
...
...
@@ -301,6 +352,12 @@ public class ExportImagePlusPlugIn implements PlugIn
tfChunkSizes
.
setText
(
autoChunkSizes
);
}
}
else
if
(
e
instanceof
ItemEvent
&&
e
.
getID
()
==
ItemEvent
.
ITEM_STATE_CHANGED
&&
e
.
getSource
()
==
cSplit
)
{
final
boolean
split
=
cSplit
.
getState
();
tfSplitTimepoints
.
setEnabled
(
split
);
tfSplitSetups
.
setEnabled
(
split
);
}
return
true
;
}
}
);
...
...
@@ -317,6 +374,9 @@ public class ExportImagePlusPlugIn implements PlugIn
tfChunkSizes
.
setText
(
autoChunkSizes
);
}
tfSplitTimepoints
.
setEnabled
(
lastSplit
);
tfSplitSetups
.
setEnabled
(
lastSplit
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
()
)
return
null
;
...
...
@@ -327,6 +387,9 @@ public class ExportImagePlusPlugIn implements PlugIn
lastMinMaxChoice
=
gd
.
getNextChoiceIndex
();
lastMin
=
gd
.
getNextNumber
();
lastMax
=
gd
.
getNextNumber
();
lastSplit
=
gd
.
getNextBoolean
();
lastTimepointsPerPartition
=
(
int
)
gd
.
getNextNumber
();
lastSetupsPerPartition
=
(
int
)
gd
.
getNextNumber
();
lastDeflate
=
gd
.
getNextBoolean
();
lastExportPath
=
gd
.
getNextString
();
...
...
@@ -370,7 +433,6 @@ public class ExportImagePlusPlugIn implements PlugIn
final
String
hdf5Filename
=
seqFilename
.
substring
(
0
,
seqFilename
.
length
()
-
4
)
+
".h5"
;
final
File
hdf5File
=
new
File
(
hdf5Filename
);
return
new
Parameters
(
lastSetMipmapManual
,
resolutions
,
subdivisions
,
seqFile
,
hdf5File
,
minMaxOption
,
lastMin
,
lastMax
,
lastDeflate
);
}
return
new
Parameters
(
lastSetMipmapManual
,
resolutions
,
subdivisions
,
seqFile
,
hdf5File
,
minMaxOption
,
lastMin
,
lastMax
,
lastDeflate
,
lastSplit
,
lastTimepointsPerPartition
,
lastSetupsPerPartition
);
}
}
}
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