Program: 11710
Project: 11710
Buggy source:
final public void run(final String args){
  fs1.clear();
  fs2.clear();
  if (IJ.versionLessThan("String_Node_Str"))   return;
  final ImagePlus imp=WindowManager.getCurrentImage();
  if (imp == null) {
    System.err.println("String_Node_Str");
    return;
  }
  GenericDialog gd=new GenericDialog("String_Node_Str");
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.initialSigma,2,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.steps,0);
  gd.addNumericField("String_Node_Str",p.sift.minOctaveSize,0,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.maxOctaveSize,0,6,"String_Node_Str");
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.fdSize,0);
  gd.addNumericField("String_Node_Str",p.sift.fdBins,0);
  gd.addNumericField("String_Node_Str",p.rod,2);
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.maxEpsilon,2,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.minInlierRatio,2);
  gd.addChoice("String_Node_Str",Param.modelStrings,Param.modelStrings[p.modelIndex]);
  gd.addMessage("String_Node_Str");
  gd.addCheckbox("String_Node_Str",p.interpolate);
  gd.addCheckbox("String_Node_Str",p.showInfo);
  gd.showDialog();
  if (gd.wasCanceled())   return;
  p.sift.initialSigma=(float)gd.getNextNumber();
  p.sift.steps=(int)gd.getNextNumber();
  p.sift.minOctaveSize=(int)gd.getNextNumber();
  p.sift.maxOctaveSize=(int)gd.getNextNumber();
  p.sift.fdSize=(int)gd.getNextNumber();
  p.sift.fdBins=(int)gd.getNextNumber();
  p.rod=(float)gd.getNextNumber();
  p.maxEpsilon=(float)gd.getNextNumber();
  p.minInlierRatio=(float)gd.getNextNumber();
  p.modelIndex=gd.getNextChoiceIndex();
  p.interpolate=gd.getNextBoolean();
  p.showInfo=gd.getNextBoolean();
  ImageStack stack=imp.getStack();
  ImageStack stackAligned=new ImageStack(stack.getWidth(),stack.getHeight());
  float vis_scale=256.0f / imp.getWidth();
  ImageStack stackInfo=null;
  ImagePlus impInfo=null;
  if (p.showInfo)   stackInfo=new ImageStack(Math.round(vis_scale * stack.getWidth()),Math.round(vis_scale * stack.getHeight()));
  stackAligned.addSlice(null,stack.getProcessor(1));
  ImagePlus impAligned=new ImagePlus("String_Node_Str" + stack.getSize(),stackAligned);
  impAligned.show();
  ImageProcessor ip1;
  ImageProcessor ip2=stack.getProcessor(1);
  ImageProcessor ip3=null;
  FloatArray2DSIFT sift=new FloatArray2DSIFT(p.sift);
  SIFT ijSIFT=new SIFT(sift);
  long start_time=System.currentTimeMillis();
  IJ.log("String_Node_Str");
  ijSIFT.extractFeatures(ip2,fs2);
  IJ.log("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
  IJ.log(fs2.size() + "String_Node_Str");
  if (p.showInfo)   ip2=downScale(ip2,vis_scale);
  AbstractAffineModel2D model;
switch (p.modelIndex) {
case 0:
    model=new TranslationModel2D();
  break;
case 1:
model=new RigidModel2D();
break;
case 2:
model=new SimilarityModel2D();
break;
case 3:
model=new AffineModel2D();
break;
default :
return;
}
Mapping mapping=new InverseTransformMapping(model);
for (int i=1; i < stack.getSize(); ++i) {
ip1=ip2;
ip2=stack.getProcessor(i + 1);
fs1.clear();
fs1.addAll(fs2);
fs2.clear();
start_time=System.currentTimeMillis();
IJ.log("String_Node_Str");
ijSIFT.extractFeatures(ip2,fs2);
IJ.log("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
IJ.log(fs2.size() + "String_Node_Str");
start_time=System.currentTimeMillis();
System.out.print("String_Node_Str");
Vector<PointMatch> candidates=FloatArray2DSIFT.createMatches(fs2,fs1,1.5f,null,Float.MAX_VALUE,p.rod);
System.out.println("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
IJ.log(candidates.size() + "String_Node_Str");
if (p.showInfo) {
ip2=downScale(ip2,vis_scale);
ip1=ip1.convertToRGB();
ip3=ip2.convertToRGB();
ip1.setColor(Color.red);
ip3.setColor(Color.red);
ip1.setLineWidth(2);
ip3.setLineWidth(2);
for (PointMatch m : candidates) {
float[] m_p1=m.getP1().getL();
float[] m_p2=m.getP2().getL();
ip1.drawDot((int)Math.round(vis_scale * m_p2[0]),(int)Math.round(vis_scale * m_p2[1]));
ip3.drawDot((int)Math.round(vis_scale * m_p1[0]),(int)Math.round(vis_scale * m_p1[1]));
}
}
Vector<PointMatch> inliers=new Vector<PointMatch>();
AbstractAffineModel2D<?> currentModel;
switch (p.modelIndex) {
case 0:
currentModel=new TranslationModel2D();
break;
case 1:
currentModel=new RigidModel2D();
break;
case 2:
currentModel=new SimilarityModel2D();
break;
case 3:
currentModel=new AffineModel2D();
break;
default :
return;
}
boolean modelFound;
try {
modelFound=currentModel.filterRansac(candidates,inliers,1000,p.maxEpsilon,p.minInlierRatio);
}
 catch (Exception e) {
modelFound=false;
System.err.println(e.getMessage());
}
if (modelFound) {
if (p.showInfo) {
ip1.setColor(Color.green);
ip3.setColor(Color.green);
ip1.setLineWidth(2);
ip3.setLineWidth(2);
for (PointMatch m : inliers) {
float[] m_p1=m.getP1().getL();
float[] m_p2=m.getP2().getL();
ip1.drawDot((int)Math.round(vis_scale * m_p2[0]),(int)Math.round(vis_scale * m_p2[1]));
ip3.drawDot((int)Math.round(vis_scale * m_p1[0]),(int)Math.round(vis_scale * m_p1[1]));
}
}
model.concatenate(currentModel);
}
ImageProcessor alignedSlice=stack.getProcessor(i + 1).duplicate();
if (p.interpolate) mapping.mapInterpolated(stack.getProcessor(i + 1),alignedSlice);
 else mapping.map(stack.getProcessor(i + 1),alignedSlice);
stackAligned.addSlice(null,alignedSlice);
if (p.showInfo) {
ImageProcessor tmp;
tmp=ip1.createProcessor(stackInfo.getWidth(),stackInfo.getHeight());
tmp.insert(ip1,0,0);
stackInfo.addSlice(null,tmp);
tmp=ip3.createProcessor(stackInfo.getWidth(),stackInfo.getHeight());
tmp.insert(ip3,0,0);
stackInfo.addSlice(null,tmp);
if (i == 1) {
impInfo=new ImagePlus("String_Node_Str",stackInfo);
impInfo.show();
}
impInfo.setStack("String_Node_Str",stackInfo);
impInfo.updateAndDraw();
}
impAligned.setStack("String_Node_Str" + stackAligned.getSize() + "String_Node_Str"+ stack.getSize(),stackAligned);
impAligned.updateAndDraw();
}
}

Fixed version (ground truth):
final public void run(final String args){
  fs1.clear();
  fs2.clear();
  if (IJ.versionLessThan("String_Node_Str"))   return;
  final ImagePlus imp=WindowManager.getCurrentImage();
  if (imp == null) {
    System.err.println("String_Node_Str");
    return;
  }
  GenericDialog gd=new GenericDialog("String_Node_Str");
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.initialSigma,2,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.steps,0);
  gd.addNumericField("String_Node_Str",p.sift.minOctaveSize,0,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.maxOctaveSize,0,6,"String_Node_Str");
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.sift.fdSize,0);
  gd.addNumericField("String_Node_Str",p.sift.fdBins,0);
  gd.addNumericField("String_Node_Str",p.rod,2);
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",p.maxEpsilon,2,6,"String_Node_Str");
  gd.addNumericField("String_Node_Str",p.minInlierRatio,2);
  gd.addChoice("String_Node_Str",Param.modelStrings,Param.modelStrings[p.modelIndex]);
  gd.addMessage("String_Node_Str");
  gd.addCheckbox("String_Node_Str",p.interpolate);
  gd.addCheckbox("String_Node_Str",p.showInfo);
  gd.showDialog();
  if (gd.wasCanceled())   return;
  p.sift.initialSigma=(float)gd.getNextNumber();
  p.sift.steps=(int)gd.getNextNumber();
  p.sift.minOctaveSize=(int)gd.getNextNumber();
  p.sift.maxOctaveSize=(int)gd.getNextNumber();
  p.sift.fdSize=(int)gd.getNextNumber();
  p.sift.fdBins=(int)gd.getNextNumber();
  p.rod=(float)gd.getNextNumber();
  p.maxEpsilon=(float)gd.getNextNumber();
  p.minInlierRatio=(float)gd.getNextNumber();
  p.modelIndex=gd.getNextChoiceIndex();
  p.interpolate=gd.getNextBoolean();
  p.showInfo=gd.getNextBoolean();
  ImageStack stack=imp.getStack();
  ImageStack stackAligned=new ImageStack(stack.getWidth(),stack.getHeight());
  float vis_scale=256.0f / imp.getWidth();
  ImageStack stackInfo=null;
  ImagePlus impInfo=null;
  if (p.showInfo)   stackInfo=new ImageStack(Math.round(vis_scale * stack.getWidth()),Math.round(vis_scale * stack.getHeight()));
  stackAligned.addSlice(null,stack.getProcessor(1));
  ImagePlus impAligned=new ImagePlus("String_Node_Str" + stack.getSize(),stackAligned);
  impAligned.show();
  ImageProcessor ip1;
  ImageProcessor ip2=stack.getProcessor(1);
  ImageProcessor ip3=null;
  ImageProcessor ip4=null;
  FloatArray2DSIFT sift=new FloatArray2DSIFT(p.sift);
  SIFT ijSIFT=new SIFT(sift);
  long start_time=System.currentTimeMillis();
  IJ.log("String_Node_Str");
  ijSIFT.extractFeatures(ip2,fs2);
  IJ.log("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
  IJ.log(fs2.size() + "String_Node_Str");
  if (p.showInfo)   ip2=downScale(ip2,vis_scale);
  AbstractAffineModel2D model;
switch (p.modelIndex) {
case 0:
    model=new TranslationModel2D();
  break;
case 1:
model=new RigidModel2D();
break;
case 2:
model=new SimilarityModel2D();
break;
case 3:
model=new AffineModel2D();
break;
default :
return;
}
Mapping mapping=new InverseTransformMapping(model);
for (int i=1; i < stack.getSize(); ++i) {
ip1=ip2;
ip2=stack.getProcessor(i + 1);
fs1.clear();
fs1.addAll(fs2);
fs2.clear();
start_time=System.currentTimeMillis();
IJ.log("String_Node_Str");
ijSIFT.extractFeatures(ip2,fs2);
IJ.log("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
IJ.log(fs2.size() + "String_Node_Str");
start_time=System.currentTimeMillis();
System.out.print("String_Node_Str");
Vector<PointMatch> candidates=FloatArray2DSIFT.createMatches(fs2,fs1,1.5f,null,Float.MAX_VALUE,p.rod);
System.out.println("String_Node_Str" + (System.currentTimeMillis() - start_time) + "String_Node_Str");
IJ.log(candidates.size() + "String_Node_Str");
if (p.showInfo) {
ip2=downScale(ip2,vis_scale);
ip3=ip1.convertToRGB().duplicate();
ip4=ip2.convertToRGB().duplicate();
ip3.setColor(Color.red);
ip4.setColor(Color.red);
ip3.setLineWidth(2);
ip4.setLineWidth(2);
for (PointMatch m : candidates) {
float[] m_p1=m.getP1().getL();
float[] m_p2=m.getP2().getL();
ip3.drawDot((int)Math.round(vis_scale * m_p2[0]),(int)Math.round(vis_scale * m_p2[1]));
ip4.drawDot((int)Math.round(vis_scale * m_p1[0]),(int)Math.round(vis_scale * m_p1[1]));
}
}
Vector<PointMatch> inliers=new Vector<PointMatch>();
AbstractAffineModel2D<?> currentModel;
switch (p.modelIndex) {
case 0:
currentModel=new TranslationModel2D();
break;
case 1:
currentModel=new RigidModel2D();
break;
case 2:
currentModel=new SimilarityModel2D();
break;
case 3:
currentModel=new AffineModel2D();
break;
default :
return;
}
boolean modelFound;
try {
modelFound=currentModel.filterRansac(candidates,inliers,1000,p.maxEpsilon,p.minInlierRatio);
}
 catch (Exception e) {
modelFound=false;
System.err.println(e.getMessage());
}
if (modelFound) {
if (p.showInfo) {
ip3.setColor(Color.green);
ip4.setColor(Color.green);
ip3.setLineWidth(2);
ip4.setLineWidth(2);
for (PointMatch m : inliers) {
float[] m_p1=m.getP1().getL();
float[] m_p2=m.getP2().getL();
ip3.drawDot((int)Math.round(vis_scale * m_p2[0]),(int)Math.round(vis_scale * m_p2[1]));
ip4.drawDot((int)Math.round(vis_scale * m_p1[0]),(int)Math.round(vis_scale * m_p1[1]));
}
}
model.concatenate(currentModel);
}
ImageProcessor alignedSlice=stack.getProcessor(i + 1).duplicate();
if (p.interpolate) mapping.mapInterpolated(stack.getProcessor(i + 1),alignedSlice);
 else mapping.map(stack.getProcessor(i + 1),alignedSlice);
stackAligned.addSlice(null,alignedSlice);
if (p.showInfo) {
ImageProcessor tmp;
tmp=ip3.createProcessor(stackInfo.getWidth(),stackInfo.getHeight());
tmp.insert(ip3,0,0);
stackInfo.addSlice(null,tmp);
tmp=ip4.createProcessor(stackInfo.getWidth(),stackInfo.getHeight());
tmp.insert(ip4,0,0);
stackInfo.addSlice(null,tmp);
if (i == 1) {
impInfo=new ImagePlus("String_Node_Str",stackInfo);
impInfo.show();
}
impInfo.setStack("String_Node_Str",stackInfo);
impInfo.updateAndDraw();
}
impAligned.setStack("String_Node_Str" + stackAligned.getSize() + "String_Node_Str"+ stack.getSize(),stackAligned);
impAligned.updateAndDraw();
}
}