Skip to content

Commit

Permalink
Do not store max[] of Cell, compute on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed Mar 6, 2024
1 parent dbf309f commit 69de165
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/java/net/imglib2/img/cell/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public class Cell< A > implements Interval, Serializable

protected final long[] min;

protected final long[] max;

private final int numPixels;

private final A data;
Expand All @@ -77,11 +75,6 @@ public Cell( final int[] dimensions, final long[] min, final A data )
this.steps = new int[ n ];
IntervalIndexer.createAllocationSteps( dimensions, steps );
this.min = min.clone();

max = new long[ n ];
for ( int d = 0; d < n; ++d )
max[ d ] = min[ d ] + dimensions[ d ] - 1;

this.numPixels = ( int ) Intervals.numElements( dimensions );
this.data = data;
}
Expand All @@ -102,11 +95,6 @@ public Cell( final CellDimensionsAndSteps dims, final long[] min, final A data )
this.dimensions = dims.dimensions();
this.steps = dims.steps();
this.min = min;

max = new long[ n ];
for ( int d = 0; d < n; ++d )
max[ d ] = min[ d ] + dimensions[ d ] - 1;

this.numPixels = dims.numPixels();
this.data = data;
}
Expand Down Expand Up @@ -180,7 +168,7 @@ public long min( final int d )
@Override
public long max( final int d )
{
return max[ d ];
return min[ d ] + dimensions[ d ] - 1;
}

/**
Expand Down

0 comments on commit 69de165

Please sign in to comment.