Skip to content

Commit 16173ef

Browse files
committed
Update to pom-scijava-40.0.0 and bigdataviewer-core-10.6.4
1 parent 7de525f commit 16173ef

File tree

3 files changed

+25
-91
lines changed

3 files changed

+25
-91
lines changed

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.scijava</groupId>
77
<artifactId>pom-scijava</artifactId>
8-
<version>39.0.0</version>
8+
<version>40.0.0</version>
99
<relativePath />
1010
</parent>
1111

@@ -202,6 +202,7 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
202202
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
203203

204204
<imglib2.version>7.1.4</imglib2.version>
205+
<bigdataviewer-core.version>10.6.4</bigdataviewer-core.version>
205206
</properties>
206207

207208
<repositories>

src/test/java/net/imglib2/algorithm/blocks/downsample/DownsampleBdvBenchmark.java

+18-49
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
* %%
1212
* Redistribution and use in source and binary forms, with or without
1313
* modification, are permitted provided that the following conditions are met:
14-
*
14+
*
1515
* 1. Redistributions of source code must retain the above copyright notice,
1616
* this list of conditions and the following disclaimer.
1717
* 2. Redistributions in binary form must reproduce the above copyright notice,
1818
* this list of conditions and the following disclaimer in the documentation
1919
* and/or other materials provided with the distribution.
20-
*
20+
*
2121
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2222
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2323
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -33,31 +33,11 @@
3333
*/
3434
package net.imglib2.algorithm.blocks.downsample;
3535

36-
import bdv.export.DownsampleBlock;
37-
import java.util.Arrays;
3836
import java.util.concurrent.TimeUnit;
3937
import java.util.concurrent.atomic.AtomicLong;
4038
import java.util.stream.Collectors;
4139
import java.util.stream.IntStream;
42-
import net.imglib2.Cursor;
43-
import net.imglib2.IterableInterval;
44-
import net.imglib2.RandomAccess;
45-
import net.imglib2.RandomAccessible;
46-
import net.imglib2.RandomAccessibleInterval;
47-
import net.imglib2.algorithm.blocks.BlockSupplier;
48-
import net.imglib2.algorithm.blocks.ComputationType;
49-
import net.imglib2.algorithm.blocks.downsample.Downsample.Offset;
50-
import net.imglib2.algorithm.blocks.BlockAlgoUtils;
51-
import net.imglib2.cache.img.CachedCellImg;
52-
import net.imglib2.cache.img.CellLoader;
53-
import net.imglib2.cache.img.ReadOnlyCachedCellImgFactory;
54-
import net.imglib2.cache.img.ReadOnlyCachedCellImgOptions;
55-
import net.imglib2.img.array.ArrayImgs;
56-
import net.imglib2.img.cell.AbstractCellImg;
57-
import net.imglib2.parallel.Parallelization;
58-
import net.imglib2.parallel.TaskExecutor;
59-
import net.imglib2.type.numeric.integer.UnsignedByteType;
60-
import net.imglib2.view.Views;
40+
6141
import org.openjdk.jmh.annotations.Benchmark;
6242
import org.openjdk.jmh.annotations.BenchmarkMode;
6343
import org.openjdk.jmh.annotations.Fork;
@@ -72,6 +52,21 @@
7252
import org.openjdk.jmh.runner.options.Options;
7353
import org.openjdk.jmh.runner.options.OptionsBuilder;
7454

55+
import net.imglib2.Cursor;
56+
import net.imglib2.IterableInterval;
57+
import net.imglib2.RandomAccessibleInterval;
58+
import net.imglib2.algorithm.blocks.BlockAlgoUtils;
59+
import net.imglib2.algorithm.blocks.BlockSupplier;
60+
import net.imglib2.algorithm.blocks.ComputationType;
61+
import net.imglib2.algorithm.blocks.downsample.Downsample.Offset;
62+
import net.imglib2.cache.img.CachedCellImg;
63+
import net.imglib2.img.array.ArrayImgs;
64+
import net.imglib2.img.cell.AbstractCellImg;
65+
import net.imglib2.parallel.Parallelization;
66+
import net.imglib2.parallel.TaskExecutor;
67+
import net.imglib2.type.numeric.integer.UnsignedByteType;
68+
import net.imglib2.view.Views;
69+
7570
@State( Scope.Benchmark )
7671
@Warmup( iterations = 3, time = 100, timeUnit = TimeUnit.MILLISECONDS )
7772
@Measurement( iterations = 10, time = 100, timeUnit = TimeUnit.MILLISECONDS )
@@ -101,32 +96,6 @@ public DownsampleBdvBenchmark()
10196
downsampledDimensions = Downsample.getDownsampledDimensions( raw.dimensionsAsLongArray(), downsampleInDim );
10297
}
10398

104-
@Benchmark
105-
public void benchmarkBdv()
106-
{
107-
RandomAccessible< UnsignedByteType > extended = Views.extendBorder( raw );
108-
int[] downsamplingFactors = new int[ 3 ];
109-
Arrays.setAll(downsamplingFactors, d -> downsampleInDim[ d ] ? 2 : 1 );
110-
final DownsampleBlock< UnsignedByteType > downsampleBlock = DownsampleBlock.create( cellDimensions, downsamplingFactors, UnsignedByteType.class, RandomAccess.class );
111-
final RandomAccess< UnsignedByteType > in = extended.randomAccess();
112-
final long[] currentCellMin = new long[ 3 ];
113-
final int[] currentCellDim = new int[ 3 ];
114-
CellLoader< UnsignedByteType > downsampleBlockLoader = cell -> {
115-
Arrays.setAll( currentCellMin, d -> cell.min( d ) * downsamplingFactors[ d ] );
116-
Arrays.setAll( currentCellDim, d -> ( int ) cell.dimension( d ) );
117-
in.setPosition( currentCellMin );
118-
downsampleBlock.downsampleBlock( in, cell.cursor(), currentCellDim );
119-
};
120-
final CachedCellImg< UnsignedByteType, ? > downsampled = new ReadOnlyCachedCellImgFactory().create(
121-
downsampledDimensions,
122-
new UnsignedByteType(),
123-
downsampleBlockLoader,
124-
ReadOnlyCachedCellImgOptions.options().cellDimensions( cellDimensions) );
125-
126-
touchAllCellsSingleThreaded( downsampled );
127-
downsampled.getCache().invalidateAll();
128-
}
129-
13099
@Benchmark
131100
public void benchmarkDownsampleDouble()
132101
{

src/test/java/net/imglib2/algorithm/blocks/downsample/DownsampleBdvPlayground.java

+5-41
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
* %%
1212
* Redistribution and use in source and binary forms, with or without
1313
* modification, are permitted provided that the following conditions are met:
14-
*
14+
*
1515
* 1. Redistributions of source code must retain the above copyright notice,
1616
* this list of conditions and the following disclaimer.
1717
* 2. Redistributions in binary form must reproduce the above copyright notice,
1818
* this list of conditions and the following disclaimer in the documentation
1919
* and/or other materials provided with the distribution.
20-
*
20+
*
2121
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2222
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2323
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -33,24 +33,20 @@
3333
*/
3434
package net.imglib2.algorithm.blocks.downsample;
3535

36-
import bdv.export.DownsampleBlock;
36+
import java.util.Arrays;
37+
3738
import bdv.util.Bdv;
3839
import bdv.util.BdvFunctions;
3940
import bdv.util.BdvSource;
4041
import bdv.util.volatiles.VolatileViews;
4142
import bdv.viewer.DisplayMode;
4243
import ij.IJ;
4344
import ij.ImagePlus;
44-
import java.util.Arrays;
45-
import net.imglib2.RandomAccess;
45+
import net.imglib2.algorithm.blocks.BlockAlgoUtils;
4646
import net.imglib2.algorithm.blocks.BlockSupplier;
4747
import net.imglib2.algorithm.blocks.ComputationType;
4848
import net.imglib2.algorithm.blocks.downsample.Downsample.Offset;
49-
import net.imglib2.algorithm.blocks.BlockAlgoUtils;
5049
import net.imglib2.cache.img.CachedCellImg;
51-
import net.imglib2.cache.img.CellLoader;
52-
import net.imglib2.cache.img.ReadOnlyCachedCellImgFactory;
53-
import net.imglib2.cache.img.ReadOnlyCachedCellImgOptions;
5450
import net.imglib2.img.Img;
5551
import net.imglib2.img.display.imagej.ImageJFunctions;
5652
import net.imglib2.type.numeric.ARGBType;
@@ -86,38 +82,6 @@ public static void main( String[] args )
8682
final double[] calib = new double[ 3 ];
8783
Arrays.setAll(calib, d -> downsampleInDim[ d ] ? 2 : 1 );
8884

89-
90-
91-
int[] downsamplingFactors = new int[ 3 ];
92-
Arrays.setAll(downsamplingFactors, d -> downsampleInDim[ d ] ? 2 : 1 );
93-
final DownsampleBlock< UnsignedByteType > downsampleBlock = DownsampleBlock.create( cellDimensions, downsamplingFactors, UnsignedByteType.class, RandomAccess.class );
94-
final RandomAccess< UnsignedByteType > in = extended.randomAccess();
95-
final long[] currentCellMin = new long[ 3 ];
96-
final int[] currentCellDim = new int[ 3 ];
97-
CellLoader< UnsignedByteType > downsampleBlockLoader = cell -> {
98-
Arrays.setAll( currentCellMin, d -> cell.min( d ) * downsamplingFactors[ d ] );
99-
Arrays.setAll( currentCellDim, d -> ( int ) cell.dimension( d ) );
100-
in.setPosition( currentCellMin );
101-
downsampleBlock.downsampleBlock( in, cell.cursor(), currentCellDim );
102-
};
103-
final CachedCellImg< UnsignedByteType, ? > downsampled = new ReadOnlyCachedCellImgFactory().create(
104-
downsampledDimensions,
105-
type,
106-
downsampleBlockLoader,
107-
ReadOnlyCachedCellImgOptions.options().cellDimensions( cellDimensions) );
108-
109-
110-
111-
final BdvSource out = BdvFunctions.show(
112-
VolatileViews.wrapAsVolatile( downsampled ),
113-
"downsampled bdv",
114-
Bdv.options()
115-
.addTo( bdv )
116-
.sourceTransform( calib ) );
117-
out.setDisplayRange( 0, 255 );
118-
out.setColor( new ARGBType( 0xff0000 ) );
119-
120-
12185
final BlockSupplier< UnsignedByteType > blocks = BlockSupplier
12286
.of( extended )
12387
.andThen( Downsample.downsample( ComputationType.AUTO, Offset.HALF_PIXEL, downsampleInDim ) );

0 commit comments

Comments
 (0)