Skip to content

Commit

Permalink
Merge branch 'BIO_ICT_plugins-have-optional-emptyImg-check-disable'
Browse files Browse the repository at this point in the history
  • Loading branch information
xulman committed Nov 22, 2023
2 parents d107a06 + b556a51 commit 05797e6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/celltrackingchallenge/measures/DET.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public double calculate(final String gtPath, final String resPath,
//do the upper stage
cache = new TrackDataCache(log);
cache.noOfDigits = noOfDigits;
cache.shouldComplainOnEmptyImages = doStopOnEmptyImages;

log.info(" GT path: "+gtPath+"/TRA");
log.info("RES path: "+resPath);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/celltrackingchallenge/measures/TRA.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public TrackDataCache getCache()
*/
public boolean doConsistencyCheck = false;

/** This switches SEG to complain (and stop calculating)
if empty ground-truth or result image was found. */
public boolean doStopOnEmptyImages = true;

/**
* Calculation option: do report list of discrepancies between the reference
* and computed tracking result.
Expand Down Expand Up @@ -551,6 +555,7 @@ public double calculate(final String gtPath, final String resPath,
//do the upper stage
cache = new TrackDataCache(log);
cache.noOfDigits = noOfDigits;
cache.shouldComplainOnEmptyImages = doStopOnEmptyImages;
cache.calculate(gtPath,resPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,23 @@ public void setupSimilarAs(final TrackDataCache _referenceCache)
throw new NullPointerException("No existing (null) template/reference cache has been supplied.");

noOfDigits = _referenceCache.noOfDigits;
shouldComplainOnEmptyImages = _referenceCache.shouldComplainOnEmptyImages;
overlapRatio = _referenceCache.overlapRatio;
}

///specifies how many digits are to be expected in the input filenames
/** specifies how many digits are to be expected in the input filenames */
public int noOfDigits = 3;

/** specifies if the processing should stop when an input image with no segmentation/detection is found,
it's advisable to stop on empty images, the code may assume at places that there's always at least
one segmentation mask found in every image and definitively the code assumes that there's at least
one mask in a whole sequence (otherwise division by zero will occur) */
public boolean shouldComplainOnEmptyImages = true;

/** specifies what relative proportion of the area of a GT marker must be covered in order to declare a match,
it's advisable to avoid going below 0.5, the code may assume at places that overlapRatio >= 0.5 */
public double overlapRatio = 0.5;

///GT and RES paths combination for which this cache is valid, null means invalid
private String gtPath = null;
///GT and RES paths combination for which this cache is valid, null means invalid
Expand Down Expand Up @@ -522,14 +534,14 @@ public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
{
//default behavior is to be very strict:
// complain whenever empty result or GT image is found
ClassifyLabels(gt_img,res_img, true, levels.size(), 0.5);
ClassifyLabels(gt_img,res_img, shouldComplainOnEmptyImages, levels.size(), overlapRatio);
}

public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
RandomAccessibleInterval<UnsignedShortType> res_img,
final boolean shouldComplainOnEmptyImages)
final boolean _shouldComplainOnEmptyImages)
{
ClassifyLabels(gt_img,res_img, shouldComplainOnEmptyImages, levels.size(), 0.5);
ClassifyLabels(gt_img,res_img, _shouldComplainOnEmptyImages, levels.size(), overlapRatio);
}

public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
Expand All @@ -538,23 +550,23 @@ public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
{
//default behavior is to be very strict:
// complain whenever empty result or GT image is found
ClassifyLabels(gt_img,res_img, true, time, 0.5);
ClassifyLabels(gt_img,res_img, shouldComplainOnEmptyImages, time, overlapRatio);
}

public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
RandomAccessibleInterval<UnsignedShortType> res_img,
final boolean shouldComplainOnEmptyImages,
final boolean _shouldComplainOnEmptyImages,
final int time)
{
//default behavior is to be very strict:
// complain whenever empty result or GT image is found
ClassifyLabels(gt_img,res_img, shouldComplainOnEmptyImages, time, 0.5);
ClassifyLabels(gt_img,res_img, _shouldComplainOnEmptyImages, time, overlapRatio);
}

@SuppressWarnings("unchecked")
public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
RandomAccessibleInterval<UnsignedShortType> res_img,
final boolean shouldComplainOnEmptyImages,
final boolean _shouldComplainOnEmptyImages,
final int time,
final double overlapRatio)
{
Expand Down Expand Up @@ -634,9 +646,9 @@ public void ClassifyLabels(IterableInterval<UnsignedShortType> gt_img,
}

//check the images are not completely blank
if (shouldComplainOnEmptyImages && level.m_res_lab.length == 0)
if (_shouldComplainOnEmptyImages && level.m_res_lab.length == 0)
throw new IllegalArgumentException("RES image has no markers!");
if (shouldComplainOnEmptyImages && level.m_gt_lab.length == 0)
if (_shouldComplainOnEmptyImages && level.m_gt_lab.length == 0)
throw new IllegalArgumentException("GT image has no markers!");

//we don't need this one anymore
Expand Down

0 comments on commit 05797e6

Please sign in to comment.