private static void sobelFile(String filename, int numIterations,
                                boolean rle) {
    System.out.println("Reading image file " + filename);
    PixImage image = ImageUtils.readTIFFPix(filename);
    PixImage blurred = image;

    if (numIterations > 0) {
      System.out.println("Blurring image file.");
      blurred = image.boxBlur(numIterations);

      String blurname = "blur_" + filename;
      System.out.println("Writing blurred image file " + blurname);
      TIFFEncoder.writeTIFF(blurred, blurname);
    }

    System.out.println("Performing Sobel edge detection on image file.");
    PixImage sobeled = blurred.sobelEdges();

    String edgename = "edge_" + filename;
    System.out.println("Writing grayscale-edge image file " + edgename);
    TIFFEncoder.writeTIFF(sobeled, edgename);
    if (rle) {
      String rlename = "rle_" + filename;
      System.out.println("Writing run-length encoded grayscale-edge " +
                         "image file " + rlename);
      TIFFEncoder.writeTIFF(new RunLengthEncoding(sobeled), rlename);
    }

    if (numIterations > 0) {
      System.out.println("Displaying input image, blurred image, and " +
                         "grayscale-edge image.");
      System.out.println("Close the image to quit.");
      ImageUtils.displayTIFFs(new PixImage[] { image, blurred, sobeled });
    } else {
      System.out.println("Displaying input image and grayscale-edge image.");
      System.out.println("Close the image to quit.");
      ImageUtils.displayTIFFs(new PixImage[] { image, sobeled });
    }
  }