Program: 22742
Project: 22742
Buggy source:
/** 
 * Use simple point relaxation to warp 2D labels into the 2D proposal. Source is only modified at nonzero locations in the mask (multi-thread version)
 * @param binaryThreshold binarization threshold
 * @param calculateMismatchImage boolean flag to calculate mismatch image
 * @param radius radius in pixels to use while classifying mismatches
 * @return warping results for each slice of the source
 */
public WarpingResults[] simplePointWarp2dMT(double binaryThreshold,boolean calculateMismatchImage,int radius){
  final ImageStack sourceSlices=originalLabels.getImageStack();
  final ImageStack targetSlices=proposedLabels.getImageStack();
  final ImageStack maskSlices=(null != mask) ? mask.getImageStack() : null;
  final WarpingResults[] wrs=new WarpingResults[originalLabels.getImageStackSize()];
  final ExecutorService exe=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
  final ArrayList<Future<WarpingResults>> futures=new ArrayList<Future<WarpingResults>>();
  try {
    for (int i=1; i <= sourceSlices.getSize(); i++) {
      futures.add(exe.submit(simplePointWarp2DConcurrent(sourceSlices.getProcessor(i).convertToFloat(),targetSlices.getProcessor(i).convertToFloat(),null != maskSlices ? maskSlices.getProcessor(i) : null,binaryThreshold,calculateMismatchImage,radius)));
    }
    int i=0;
    for (    Future<WarpingResults> f : futures) {
      wrs[i]=f.get();
      i++;
    }
  }
 catch (  Exception ex) {
    IJ.log("String_Node_Str");
    ex.printStackTrace();
  }
 finally {
    exe.shutdown();
  }
  return wrs;
}

Fixed version (ground truth):
/** 
 * Use simple point relaxation to warp 2D labels into the 2D proposal. Source is only modified at nonzero locations in the mask (multi-thread version)
 * @param binaryThreshold binarization threshold
 * @param clusterByError if false, cluster mismatches by type, otherwise cluster them by error and type
 * @param calculateMismatchImage boolean flag to calculate mismatch image
 * @param radius radius in pixels to use while classifying mismatches
 * @return warping results for each slice of the source
 */
public WarpingResults[] simplePointWarp2dMT(double binaryThreshold,boolean clusterByError,boolean calculateMismatchImage,int radius){
  final ImageStack sourceSlices=originalLabels.getImageStack();
  final ImageStack targetSlices=proposedLabels.getImageStack();
  final ImageStack maskSlices=(null != mask) ? mask.getImageStack() : null;
  final WarpingResults[] wrs=new WarpingResults[originalLabels.getImageStackSize()];
  final ExecutorService exe=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
  final ArrayList<Future<WarpingResults>> futures=new ArrayList<Future<WarpingResults>>();
  try {
    for (int i=1; i <= sourceSlices.getSize(); i++) {
      futures.add(exe.submit(getWarpingResultsConcurrent(sourceSlices.getProcessor(i).convertToFloat(),targetSlices.getProcessor(i).convertToFloat(),null != maskSlices ? maskSlices.getProcessor(i) : null,binaryThreshold,clusterByError,radius,flags,calculateMismatchImage)));
    }
    int i=0;
    for (    Future<WarpingResults> f : futures) {
      wrs[i]=f.get();
      i++;
    }
  }
 catch (  Exception ex) {
    IJ.log("String_Node_Str");
    ex.printStackTrace();
  }
 finally {
    exe.shutdown();
  }
  return wrs;
}