Program: 26238
Project: 26238
Buggy source:
/** 
 * Action to be taken when choices change.
 * @param e item event
 */
public void itemStateChanged(ItemEvent e){
  super.itemStateChanged(e);
  Object o=e.getSource();
  if (!(o instanceof Choice))   return;
  Choice originChoice=(Choice)o;
  if (originChoice == this.sourceChoice) {
    final int newChoiceIndex=originChoice.getSelectedIndex();
    if (sourceChoiceIndex != newChoiceIndex) {
      if (targetChoiceIndex != newChoiceIndex) {
        sourceChoiceIndex=newChoiceIndex;
        ungrayImage(sourcePh.getPointAction());
        cancelSource();
        targetPh.removePoints();
        targetImp.setRoi(this.previousTargetRoi);
        createSourceImage(bIsReverse);
        loadPointRoiAsLandmarks();
        setSecondaryPointHandlers();
      }
 else {
        targetChoiceIndex=sourceChoiceIndex;
        sourceChoiceIndex=newChoiceIndex;
        this.targetChoice.select(targetChoiceIndex);
        permuteImages(bIsReverse);
      }
    }
  }
 else   if (originChoice == this.targetChoice) {
    final int newChoiceIndex=originChoice.getSelectedIndex();
    if (targetChoiceIndex != newChoiceIndex) {
      if (sourceChoiceIndex != newChoiceIndex) {
        targetChoiceIndex=newChoiceIndex;
        ungrayImage(targetPh.getPointAction());
        cancelTarget();
        sourcePh.removePoints();
        sourceImp.setRoi(this.previousSourceRoi);
        createTargetImage();
        loadPointRoiAsLandmarks();
        setSecondaryPointHandlers();
      }
 else {
        sourceChoiceIndex=targetChoiceIndex;
        targetChoiceIndex=newChoiceIndex;
        this.sourceChoice.select(sourceChoiceIndex);
        permuteImages(bIsReverse);
      }
    }
  }
 else   if (originChoice == this.modeChoice) {
    final int accurate_mode=originChoice.getSelectedIndex();
    if (accurate_mode == MainDialog.MONO_MODE)     this.consistencyWeightTextField.setEnabled(false);
 else     this.consistencyWeightTextField.setEnabled(true);
  }
 else   if (originChoice == this.minScaleChoice) {
    final int new_min_scale_deformation=originChoice.getSelectedIndex();
    int new_max_scale_deformation=max_scale_deformation;
    if (max_scale_deformation < new_min_scale_deformation)     new_max_scale_deformation=new_min_scale_deformation;
    if (new_min_scale_deformation != min_scale_deformation || new_max_scale_deformation != max_scale_deformation) {
      min_scale_deformation=new_min_scale_deformation;
      max_scale_deformation=new_max_scale_deformation;
      computeImagePyramidDepth();
      restartModelThreads(bIsReverse);
    }
    this.minScaleChoice.select(min_scale_deformation);
    this.maxScaleChoice.select(max_scale_deformation);
  }
 else   if (originChoice == this.maxScaleChoice) {
    final int new_max_scale_deformation=originChoice.getSelectedIndex();
    int new_min_scale_deformation=min_scale_deformation;
    if (new_max_scale_deformation < min_scale_deformation)     new_min_scale_deformation=new_max_scale_deformation;
    if (new_max_scale_deformation != max_scale_deformation || new_min_scale_deformation != min_scale_deformation) {
      min_scale_deformation=new_min_scale_deformation;
      max_scale_deformation=new_max_scale_deformation;
      computeImagePyramidDepth();
      restartModelThreads(bIsReverse);
    }
    this.maxScaleChoice.select(max_scale_deformation);
    this.minScaleChoice.select(min_scale_deformation);
  }
}

Fixed version (ground truth):
/** 
 * Action to be taken when choices change.
 * @param e item event
 */
public void itemStateChanged(ItemEvent e){
  super.itemStateChanged(e);
  Object o=e.getSource();
  if (!(o instanceof Choice))   return;
  Choice originChoice=(Choice)o;
  if (originChoice == this.sourceChoice) {
    final int newChoiceIndex=originChoice.getSelectedIndex();
    if (sourceChoiceIndex != newChoiceIndex) {
      if (targetChoiceIndex != newChoiceIndex) {
        sourceChoiceIndex=newChoiceIndex;
        ungrayImage(sourcePh.getPointAction());
        cancelSource();
        createSourceImage(bIsReverse);
        ungrayImage(targetPh.getPointAction());
        targetPh.removePoints();
        targetImp.setRoi(this.previousTargetRoi);
        loadPointRoiAsLandmarks();
        setSecondaryPointHandlers();
      }
 else {
        targetChoiceIndex=sourceChoiceIndex;
        sourceChoiceIndex=newChoiceIndex;
        this.targetChoice.select(targetChoiceIndex);
        permuteImages(bIsReverse);
      }
    }
  }
 else   if (originChoice == this.targetChoice) {
    final int newChoiceIndex=originChoice.getSelectedIndex();
    if (targetChoiceIndex != newChoiceIndex) {
      if (sourceChoiceIndex != newChoiceIndex) {
        targetChoiceIndex=newChoiceIndex;
        ungrayImage(targetPh.getPointAction());
        cancelTarget();
        createTargetImage();
        ungrayImage(this.sourcePh.getPointAction());
        sourcePh.removePoints();
        sourceImp.setRoi(this.previousSourceRoi);
        loadPointRoiAsLandmarks();
        setSecondaryPointHandlers();
      }
 else {
        sourceChoiceIndex=targetChoiceIndex;
        targetChoiceIndex=newChoiceIndex;
        this.sourceChoice.select(sourceChoiceIndex);
        permuteImages(bIsReverse);
      }
    }
  }
 else   if (originChoice == this.modeChoice) {
    final int accurate_mode=originChoice.getSelectedIndex();
    if (accurate_mode == MainDialog.MONO_MODE)     this.consistencyWeightTextField.setEnabled(false);
 else     this.consistencyWeightTextField.setEnabled(true);
  }
 else   if (originChoice == this.minScaleChoice) {
    final int new_min_scale_deformation=originChoice.getSelectedIndex();
    int new_max_scale_deformation=max_scale_deformation;
    if (max_scale_deformation < new_min_scale_deformation)     new_max_scale_deformation=new_min_scale_deformation;
    if (new_min_scale_deformation != min_scale_deformation || new_max_scale_deformation != max_scale_deformation) {
      min_scale_deformation=new_min_scale_deformation;
      max_scale_deformation=new_max_scale_deformation;
      computeImagePyramidDepth();
      restartModelThreads(bIsReverse);
    }
    this.minScaleChoice.select(min_scale_deformation);
    this.maxScaleChoice.select(max_scale_deformation);
  }
 else   if (originChoice == this.maxScaleChoice) {
    final int new_max_scale_deformation=originChoice.getSelectedIndex();
    int new_min_scale_deformation=min_scale_deformation;
    if (new_max_scale_deformation < min_scale_deformation)     new_min_scale_deformation=new_max_scale_deformation;
    if (new_max_scale_deformation != max_scale_deformation || new_min_scale_deformation != min_scale_deformation) {
      min_scale_deformation=new_min_scale_deformation;
      max_scale_deformation=new_max_scale_deformation;
      computeImagePyramidDepth();
      restartModelThreads(bIsReverse);
    }
    this.maxScaleChoice.select(max_scale_deformation);
    this.minScaleChoice.select(min_scale_deformation);
  }
}