Skip to content

Commit 85066a1

Browse files
committed
slight code cleanup
1 parent aa682fc commit 85066a1

5 files changed

Lines changed: 16 additions & 8 deletions

‎src/main/java/inra/ijpb/binary/geodesic/GeodesicDistanceTransform3DFloat.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
* Computation of geodesic distance transform for 3D images, using floating
3535
* point computation.
3636
*
37-
* Adapted for the management of label images.
37+
* This implementation also works on label maps as input.
38+
*
3839
*
3940
* @author dlegland
4041
*
@@ -351,6 +352,7 @@ private void normalizeMap(Image3D distMap, Image3D labelImage)
351352
// retrieve the minimum weight
352353
double w0 = this.chamferMask.getNormalizationWeight();
353354

355+
// iterate over voxels within map to normalize values
354356
for (int z = 0; z < sizeZ; z++)
355357
{
356358
fireProgressChanged(this, z, sizeZ);

‎src/main/java/inra/ijpb/binary/geodesic/GeodesicDistanceTransformFloat.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
* Computation of Chamfer geodesic distances using floating point array for
3434
* storing result.
3535
*
36+
* This implementation also works on label maps as input.
37+
*
3638
* This implementation is based on iteration of forward-backward passes, until
3739
* idempotence. The "hybrid" implementation is usually more efficient for
3840
* complex images.
@@ -365,6 +367,7 @@ private void normalizeMap(FloatProcessor distMap, ImageProcessor labelImage)
365367
// retrieve the minimum weight
366368
double w0 = this.mask.getNormalizationWeight();
367369

370+
// iterate over pixels within map to normalize values
368371
for (int y = 0; y < sizeY; y++)
369372
{
370373
this.fireProgressChanged(this, y, sizeY);

‎src/main/java/inra/ijpb/binary/geodesic/GeodesicDistanceTransformFloatHybrid.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
* Computation of geodesic distances based on a chamfer mask using floating point
3636
* array for storing result.
3737
*
38+
* This implementation also works on label maps as input.
39+
*
3840
* @see GeodesicDistanceTransformShortHybrid
3941
*
4042
* @author David Legland
@@ -412,6 +414,7 @@ private void normalizeResult(FloatProcessor distMap, ImageProcessor labelImage)
412414
// retrieve the minimum weight
413415
double w0 = this.mask.getNormalizationWeight();
414416

417+
// iterate over pixels within map to normalize values
415418
for (int y = 0; y < sizeY; y++)
416419
{
417420
for (int x = 0; x < sizeX; x++)

‎src/main/java/inra/ijpb/binary/geodesic/GeodesicDistanceTransformShort.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
* Computation of geodesic distances based on a chamfer mask using short integer
3434
* array for storing result.
3535
*
36-
* The maximum propagated distance is limited to Short.MAX_VALUE.
36+
* This implementation also works on label maps as input.
3737
*
3838
* All computations are performed using integers, results are stored as shorts.
39+
* The maximum propagated distance is limited to Short.MAX_VALUE.
3940
*
4041
* This implementation is based on iteration of forward-backward passes, until
4142
* idempotence. The "hybrid" implementation is usually more efficient for
@@ -366,12 +367,9 @@ private void normalizeResult(ShortProcessor distMap, ImageProcessor labelImage)
366367
int sizeY = distMap.getHeight();
367368

368369
// retrieve the minimum weight
369-
double w0 = Double.POSITIVE_INFINITY;
370-
for (ShortOffset offset : this.mask.getOffsets())
371-
{
372-
w0 = Math.min(w0, offset.weight);
373-
}
370+
double w0 = this.mask.getShortNormalizationWeight();
374371

372+
// iterate over pixels within map to normalize values
375373
for (int y = 0; y < sizeY; y++)
376374
{
377375
for (int x = 0; x < sizeX; x++)

‎src/main/java/inra/ijpb/binary/geodesic/GeodesicDistanceTransformShortHybrid.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
* Computation of geodesic distances based on a chamfer mask using short integer
3636
* array for storing result.
3737
*
38-
* The maximum propagated distance is limited to Short.MAX_VALUE.
38+
* This implementation also works on label maps as input.
3939
*
4040
* All computations are performed using integers, results are stored as shorts.
41+
* The maximum propagated distance is limited to Short.MAX_VALUE.
4142
*
4243
* @see GeodesicDistanceTransformFloatHybrid
4344
*
@@ -416,6 +417,7 @@ private void normalizeResult(ShortProcessor distMap, ImageProcessor labelImage)
416417
// retrieve the minimum weight
417418
double w0 = this.mask.getNormalizationWeight();
418419

420+
// iterate over pixels within map to normalize values
419421
for (int y = 0; y < sizeY; y++)
420422
{
421423
for (int x = 0; x < sizeX; x++)

0 commit comments

Comments
 (0)