Skip to content

Commit

Permalink
Rename bg to background
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhahmann committed Oct 10, 2023
1 parent 521dbec commit 7891a3a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ private void createSpotsFromLabelImage( RandomAccessibleInterval< IntegerType< ?
new BigInteger[ numLabels ][ 3 ][ 3 ]; // sums up the estimates of mixed coordinates (like xy). Used for covariances.

readImageSumPositions( img, count, sum, mixedSum, minAndMax.getA() );

createSpotsFromSums( frameId, numLabels, count, sum, mixedSum );
}

Expand All @@ -121,7 +120,7 @@ private static Pair< Integer, Integer > getPixelValueInterval( RandomAccessibleI
Cursor< IntegerType< ? > > cursor = Views.iterable( img ).cursor();
while ( cursor.hasNext() )
{
int val = cursor.next().getInteger(); // we ignore 0 as it is BG
int val = cursor.next().getInteger(); // we ignore 0 as it is background
if ( min > val )
min = val;
if ( max < val )
Expand Down Expand Up @@ -176,20 +175,19 @@ private void createSpotsFromSums( int frame, int numLabels, int[] count, long[][
* @param count an empty array to store the 0D sums (counts). Dimensions: [labelIdx].
* @param sum an empty array to store the 1D sums, i.e S[X]. Dimensions: [labelIdx, coord]
* @param mixedSum an empty array to store the 2D sums, i.e S[XY]. Dimensions: [labelIdx, coord, coord]
* @param bg the pixel value of the background. Since unsigned is annoying in Fiji, this subtracts the bg value from the label.
* @param background the pixel value of the background. Since unsigned is annoying in Fiji, this subtracts the bg value from the label.
* @author Noam Dori
*/
private static void readImageSumPositions(
RandomAccessibleInterval< IntegerType< ? > > img, int[] count,
long[][] sum, BigInteger[][][] mixedSum, int bg
RandomAccessibleInterval< IntegerType< ? > > img, int[] count, long[][] sum, BigInteger[][][] mixedSum, int background
)
{
// read all pixels of the picture to sum everything up
int[] pixel = new int[ 3 ];
Cursor< IntegerType< ? > > cursor = Views.iterable( img ).cursor();
while ( cursor.hasNext() )
{
int labelIdx = cursor.next().getInteger() - bg - 1; // we ignore 0 as it is BG
int labelIdx = cursor.next().getInteger() - background - 1; // we ignore 0 as it is BG
if ( labelIdx < 0 )
continue;
cursor.localize( pixel );
Expand Down

0 comments on commit 7891a3a

Please sign in to comment.