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
ed47fcb6
Commit
ed47fcb6
authored
10 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
store name, size, and voxel size with ViewSetup when exporting fused data.
parent
c889d8a2
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
fiji/src/main/java/bdv/ij/export/FusionResult.java
+24
-8
24 additions, 8 deletions
fiji/src/main/java/bdv/ij/export/FusionResult.java
fiji/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java
+33
-9
33 additions, 9 deletions
.../main/java/bdv/ij/export/imgloader/FusionImageLoader.java
with
57 additions
and
17 deletions
fiji/src/main/java/bdv/ij/export/FusionResult.java
+
24
−
8
View file @
ed47fcb6
...
...
@@ -8,13 +8,16 @@ import java.util.Map;
import
mpicbg.spim.data.generic.base.Entity
;
import
mpicbg.spim.data.generic.sequence.AbstractSequenceDescription
;
import
mpicbg.spim.data.generic.sequence.BasicImgLoader
;
import
mpicbg.spim.data.generic.sequence.BasicViewSetup
;
import
mpicbg.spim.data.registration.ViewRegistration
;
import
mpicbg.spim.data.registration.ViewRegistrations
;
import
mpicbg.spim.data.sequence.Channel
;
import
mpicbg.spim.data.sequence.ImgLoader
;
import
mpicbg.spim.data.sequence.TimePoint
;
import
mpicbg.spim.data.sequence.TimePoints
;
import
mpicbg.spim.data.sequence.ViewId
;
import
mpicbg.spim.data.sequence.VoxelDimensions
;
import
net.imglib2.Dimensions
;
import
net.imglib2.realtransform.AffineTransform3D
;
import
net.imglib2.type.numeric.integer.UnsignedShortType
;
import
net.imglib2.type.numeric.real.FloatType
;
...
...
@@ -59,8 +62,14 @@ public class FusionResult
{
final
HashMap
<
Integer
,
Integer
>
setupIdToChannelId
=
new
HashMap
<
Integer
,
Integer
>();
setupIdToChannelId
.
put
(
0
,
0
);
final
BasicImgLoader
<
UnsignedShortType
>
fusionLoader
=
new
FusionImageLoader
<
FloatType
>(
filepath
+
"/"
+
filepattern
,
setupIdToChannelId
,
numSlices
,
new
FusionImageLoader
.
Gray32ImagePlusLoader
(),
sliceValueMin
,
sliceValueMax
);
desc
=
new
SequenceDescriptionMinimal
(
timepoints
,
Entity
.
idMap
(
Arrays
.
asList
(
new
BasicViewSetup
(
0
,
null
,
null
,
null
)
)
),
fusionLoader
,
null
);
final
ImgLoader
<
UnsignedShortType
>
fusionLoader
=
new
FusionImageLoader
<
FloatType
>(
filepath
+
"/"
+
filepattern
,
setupIdToChannelId
,
numSlices
,
new
FusionImageLoader
.
Gray32ImagePlusLoader
(),
sliceValueMin
,
sliceValueMax
);
final
int
setupId
=
0
;
final
String
name
=
"fused"
;
final
ViewId
view
=
new
ViewId
(
timepoints
.
getTimePointsOrdered
().
get
(
0
).
getId
(),
setupId
);
final
Dimensions
size
=
fusionLoader
.
getImageSize
(
view
);
final
VoxelDimensions
voxelSize
=
fusionLoader
.
getVoxelSize
(
view
);
final
BasicViewSetup
setup
=
new
BasicViewSetup
(
setupId
,
name
,
size
,
voxelSize
);
desc
=
new
SequenceDescriptionMinimal
(
timepoints
,
Entity
.
idMap
(
Arrays
.
asList
(
setup
)
),
fusionLoader
,
null
);
final
ArrayList
<
ViewRegistration
>
registrations
=
new
ArrayList
<
ViewRegistration
>();
for
(
final
TimePoint
timepoint
:
timepoints
.
getTimePointsOrdered
()
)
registrations
.
add
(
new
ViewRegistration
(
timepoint
.
getId
(),
0
,
perTimePointFusionTransforms
.
get
(
timepoint
.
getId
()
)
)
);
...
...
@@ -78,15 +87,22 @@ public class FusionResult
final
Map
<
Integer
,
AffineTransform3D
>
perTimePointFusionTransforms
)
{
final
HashMap
<
Integer
,
Integer
>
setupIdToChannelId
=
new
HashMap
<
Integer
,
Integer
>();
for
(
int
setupId
=
0
;
setupId
<
channels
.
size
();
++
setupId
)
{
setupIdToChannelId
.
put
(
setupId
,
channels
.
get
(
setupId
)
);
}
final
ImgLoader
<
UnsignedShortType
>
fusionLoader
=
new
FusionImageLoader
<
FloatType
>(
filepath
+
"/"
+
filepattern
,
setupIdToChannelId
,
numSlices
,
new
FusionImageLoader
.
Gray32ImagePlusLoader
(),
sliceValueMin
,
sliceValueMax
);
final
ArrayList
<
BasicViewSetup
>
setups
=
new
ArrayList
<
BasicViewSetup
>();
for
(
int
i
d
=
0
;
i
d
<
channels
.
size
();
++
i
d
)
for
(
int
setupI
d
=
0
;
setupI
d
<
channels
.
size
();
++
setupI
d
)
{
final
BasicViewSetup
setup
=
new
BasicViewSetup
(
id
,
null
,
null
,
null
);
setup
.
setAttribute
(
new
Channel
(
channels
.
get
(
id
)
)
);
final
String
name
=
"fused c "
+
channels
.
get
(
setupId
);
final
ViewId
view
=
new
ViewId
(
timepoints
.
getTimePointsOrdered
().
get
(
0
).
getId
(),
setupId
);
final
Dimensions
size
=
fusionLoader
.
getImageSize
(
view
);
final
VoxelDimensions
voxelSize
=
fusionLoader
.
getVoxelSize
(
view
);
final
BasicViewSetup
setup
=
new
BasicViewSetup
(
setupId
,
name
,
size
,
voxelSize
);
setup
.
setAttribute
(
new
Channel
(
channels
.
get
(
setupId
)
)
);
setups
.
add
(
setup
);
setupIdToChannelId
.
put
(
id
,
channels
.
get
(
id
)
);
}
final
BasicImgLoader
<
UnsignedShortType
>
fusionLoader
=
new
FusionImageLoader
<
FloatType
>(
filepath
+
"/"
+
filepattern
,
setupIdToChannelId
,
numSlices
,
new
FusionImageLoader
.
Gray32ImagePlusLoader
(),
sliceValueMin
,
sliceValueMax
);
desc
=
new
SequenceDescriptionMinimal
(
timepoints
,
Entity
.
idMap
(
setups
),
fusionLoader
,
null
);
final
ArrayList
<
ViewRegistration
>
registrations
=
new
ArrayList
<
ViewRegistration
>();
for
(
final
TimePoint
timepoint
:
timepoints
.
getTimePointsOrdered
()
)
...
...
This diff is collapsed.
Click to expand it.
fiji/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java
+
33
−
9
View file @
ed47fcb6
...
...
@@ -6,11 +6,14 @@ import io.scif.img.ImgOpener;
import
java.util.HashMap
;
import
mpicbg.spim.data.
generic.
sequence.
BasicImgLoader
;
import
mpicbg.spim.data.sequence.
FinalVoxelDimensions
;
import
mpicbg.spim.data.sequence.ImgLoader
;
import
mpicbg.spim.data.sequence.ViewDescription
;
import
mpicbg.spim.data.sequence.ViewId
;
import
mpicbg.spim.data.sequence.VoxelDimensions
;
import
net.imglib2.Cursor
;
import
net.imglib2.Dimensions
;
import
net.imglib2.FinalDimensions
;
import
net.imglib2.RandomAccessibleInterval
;
import
net.imglib2.converter.Converters
;
import
net.imglib2.converter.RealUnsignedShortConverter
;
...
...
@@ -40,7 +43,7 @@ import net.imglib2.view.Views;
*
* @author Tobias Pietzsch <tobias.pietzsch@gmail.com>
*/
public
class
FusionImageLoader
<
T
extends
RealType
<
T
>
>
implements
Basic
ImgLoader
<
UnsignedShortType
>
public
class
FusionImageLoader
<
T
extends
RealType
<
T
>
>
implements
ImgLoader
<
UnsignedShortType
>
{
private
final
String
pattern
;
...
...
@@ -83,16 +86,12 @@ public class FusionImageLoader< T extends RealType< T > > implements BasicImgLoa
final
int
tp
=
view
.
getTimePointId
();
final
int
c
=
setupIdToChannelId
.
get
(
view
.
getViewSetupId
()
);
RandomAccessibleInterval
<
T
>
slice
=
sliceLoader
.
load
(
String
.
format
(
pattern
,
tp
,
c
,
0
)
);
final
long
[]
dimensions
=
new
long
[
3
];
dimensions
[
0
]
=
slice
.
dimension
(
0
);
dimensions
[
1
]
=
slice
.
dimension
(
1
);
dimensions
[
2
]
=
numSlices
;
final
Dimensions
dimensions
=
getImageSize
(
view
);
final
Img
<
UnsignedShortType
>
img
=
factory
.
create
(
dimensions
,
type
);
for
(
int
z
=
0
;
z
<
numSlices
;
++
z
)
{
slice
=
sliceLoader
.
load
(
String
.
format
(
pattern
,
tp
,
c
,
z
)
);
final
RandomAccessibleInterval
<
T
>
slice
=
sliceLoader
.
load
(
String
.
format
(
pattern
,
tp
,
c
,
z
)
);
final
Cursor
<
UnsignedShortType
>
d
=
Views
.
flatIterable
(
Views
.
hyperSlice
(
img
,
2
,
z
)
).
cursor
();
for
(
final
UnsignedShortType
t
:
Converters
.
convert
(
Views
.
flatIterable
(
slice
),
converter
,
type
)
)
...
...
@@ -128,7 +127,7 @@ public class FusionImageLoader< T extends RealType< T > > implements BasicImgLoa
try
{
System
.
out
.
println
(
fn
);
return
opener
.
openImg
(
fn
,
factory
,
type
);
return
opener
.
openImg
s
(
fn
,
factory
,
type
).
get
(
0
);
}
catch
(
final
ImgIOException
e
)
{
...
...
@@ -164,4 +163,29 @@ public class FusionImageLoader< T extends RealType< T > > implements BasicImgLoa
return
ImageJFunctions
.
wrapByte
(
new
ImagePlus
(
fn
)
);
}
}
@Override
public
RandomAccessibleInterval
<
FloatType
>
getFloatImage
(
final
ViewId
view
,
final
boolean
normalize
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
Dimensions
getImageSize
(
final
ViewId
view
)
{
final
int
tp
=
view
.
getTimePointId
();
final
int
c
=
setupIdToChannelId
.
get
(
view
.
getViewSetupId
()
);
final
RandomAccessibleInterval
<
T
>
slice
=
sliceLoader
.
load
(
String
.
format
(
pattern
,
tp
,
c
,
0
)
);
return
new
FinalDimensions
(
slice
.
dimension
(
0
),
slice
.
dimension
(
1
),
numSlices
);
}
@Override
public
VoxelDimensions
getVoxelSize
(
final
ViewId
view
)
{
return
new
FinalVoxelDimensions
(
"px"
,
1
,
1
,
1
);
}
}
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