-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathVolatileViewData.java
More file actions
119 lines (103 loc) · 2.73 KB
/
VolatileViewData.java
File metadata and controls
119 lines (103 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package bdv.util.volatiles;
import java.util.function.Predicate;
import bdv.cache.CacheControl;
import net.imglib2.RandomAccessible;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.Volatile;
import net.imglib2.cache.Invalidate;
import net.imglib2.cache.img.CachedCellImg;
/**
* Metadata associated with a {@link VolatileView}. It comprises the types
* of the original and volatile image, a {@link CacheControl} for the
* volatile cache, and the wrapped {@link RandomAccessible}.
* <p>
* {@link VolatileViewData} is used while wrapping deeper layers of a view
* cascade (ending at a {@link CachedCellImg}) and only on the top layer
* wrapped as a {@link RandomAccessible} / {@link RandomAccessibleInterval}.
* </p>
*
* @param <T>
* original image pixel type
* @param <V>
* corresponding volatile pixel type
*
* @author Tobias Pietzsch
*/
public class VolatileViewData< T, V extends Volatile< T > > implements Invalidate< Long >
{
private final RandomAccessible< V > img;
private final CacheControl cacheControl;
private final T type;
private final V volatileType;
private final Invalidate< Long > invalidate;
public VolatileViewData(
final RandomAccessible< V > img,
final CacheControl cacheControl,
final T type,
final V volatileType,
final Invalidate< Long > invalidate )
{
this.img = img;
this.cacheControl = cacheControl;
this.type = type;
this.volatileType = volatileType;
this.invalidate = invalidate;
}
/**
* Get the wrapped {@link RandomAccessible}.
*
* @return the wrapped {@link RandomAccessible}
*/
public RandomAccessible< V > getImg()
{
return img;
}
/**
* Get the {@link CacheControl} for the {@link CachedCellImg}(s) at the
* bottom of the view cascade.
*
* @return the {@link CacheControl} for the {@link CachedCellImg}(s) at the
* bottom of the view cascade
*/
public CacheControl getCacheControl()
{
return cacheControl;
}
/**
* Get the pixel type of the original image.
*
* @return the pixel type of the original image
*/
public T getType()
{
return type;
}
/**
* Get the pixel type of the wrapped {@link RandomAccessible}.
*
* @return the pixel type of the wrapped {@link RandomAccessible}
*/
public V getVolatileType()
{
return volatileType;
}
public Invalidate< Long > getInvalidate()
{
return this.invalidate;
}
@Override
public void invalidate( Long key )
{
this.invalidate.invalidate( key );
}
@Override
public void invalidateIf( long parallelismThreshold, Predicate< Long > condition )
{
this.invalidate.invalidateIf( parallelismThreshold, condition );
}
@Override
public void invalidateAll( long parallelismThreshold )
{
this.invalidate.invalidateAll( parallelismThreshold );
}
}