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
9329a1b5
Commit
9329a1b5
authored
10 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
Add generic source wrapping a RealRandomAccessible. Useful for
procedurally generated sources.
parent
cf27a4e3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/bdv/util/RealRandomAccessibleSource.java
+86
-0
86 additions, 0 deletions
core/src/main/java/bdv/util/RealRandomAccessibleSource.java
with
86 additions
and
0 deletions
core/src/main/java/bdv/util/RealRandomAccessibleSource.java
0 → 100644
+
86
−
0
View file @
9329a1b5
package
bdv.util
;
import
net.imglib2.Interval
;
import
net.imglib2.RandomAccessibleInterval
;
import
net.imglib2.RealRandomAccessible
;
import
net.imglib2.realtransform.AffineTransform3D
;
import
net.imglib2.type.Type
;
import
net.imglib2.util.Util
;
import
net.imglib2.view.Views
;
import
bdv.viewer.Interpolation
;
import
bdv.viewer.Source
;
/**
* A {@link Source} wrapping some {@link RealRandomAccessible}. Derived concrete
* classes must implement {@link #getInterval(int, int)} to specify which
* interval to use for {@link #getSource(int, int)}.
*
* @param <T>
*
* @author Tobias Pietzsch <tobias.pietzsch@gmail.com>
*/
public
abstract
class
RealRandomAccessibleSource
<
T
extends
Type
<
T
>
>
implements
Source
<
T
>
{
protected
RealRandomAccessible
<
T
>
accessible
;
protected
final
T
type
;
protected
final
String
name
;
public
RealRandomAccessibleSource
(
final
RealRandomAccessible
<
T
>
accessible
,
final
String
name
)
{
this
.
accessible
=
accessible
;
this
.
type
=
Util
.
getTypeFromRealRandomAccess
(
accessible
).
createVariable
();
this
.
name
=
name
;
}
@Override
public
boolean
isPresent
(
final
int
t
)
{
return
true
;
}
/**
* Return the interval which should be used to bound the wrapped
* (unbounded) {@link RealRandomAccessible} for {@link #getSource(int, int)}.
*
* @return image interval
*/
public
abstract
Interval
getInterval
(
final
int
t
,
final
int
level
);
@Override
public
RandomAccessibleInterval
<
T
>
getSource
(
final
int
t
,
final
int
level
)
{
return
Views
.
interval
(
Views
.
raster
(
accessible
),
getInterval
(
t
,
level
)
);
}
@Override
public
RealRandomAccessible
<
T
>
getInterpolatedSource
(
final
int
t
,
final
int
level
,
final
Interpolation
method
)
{
return
accessible
;
}
@Override
public
AffineTransform3D
getSourceTransform
(
final
int
t
,
final
int
level
)
{
return
new
AffineTransform3D
();
}
@Override
public
T
getType
()
{
return
type
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
int
getNumMipmapLevels
()
{
return
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