Skip to content

Commit 5b07795

Browse files
committed
Don't reimplement net.imglib2.util.Util.getArrayOrCellImgFactory
1 parent b49cbf5 commit 5b07795

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/main/java/net/imglib2/algorithm/convolution/Concatenation.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package net.imglib2.algorithm.convolution;
22

3-
import net.imglib2.Dimensions;
43
import net.imglib2.Interval;
54
import net.imglib2.RandomAccessible;
65
import net.imglib2.RandomAccessibleInterval;
76
import net.imglib2.img.Img;
8-
import net.imglib2.img.ImgFactory;
9-
import net.imglib2.img.array.ArrayImgFactory;
10-
import net.imglib2.img.cell.CellImgFactory;
117
import net.imglib2.type.NativeType;
128
import net.imglib2.util.Intervals;
139
import net.imglib2.util.Pair;
@@ -91,23 +87,10 @@ public void process( RandomAccessible< ? extends T > source, RandomAccessibleInt
9187
private static < T extends NativeType< T > > RandomAccessibleInterval< T > createImage( T targetType, Interval targetInterval )
9288
{
9389
long[] dimensions = Intervals.dimensionsAsLongArray( targetInterval );
94-
Img< T > ts = getImgFactory( targetInterval, targetType ).create( dimensions );
90+
Img< T > ts = Util.getArrayOrCellImgFactory( targetInterval, targetType ).create( dimensions );
9591
return Views.translate( ts, Intervals.minAsLongArray( targetInterval ) );
9692
}
9793

98-
private static < T extends NativeType< T > > ImgFactory< T > getImgFactory( final Dimensions targetsize, final T type )
99-
{
100-
if ( canUseArrayImgFactory( targetsize ) )
101-
return new ArrayImgFactory<>( type );
102-
final int cellSize = ( int ) Math.pow( Integer.MAX_VALUE / type.getEntitiesPerPixel().getRatio(), 1.0 / targetsize.numDimensions() );
103-
return new CellImgFactory<>( type, cellSize );
104-
}
105-
106-
private static boolean canUseArrayImgFactory( final Dimensions targetsize )
107-
{
108-
return Intervals.numElements( targetsize ) <= Integer.MAX_VALUE;
109-
}
110-
11194
private static < T > T uncheckedCast( Object in )
11295
{
11396
@SuppressWarnings( "unchecked" )

0 commit comments

Comments
 (0)