Skip to content

Commit

Permalink
Expand the allowable label space to use all positive int values (#278)
Browse files Browse the repository at this point in the history
Addresses issue #276
  • Loading branch information
mdoube authored Nov 18, 2020
1 parent 04172dd commit aa95521
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public class ConnectedComponents {
/** Background value */
public static final int BACK = 0;
/** 2^23 - greatest integer that can be represented precisely by a float */
static final int MAX_LABEL = 8388608;
public static final int MAX_FINAL_LABEL = 8388608;
/** maximum label value to use during intermediate processing */
static final int MAX_LABEL = Integer.MAX_VALUE;

/** number of particle labels */
private static int nParticles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ public void run(final String arg) {
final int[][] particleLabels = (int[][]) result[1];
final long[] particleSizes = (long[]) result[2];
final int nParticles = particleSizes.length;

if (nParticles > ConnectedComponents.MAX_FINAL_LABEL)
IJ.log("Number of particles ("+nParticles+") exceeds the accurate display range (2^23) of the 32-bit float particle image");

final double[] volumes = ParticleAnalysis.getVolumes(imp, particleSizes);

Expand Down

0 comments on commit aa95521

Please sign in to comment.