private static < A > List< A > emptySlices( long[] dim ) { int numSlices = numberOfSlices( dim ); List< A > mirror = new ArrayList<>( numSlices ); for ( int i = 0; i < numSlices; ++i ) mirror.add( null ); return mirror; }
private static < A > List< A > emptySlices( long[] dim ) { int numSlices = numberOfSlices( dim ); List< A > mirror = new ArrayList<>( numSlices ); for ( int i = 0; i < numSlices; ++i ) mirror.add( null ); return mirror; }
public PlanarImg( final List< A > slices, final long[] dim, final Fraction entitiesPerPixel ) { super( dim, entitiesPerPixel ); this.dimensions = longToIntArray( dim ); this.sliceSteps = computeSliceSteps( dim ); this.numSlices = numberOfSlices( dim ); if(slices.size() != numSlices) throw new IllegalArgumentException(); this.mirror = slices; }
public PlanarImg( final List< A > slices, final long[] dim, final Fraction entitiesPerPixel ) { super( dim, entitiesPerPixel ); this.dimensions = longToIntArray( dim ); this.sliceSteps = computeSliceSteps( dim ); this.numSlices = numberOfSlices( dim ); if(slices.size() != numSlices) throw new IllegalArgumentException(); this.mirror = slices; }
private static < A extends ArrayDataAccess< A > > List< A > createSlices( A creator, long[] dim, Fraction entitiesPerPixel ) { int numSlices = numberOfSlices( dim ); List< A > mirror = new ArrayList<>( numSlices ); final int pixelsPerPlane = (int) (( ( dim.length > 1 ) ? dim[ 1 ] : 1 ) * dim[ 0 ]); final int numEntitiesPerSlice = ( int ) entitiesPerPixel.mulCeil( pixelsPerPlane ); for ( int i = 0; i < numSlices; ++i ) mirror.add( creator.createArray( numEntitiesPerSlice ) ); return mirror; } }
private static < A extends ArrayDataAccess< A > > List< A > createSlices( A creator, long[] dim, Fraction entitiesPerPixel ) { int numSlices = numberOfSlices( dim ); List< A > mirror = new ArrayList<>( numSlices ); final int pixelsPerPlane = (int) (( ( dim.length > 1 ) ? dim[ 1 ] : 1 ) * dim[ 0 ]); final int numEntitiesPerSlice = ( int ) entitiesPerPixel.mulCeil( pixelsPerPlane ); for ( int i = 0; i < numSlices; ++i ) mirror.add( creator.createArray( numEntitiesPerSlice ) ); return mirror; } }