|
10 | 10 | import org.janelia.saalfeldlab.n5.N5Reader;
|
11 | 11 | import org.janelia.saalfeldlab.n5.N5Writer;
|
12 | 12 |
|
| 13 | +import bdv.labels.labelset.Label; |
13 | 14 | import bdv.labels.labelset.LabelMultisetType;
|
14 | 15 | import bdv.labels.labelset.LabelMultisetTypeDownscaler;
|
15 | 16 | import bdv.labels.labelset.LabelUtils;
|
| 17 | +import bdv.labels.labelset.Multiset.Entry; |
16 | 18 | import bdv.labels.labelset.N5CacheLoader;
|
17 | 19 | import bdv.labels.labelset.VolatileLabelMultisetArray;
|
18 | 20 | import net.imglib2.RandomAccessible;
|
|
26 | 28 |
|
27 | 29 | public class SparkDownsampleFunction implements Function<DownsampleBlock, Integer> {
|
28 | 30 |
|
29 |
| - private static final long serialVersionUID = 1384028449836651389L; |
| 31 | + private static final long serialVersionUID = 1384028449836651390L; |
30 | 32 | private final String inputGroupName;
|
31 | 33 | private final String inputDatasetName;
|
32 | 34 | private final int[] factor;
|
@@ -68,7 +70,11 @@ public Integer call(DownsampleBlock targetRegion) throws Exception {
|
68 | 70 | final CachedCellImg<LabelMultisetType,VolatileLabelMultisetArray> inputImg = new CachedCellImg<LabelMultisetType,VolatileLabelMultisetArray>(
|
69 | 71 | new CellGrid(dimensions, blocksize), new LabelMultisetType(), wrappedCache, new VolatileLabelMultisetArray(0, true));
|
70 | 72 |
|
71 |
| - final RandomAccessible<LabelMultisetType> extendedImg = Views.extendValue(inputImg, LabelUtils.getOutOfBounds()); |
| 73 | + int eachCount = 0; |
| 74 | + for(Entry<Label> e : inputImg.firstElement().entrySet()) |
| 75 | + eachCount += e.getCount(); |
| 76 | + |
| 77 | + final RandomAccessible<LabelMultisetType> extendedImg = Views.extendValue(inputImg, LabelUtils.getOutOfBounds(eachCount)); |
72 | 78 |
|
73 | 79 | VolatileLabelMultisetArray downscaledCell;
|
74 | 80 |
|
|
0 commit comments