Program: 22769
Project: 22769
Buggy source:
/** 
 * Use simple point relaxation to warp 2D source into 2D target.  Source is only modified at nonzero locations in the mask  (multi-thread version)
 * @param source input image to be relaxed
 * @param target target image
 * @param mask image mask
 * @param binaryThreshold binarization threshold
 * @return warped source image
 */
public ImagePlus simplePointWarp2dMT(ImagePlus source,ImagePlus target,ImagePlus mask,double binaryThreshold){
  if (source.getWidth() != target.getWidth() || source.getHeight() != target.getHeight() || source.getImageStackSize() != target.getImageStackSize()) {
    IJ.log("String_Node_Str");
    return null;
  }
  final ImageStack sourceSlices=source.getImageStack();
  final ImageStack targetSlices=target.getImageStack();
  final ImageStack maskSlices=(null != mask) ? mask.getImageStack() : null;
  final ImageStack warpedSource=new ImageStack(source.getWidth(),source.getHeight());
  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),targetSlices.getProcessor(i),null != mask ? maskSlices.getProcessor(i) : null,binaryThreshold)));
    }
    double warpingError=0;
    int i=0;
    for (    Future<WarpingResults> f : futures) {
      final WarpingResults wr=f.get();
      if (null != wr.warpedSource)       warpedSource.addSlice("String_Node_Str" + i,wr.warpedSource.getProcessor());
      if (wr.warpingError != -1)       warpingError+=wr.warpingError;
      i++;
    }
    IJ.log("String_Node_Str" + (warpingError / sourceSlices.getSize()));
  }
 catch (  Exception ex) {
    IJ.log("String_Node_Str");
  }
 finally {
    exe.shutdown();
  }
  return new ImagePlus("String_Node_Str",warpedSource);
}

Fixed version (ground truth):
/** 
 * Use simple point relaxation to warp 2D source into 2D target.  Source is only modified at nonzero locations in the mask  (multi-thread version)
 * @param source input image to be relaxed
 * @param target target image
 * @param mask image mask
 * @param binaryThreshold binarization threshold
 * @return warped source image
 */
public ImagePlus simplePointWarp2dMT(ImagePlus source,ImagePlus target,ImagePlus mask,double binaryThreshold){
  if (source.getWidth() != target.getWidth() || source.getHeight() != target.getHeight() || source.getImageStackSize() != target.getImageStackSize()) {
    IJ.log("String_Node_Str");
    return null;
  }
  final ImageStack sourceSlices=source.getImageStack();
  final ImageStack targetSlices=target.getImageStack();
  final ImageStack maskSlices=(null != mask) ? mask.getImageStack() : null;
  final ImageStack warpedSource=new ImageStack(source.getWidth(),source.getHeight());
  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),targetSlices.getProcessor(i),null != maskSlices ? maskSlices.getProcessor(i) : null,binaryThreshold)));
    }
    double warpingError=0;
    int i=0;
    for (    Future<WarpingResults> f : futures) {
      final WarpingResults wr=f.get();
      if (null != wr.warpedSource)       warpedSource.addSlice("String_Node_Str" + i,wr.warpedSource.getProcessor());
      if (wr.warpingError != -1)       warpingError+=wr.warpingError;
      i++;
    }
    IJ.log("String_Node_Str" + (warpingError / sourceSlices.getSize()));
  }
 catch (  Exception ex) {
    IJ.log("String_Node_Str");
    ex.printStackTrace();
  }
 finally {
    exe.shutdown();
  }
  return new ImagePlus("String_Node_Str",warpedSource);
}