private void showAll(Graphics g) {
    // draw the image
    if (background != null)
      g.drawImage(background, 0, 0, background.getWidth(), background.getHeight(), null);

    VisualizeFeatures.drawScalePoints((Graphics2D) g, levelPoints, radius);
  }
  @Override
  public synchronized void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g;

    double scaleX = ss.getInputWidth() / (double) getWidth();
    double scaleY = ss.getInputHeight() / (double) getHeight();
    double scale = Math.max(scaleX, scaleY);

    // scale it down so that the whole image is visible
    if (scale > 1) {
      AffineTransform tran = g2.getTransform();
      tran.concatenate(AffineTransform.getScaleInstance(1 / scale, 1 / scale));
      g2.setTransform(tran);
    }

    if (activeLevel == 0) showAll(g);
    else {
      g.drawImage(levelImage, 0, 0, levelImage.getWidth(), levelImage.getHeight(), null);
      VisualizeFeatures.drawScalePoints((Graphics2D) g, levelPoints, radius);
    }
  }