Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent 1b8fa48 commit e6d58f2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/main/java/net/imglib2/img/cell/CellImgFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,10 @@ public CellImgFactory( final T type, final int... cellDimensions )
*/
public static int[] getCellDimensions( final int[] defaultCellDimensions, final int n, final Fraction entitiesPerPixel ) throws IllegalArgumentException
{
final int[] cellDimensions = new int[ n ];
final int max = defaultCellDimensions.length - 1;
for ( int i = 0; i < n; i++ )
cellDimensions[ i ] = defaultCellDimensions[ ( i < max ) ? i : max ];

final int[] cellDimensions = Util.expandArray( defaultCellDimensions, n );
final long numEntities = entitiesPerPixel.mulCeil( Intervals.numElements( cellDimensions ) );
if ( numEntities > Integer.MAX_VALUE )
throw new IllegalArgumentException( "Number of entities in cell too large. Use smaller cell size." );

return cellDimensions;
}

Expand Down

0 comments on commit e6d58f2

Please sign in to comment.