Program: 26241
Project: 26241
Buggy source:
/** 
 * Create a new instance of MainDialog.
 * @param parentWindow pointer to the parent window
 * @param imageList list of images from ImageJ
 * @param mode default registration mode (0 = Fast, 1 = Accurate, 2 = Mono)
 * @param maxImageSubsamplingFactor subsampling factor at highest resolution level
 * @param min_scale_deformation default minimum scale deformation value
 * @param max_scale_deformation default maximum scale deformation value
 * @param divWeight default divergence weight
 * @param curlWeight default curl weight
 * @param landmarkWeight default landmarks weight
 * @param imageWeight default image similarity weight
 * @param consistencyWeight default consistency weight
 * @param stopThreshold default stopping threshold
 * @param richOutput default verbose flag
 * @param saveTransformation default save transformations flag
 */
public MainDialog(final Frame parentWindow,final ImagePlus[] imageList,final int mode,final int maxImageSubsamplingFactor,final int min_scale_deformation,final int max_scale_deformation,final double divWeight,final double curlWeight,final double landmarkWeight,final double imageWeight,final double consistencyWeight,final double stopThreshold,final boolean richOutput,final boolean saveTransformation){
  super("String_Node_Str",null);
  setModal(false);
  this.imageList=imageList;
  this.mode=mode;
  this.maxImageSubsamplingFactor=maxImageSubsamplingFactor;
  this.min_scale_deformation=min_scale_deformation;
  this.max_scale_deformation=max_scale_deformation;
  this.divWeight=divWeight;
  this.curlWeight=curlWeight;
  this.landmarkWeight=landmarkWeight;
  this.imageWeight=imageWeight;
  this.consistencyWeight=consistencyWeight;
  this.stopThreshold=stopThreshold;
  this.richOutput=richOutput;
  this.saveTransformation=saveTransformation;
  String[] titles=new String[imageList.length];
  for (int i=0; i < titles.length; ++i)   titles[i]=imageList[i].getTitle();
  addChoice("String_Node_Str",titles,titles[sourceChoiceIndex]);
  this.sourceChoice=(Choice)super.getChoices().lastElement();
  addChoice("String_Node_Str",titles,titles[targetChoiceIndex]);
  this.targetChoice=(Choice)super.getChoices().lastElement();
  String[] sRegistrationModes={"String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sRegistrationModes,sRegistrationModes[this.mode]);
  this.modeChoice=(Choice)super.getChoices().lastElement();
  this.addSlider("String_Node_Str",0,7,this.maxImageSubsamplingFactor);
  this.resamplingSlider=(Scrollbar)(super.getSliders().lastElement());
  this.resamplingSlider.addAdjustmentListener(new AdjustmentListener(){
    public void adjustmentValueChanged(    AdjustmentEvent adjustmentEvent){
      MainDialog.this.maxImageSubsamplingFactor=Integer.parseInt(resamplingTextField.getText());
    }
  }
);
  this.resamplingTextField=(TextField)(super.getNumericFields().lastElement());
  this.resamplingTextField.setEnabled(false);
  addMessage("String_Node_Str");
  String[] sMinScaleDeformationChoices={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sMinScaleDeformationChoices,sMinScaleDeformationChoices[this.min_scale_deformation]);
  this.minScaleChoice=(Choice)super.getChoices().lastElement();
  String[] sMaxScaleDeformationChoices={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sMaxScaleDeformationChoices,sMaxScaleDeformationChoices[this.max_scale_deformation]);
  this.maxScaleChoice=(Choice)super.getChoices().lastElement();
  addNumericField("String_Node_Str",this.divWeight,1);
  addNumericField("String_Node_Str",this.curlWeight,1);
  addNumericField("String_Node_Str",this.landmarkWeight,1);
  addNumericField("String_Node_Str",this.imageWeight,1);
  addNumericField("String_Node_Str",this.consistencyWeight,1);
  this.consistencyWeightTextField=(TextField)super.getNumericFields().lastElement();
  if (this.mode == MainDialog.MONO_MODE) {
    this.bIsReverse=false;
    this.consistencyWeightTextField.setEnabled(false);
  }
  addNumericField("String_Node_Str",this.stopThreshold,2);
  addCheckbox("String_Node_Str",this.richOutput);
  addCheckbox("String_Node_Str",this.saveTransformation);
  this.bMacro=Macro.getOptions() != null;
  createSourceImage(bIsReverse);
  createTargetImage();
  loadPointRoiAsLandmarks();
  setSecondaryPointHandlers();
}

Fixed version (ground truth):
/** 
 * Create a new instance of MainDialog.
 * @param parentWindow pointer to the parent window
 * @param imageList list of images from ImageJ
 * @param mode default registration mode (0 = Fast, 1 = Accurate, 2 = Mono)
 * @param maxImageSubsamplingFactor subsampling factor at highest resolution level
 * @param min_scale_deformation default minimum scale deformation value
 * @param max_scale_deformation default maximum scale deformation value
 * @param divWeight default divergence weight
 * @param curlWeight default curl weight
 * @param landmarkWeight default landmarks weight
 * @param imageWeight default image similarity weight
 * @param consistencyWeight default consistency weight
 * @param stopThreshold default stopping threshold
 * @param richOutput default verbose flag
 * @param saveTransformation default save transformations flag
 */
public MainDialog(final Frame parentWindow,final ImagePlus[] imageList,final int mode,final int maxImageSubsamplingFactor,final int min_scale_deformation,final int max_scale_deformation,final double divWeight,final double curlWeight,final double landmarkWeight,final double imageWeight,final double consistencyWeight,final double stopThreshold,final boolean richOutput,final boolean saveTransformation){
  super("String_Node_Str",null);
  setModal(false);
  this.imageList=imageList;
  this.mode=mode;
  this.maxImageSubsamplingFactor=maxImageSubsamplingFactor;
  this.min_scale_deformation=min_scale_deformation;
  this.max_scale_deformation=max_scale_deformation;
  this.divWeight=divWeight;
  this.curlWeight=curlWeight;
  this.landmarkWeight=landmarkWeight;
  this.imageWeight=imageWeight;
  this.consistencyWeight=consistencyWeight;
  this.stopThreshold=stopThreshold;
  this.richOutput=richOutput;
  this.saveTransformation=saveTransformation;
  String[] titles=new String[imageList.length];
  for (int i=0; i < titles.length; ++i)   titles[i]=imageList[i].getTitle();
  addChoice("String_Node_Str",titles,titles[sourceChoiceIndex]);
  this.sourceChoice=(Choice)super.getChoices().lastElement();
  addChoice("String_Node_Str",titles,titles[targetChoiceIndex]);
  this.targetChoice=(Choice)super.getChoices().lastElement();
  String[] sRegistrationModes={"String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sRegistrationModes,sRegistrationModes[this.mode]);
  this.modeChoice=(Choice)super.getChoices().lastElement();
  this.addSlider("String_Node_Str",0,7,this.maxImageSubsamplingFactor);
  this.resamplingSlider=(Scrollbar)(super.getSliders().lastElement());
  this.resamplingSlider.addAdjustmentListener(new AdjustmentListener(){
    public void adjustmentValueChanged(    AdjustmentEvent adjustmentEvent){
      MainDialog.this.maxImageSubsamplingFactor=Integer.parseInt(resamplingTextField.getText());
      source.setSubsamplingFactor(MainDialog.this.maxImageSubsamplingFactor);
      target.setSubsamplingFactor(MainDialog.this.maxImageSubsamplingFactor);
    }
  }
);
  this.resamplingTextField=(TextField)(super.getNumericFields().lastElement());
  this.resamplingTextField.setEnabled(false);
  addMessage("String_Node_Str");
  String[] sMinScaleDeformationChoices={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sMinScaleDeformationChoices,sMinScaleDeformationChoices[this.min_scale_deformation]);
  this.minScaleChoice=(Choice)super.getChoices().lastElement();
  String[] sMaxScaleDeformationChoices={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  addChoice("String_Node_Str",sMaxScaleDeformationChoices,sMaxScaleDeformationChoices[this.max_scale_deformation]);
  this.maxScaleChoice=(Choice)super.getChoices().lastElement();
  addNumericField("String_Node_Str",this.divWeight,1);
  addNumericField("String_Node_Str",this.curlWeight,1);
  addNumericField("String_Node_Str",this.landmarkWeight,1);
  addNumericField("String_Node_Str",this.imageWeight,1);
  addNumericField("String_Node_Str",this.consistencyWeight,1);
  this.consistencyWeightTextField=(TextField)super.getNumericFields().lastElement();
  if (this.mode == MainDialog.MONO_MODE) {
    this.bIsReverse=false;
    this.consistencyWeightTextField.setEnabled(false);
  }
  addNumericField("String_Node_Str",this.stopThreshold,2);
  addCheckbox("String_Node_Str",this.richOutput);
  addCheckbox("String_Node_Str",this.saveTransformation);
  this.bMacro=Macro.getOptions() != null;
  createSourceImage(bIsReverse);
  createTargetImage();
  loadPointRoiAsLandmarks();
  setSecondaryPointHandlers();
}