Пример #1
0
    // GL
    public synchronized void itemStateChanged(ItemEvent e) {
      if (e.getSource() == hsb) isRGB = false;
      if (e.getSource() == rgb) isRGB = true;

      if (e.getSource() == hsb || e.getSource() == rgb) {
        flag = true;
        originalB.setEnabled(false);
        filteredB.setEnabled(false);

        minHue = minSat = minBri = 0;
        maxHue = maxSat = maxBri = 255;

        bandPassH.setState(true);
        bandPassS.setState(true);
        bandPassB.setState(true);
      }
      reset(imp, ip);
      ip = setup(imp);
      apply(imp, ip);
      updateNames();
      notify();
    }
Пример #2
0
    public BandAdjuster() {

      super("Threshold Colour");
      if (instance != null) {
        instance.toFront();
        return;
      }
      imp = WindowManager.getCurrentImage();
      if (imp == null) {
        IJ.beep();
        IJ.showStatus("No image");
        return;
      }
      IJ.run("Select None");
      thread = new Thread(this, "BandAdjuster");
      WindowManager.addWindow(this);
      instance = this;
      IJ.register(PasteController.class);

      ij = IJ.getInstance();
      Font font = new Font("SansSerif", Font.PLAIN, 10);
      GridBagLayout gridbag = new GridBagLayout();
      GridBagConstraints c = new GridBagConstraints();
      setLayout(gridbag);

      int y = 0;
      c.gridx = 0;
      c.gridy = y;
      c.gridwidth = 1;
      c.weightx = 0;
      c.insets = new Insets(5, 0, 0, 0);
      labelh = new Label("Hue", Label.CENTER);
      add(labelh, c);

      c.gridx = 1;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = 0;
      c.insets = new Insets(7, 0, 0, 0);
      labelf = new Label("Filter type", Label.RIGHT);
      add(labelf, c);

      // plot
      c.gridx = 0;
      c.gridy = y;
      c.gridwidth = 1;
      c.fill = c.BOTH;
      c.anchor = c.CENTER;
      c.insets = new Insets(0, 5, 0, 0);
      add(plot, c);

      // checkboxes
      panelh = new Panel();
      filterTypeH = new CheckboxGroup();
      bandPassH = new Checkbox("Pass");
      bandPassH.setCheckboxGroup(filterTypeH);
      bandPassH.addItemListener(this);
      panelh.add(bandPassH);
      bandStopH = new Checkbox("Stop");
      bandStopH.setCheckboxGroup(filterTypeH);
      bandStopH.addItemListener(this);
      panelh.add(bandStopH);
      bandPassH.setState(true);
      c.gridx = 1;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(5, 0, 0, 0);
      add(panelh, c);

      // minHue slider
      minSlider = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 90 : 100;
      c.fill = c.HORIZONTAL;
      c.insets = new Insets(5, 5, 0, 0);

      add(minSlider, c);
      minSlider.addAdjustmentListener(this);
      minSlider.setUnitIncrement(1);

      // minHue slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 10 : 0;
      c.insets = new Insets(5, 0, 0, 0);
      label1 = new Label("       ", Label.LEFT);
      label1.setFont(font);
      add(label1, c);

      // maxHue sliderHue
      maxSlider = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y;
      c.gridwidth = 1;
      c.weightx = 100;
      c.insets = new Insets(5, 5, 0, 0);
      add(maxSlider, c);
      maxSlider.addAdjustmentListener(this);
      maxSlider.setUnitIncrement(1);

      // maxHue slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.gridy = y++;
      c.weightx = 0;
      c.insets = new Insets(5, 0, 0, 0);
      label2 = new Label("       ", Label.LEFT);
      label2.setFont(font);
      add(label2, c);

      // =====
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = 0;
      c.insets = new Insets(10, 0, 0, 0);
      labels = new Label("Saturation", Label.CENTER);
      add(labels, c);

      // plot
      c.gridx = 0;
      c.gridy = y;
      c.gridwidth = 1;
      c.fill = c.BOTH;
      c.anchor = c.CENTER;
      c.insets = new Insets(0, 5, 0, 0);
      add(splot, c);

      // checkboxes
      panels = new Panel();
      filterTypeS = new CheckboxGroup();
      bandPassS = new Checkbox("Pass");
      bandPassS.setCheckboxGroup(filterTypeS);
      bandPassS.addItemListener(this);
      panels.add(bandPassS);
      bandStopS = new Checkbox("Stop");
      bandStopS.setCheckboxGroup(filterTypeS);
      bandStopS.addItemListener(this);
      panels.add(bandStopS);
      bandPassS.setState(true);
      c.gridx = 1;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(5, 0, 0, 0);
      add(panels, c);

      // minSat slider
      minSlider2 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 90 : 100;
      c.fill = c.HORIZONTAL;
      c.insets = new Insets(5, 5, 0, 0);
      add(minSlider2, c);
      minSlider2.addAdjustmentListener(this);
      minSlider2.setUnitIncrement(1);

      // minSat slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 10 : 0;
      c.insets = new Insets(5, 0, 0, 0);
      label3 = new Label("       ", Label.LEFT);
      label3.setFont(font);
      add(label3, c);

      // maxSat slider
      maxSlider2 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = 100;
      c.insets = new Insets(5, 5, 0, 0);
      add(maxSlider2, c);
      maxSlider2.addAdjustmentListener(this);
      maxSlider2.setUnitIncrement(1);

      // maxSat slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.weightx = 0;
      c.insets = new Insets(5, 0, 0, 0);
      label4 = new Label("       ", Label.LEFT);
      label4.setFont(font);
      add(label4, c);

      // =====
      c.gridx = 0;
      c.gridwidth = 1;
      c.gridy = y++;
      c.weightx = 0;
      c.insets = new Insets(10, 0, 0, 0);
      labelb = new Label("Brightness", Label.CENTER);
      add(labelb, c);

      c.gridx = 0;
      c.gridwidth = 1;
      c.gridy = y;
      c.fill = c.BOTH;
      c.anchor = c.CENTER;
      c.insets = new Insets(0, 5, 0, 0);
      add(bplot, c);

      // checkboxes
      panelb = new Panel();
      filterTypeB = new CheckboxGroup();
      bandPassB = new Checkbox("Pass");
      bandPassB.setCheckboxGroup(filterTypeB);
      bandPassB.addItemListener(this);
      panelb.add(bandPassB);
      bandStopB = new Checkbox("Stop");
      bandStopB.setCheckboxGroup(filterTypeB);
      bandStopB.addItemListener(this);
      panelb.add(bandStopB);
      bandPassB.setState(true);
      c.gridx = 1;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(5, 0, 0, 0);
      add(panelb, c);

      // minBri slider
      minSlider3 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 90 : 100;
      c.fill = c.HORIZONTAL;
      c.insets = new Insets(5, 5, 0, 0);
      add(minSlider3, c);
      minSlider3.addAdjustmentListener(this);
      minSlider3.setUnitIncrement(1);

      // minBri slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.weightx = IJ.isMacintosh() ? 10 : 0;
      c.insets = new Insets(5, 0, 0, 0);
      label5 = new Label("       ", Label.LEFT);
      label5.setFont(font);
      add(label5, c);

      // maxBri slider
      maxSlider3 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, sliderRange);
      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 1;
      c.weightx = 100;
      c.insets = new Insets(5, 5, 0, 0);
      add(maxSlider3, c);
      maxSlider3.addAdjustmentListener(this);
      maxSlider3.setUnitIncrement(1);

      // maxBri slider label
      c.gridx = 1;
      c.gridwidth = 1;
      c.weightx = 0;
      c.insets = new Insets(5, 0, 0, 0);
      label6 = new Label("       ", Label.LEFT);
      label6.setFont(font);
      add(label6, c);

      // =====
      panelt = new Panel();
      threshold = new Checkbox("Threshold");
      threshold.addItemListener(this);
      panelt.add(threshold);

      invert = new Checkbox("Invert");
      invert.addItemListener(this);
      panelt.add(invert);

      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(0, 0, 0, 0);
      add(panelt, c);

      // buttons
      panel = new Panel();
      // panel.setLayout(new GridLayout(2, 2, 0, 0));
      originalB = new Button("Original");
      originalB.setEnabled(false);
      originalB.addActionListener(this);
      originalB.addKeyListener(ij);
      panel.add(originalB);

      filteredB = new Button("Filtered");
      filteredB.setEnabled(false);
      filteredB.addActionListener(this);
      filteredB.addKeyListener(ij);
      panel.add(filteredB);

      stackB = new Button("Stack");
      stackB.addActionListener(this);
      stackB.addKeyListener(ij);
      panel.add(stackB);

      helpB = new Button("Help");
      helpB.addActionListener(this);
      helpB.addKeyListener(ij);
      panel.add(helpB);

      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(0, 0, 0, 0);
      add(panel, c);

      panelMode = new Panel();

      sampleB = new Button("Sample");
      sampleB.addActionListener(this);
      sampleB.addKeyListener(ij);
      panelMode.add(sampleB);

      colourMode = new CheckboxGroup();
      hsb = new Checkbox("HSB");
      hsb.setCheckboxGroup(colourMode);
      hsb.addItemListener(this);
      panelMode.add(hsb);
      hsb.setState(true);
      rgb = new Checkbox("RGB");
      rgb.setCheckboxGroup(colourMode);
      rgb.addItemListener(this);
      panelMode.add(rgb);

      c.gridx = 0;
      c.gridy = y++;
      c.gridwidth = 2;
      c.insets = new Insets(0, 0, 0, 0);
      add(panelMode, c);

      addKeyListener(ij); // ImageJ handles keyboard shortcuts
      pack();
      GUI.center(this);
      setVisible(true);

      ip = setup(imp);
      if (ip == null) {
        imp.unlock();
        IJ.beep();
        IJ.showStatus("RGB image cannot be thresholded");
        return;
      }
      thread.start();
    }
Пример #3
0
    void apply(ImagePlus imp, ImageProcessor ip) {
      // this.setCursor(wait);
      // IJ.showStatus("Bandpassing slice "+previousSlice);
      java.awt.Color col;

      if (invert.getState()) col = Toolbar.getForegroundColor();
      else col = Toolbar.getBackgroundColor();

      ip.setColor(col);

      int fill = ip.BLACK;
      int keep = 0;

      if (bandPassH.getState() && bandPassS.getState() && bandPassB.getState()) { // PPP All pass
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue < minHue) || (hue > maxHue))
              || ((sat < minSat) || (sat > maxSat))
              || ((bri < minBri) || (bri > maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (!bandPassH.getState()
          && !bandPassS.getState()
          && !bandPassB.getState()) { // SSS All stop
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue >= minHue) && (hue <= maxHue))
              || ((sat >= minSat) && (sat <= maxSat))
              || ((bri >= minBri) && (bri <= maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (bandPassH.getState() && bandPassS.getState() && !bandPassB.getState()) { // PPS
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue < minHue) || (hue > maxHue))
              || ((sat < minSat) || (sat > maxSat))
              || ((bri >= minBri) && (bri <= maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (!bandPassH.getState() && !bandPassS.getState() && bandPassB.getState()) { // SSP
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue >= minHue) && (hue <= maxHue))
              || ((sat >= minSat) && (sat <= maxSat))
              || ((bri < minBri) || (bri > maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (bandPassH.getState() && !bandPassS.getState() && !bandPassB.getState()) { // PSS
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue < minHue) || (hue > maxHue))
              || ((sat >= minSat) && (sat <= maxSat))
              || ((bri >= minBri) && (bri <= maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (!bandPassH.getState() && bandPassS.getState() && bandPassB.getState()) { // SPP
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue >= minHue) && (hue <= maxHue))
              || ((sat < minSat) || (sat > maxSat))
              || ((bri < minBri) || (bri > maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (!bandPassH.getState() && bandPassS.getState() && !bandPassB.getState()) { // SPS
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue >= minHue) && (hue <= maxHue))
              || ((sat < minSat) || (sat > maxSat))
              || ((bri >= minBri) && (bri <= maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      } else if (bandPassH.getState() && !bandPassS.getState() && bandPassB.getState()) { // PSP
        for (int j = 0; j < numPixels; j++) {
          int hue = hSource[j] & 0xff;
          int sat = sSource[j] & 0xff;
          int bri = bSource[j] & 0xff;
          if (((hue < minHue) || (hue > maxHue))
              || ((sat >= minSat) && (sat <= maxSat))
              || ((bri < minBri) || (bri > maxBri))) fillMask[j] = fill;
          else fillMask[j] = keep;
        }
      }

      ip.fill(fillMask);

      if (threshold.getState()) {
        ip.invert();
        for (int j = 0; j < numPixels; j++) {
          if (fillMask[j] == fill) fillMask[j] = keep;
          else fillMask[j] = fill;
        }
        ip.fill(fillMask);
        ip.invert();
      }
    }
Пример #4
0
    void sample() {
      byte[] hsSource, ssSource, bsSource;
      // ImageProcessor ip2;
      // ip2 = imp.getProcessor();
      Rectangle myroi = ip.getRoi();
      int swidth = myroi.width;
      int sheight = myroi.height;
      int sy = myroi.y;
      int sx = myroi.x;
      if (swidth == width && sheight == height) {
        IJ.showMessage("Select a rectangular ROI");
        IJ.beep();
        return;
      }

      IJ.run("Select None");

      int snumPixels = swidth * sheight;

      hsSource = new byte[snumPixels];
      ssSource = new byte[snumPixels];
      bsSource = new byte[snumPixels];

      int[] pixs = new int[snumPixels];
      int[] bin = new int[256];

      int counter = 0, pi = 0, rangePassH = 0, rangeStopH = 0, rangePassL = 0, rangeStopL = 0, i, j;

      for (i = sy; i < sy + sheight; i++) {
        for (j = sx; j < sx + swidth; j++) {
          pixs[counter++] = ip.getPixel(j, i);
        }
      }

      // Get hsb or rgb from roi.
      ColorProcessor cp2 = new ColorProcessor(swidth, sheight, pixs);

      int iminhue = 256, imaxhue = -1, iminsat = 256, imaxsat = -1, iminbri = 256, imaxbri = -1;
      int iminred = 256, imaxred = -1, imingre = 256, imaxgre = -1, iminblu = 256, imaxblu = -1;

      if (isRGB) cp2.getRGB(hsSource, ssSource, bsSource);
      else cp2.getHSB(hsSource, ssSource, bsSource);

      for (i = 0; i < snumPixels; i++) {
        bin[hsSource[i] & 255] = 1;
        if ((hsSource[i] & 255) > imaxhue) imaxhue = (hsSource[i] & 255);
        if ((hsSource[i] & 255) < iminhue) iminhue = (hsSource[i] & 255);
        if ((ssSource[i] & 255) > imaxsat) imaxsat = (ssSource[i] & 255);
        if ((ssSource[i] & 255) < iminsat) iminsat = (ssSource[i] & 255);
        if ((bsSource[i] & 255) > imaxbri) imaxbri = (bsSource[i] & 255);
        if ((bsSource[i] & 255) < iminbri) iminbri = (bsSource[i] & 255);
        // IJ.showMessage("h:"+minhue+"H:"+maxhue+"s:"+minsat+"S:"+maxsat+"b:"+minbri+"B:"+maxbri);
      }

      if (!isRGB) { // get pass or stop filter whichever has a narrower range
        for (i = 0; i < 256; i++) {
          if (bin[i] > 0) {
            rangePassL = i;
            break;
          }
        }
        for (i = 255; i >= 0; i--) {
          if (bin[i] > 0) {
            rangePassH = i;
            break;
          }
        }
        for (i = 0; i < 256; i++) {
          if (bin[i] == 0) {
            rangeStopL = i;
            break;
          }
        }
        for (i = 255; i >= 0; i--) {
          if (bin[i] == 0) {
            rangeStopH = i;
            break;
          }
        }
        if ((rangePassH - rangePassL) < (rangeStopH - rangeStopL)) {
          bandPassH.setState(true);
          bandStopH.setState(false);
          iminhue = rangePassL;
          imaxhue = rangePassH;
        } else {
          bandPassH.setState(false);
          bandStopH.setState(true);
          iminhue = rangeStopL;
          imaxhue = rangeStopH;
        }
      } else {
        bandPassH.setState(true);
        bandStopH.setState(false);
      }

      adjustMinHue(iminhue);
      minSlider.setValue(iminhue);
      adjustMaxHue(imaxhue);
      maxSlider.setValue(imaxhue);
      adjustMinSat(iminsat);
      minSlider2.setValue(iminsat);
      adjustMaxSat(imaxsat);
      maxSlider2.setValue(imaxsat);
      adjustMinBri(iminbri);
      minSlider3.setValue(iminbri);
      adjustMaxBri(imaxbri);
      maxSlider3.setValue(imaxbri);
      originalB.setEnabled(true);
      // IJ.showStatus("done");
    }
Пример #5
0
 public void itemStateChanged(ItemEvent e) {
   ImagePlus imp = WindowManager.getCurrentImage();
   if (imp == null) return;
   if (!imp.isComposite()) {
     int channels = imp.getNChannels();
     if (channels == 1 && imp.getStackSize() <= 4) channels = imp.getStackSize();
     if (imp.getBitDepth() == 24 || (channels > 1 && channels < CompositeImage.MAX_CHANNELS)) {
       GenericDialog gd = new GenericDialog(imp.getTitle());
       gd.addMessage("Convert to multi-channel composite image?");
       gd.showDialog();
       if (gd.wasCanceled()) return;
       else IJ.doCommand("Make Composite");
     } else {
       IJ.error(
           "Channels",
           "A composite image is required (e.g., "
               + moreLabel
               + " Open HeLa Cells),\nor create one using "
               + moreLabel
               + " Make Composite.");
       return;
     }
   }
   if (!imp.isComposite()) return;
   CompositeImage ci = (CompositeImage) imp;
   Object source = e.getSource();
   if (source == choice) {
     int index = ((Choice) source).getSelectedIndex();
     switch (index) {
       case 0:
         ci.setMode(IJ.COMPOSITE);
         break;
       case 1:
         ci.setMode(IJ.COLOR);
         break;
       case 2:
         ci.setMode(IJ.GRAYSCALE);
         break;
     }
     ci.updateAndDraw();
     if (Recorder.record) {
       String mode = null;
       switch (index) {
         case 0:
           mode = "composite";
           break;
         case 1:
           mode = "color";
           break;
         case 2:
           mode = "grayscale";
           break;
       }
       Recorder.record("Stack.setDisplayMode", mode);
     }
   } else if (source instanceof Checkbox) {
     for (int i = 0; i < checkbox.length; i++) {
       Checkbox cb = (Checkbox) source;
       if (cb == checkbox[i]) {
         if (ci.getMode() == IJ.COMPOSITE) {
           boolean[] active = ci.getActiveChannels();
           active[i] = cb.getState();
           if (Recorder.record) {
             String str = "";
             for (int c = 0; c < ci.getNChannels(); c++) str += active[c] ? "1" : "0";
             Recorder.record("Stack.setActiveChannels", str);
             Recorder.record("//Stack.toggleChannel", imp.getChannel());
           }
         } else {
           imp.setPosition(i + 1, imp.getSlice(), imp.getFrame());
           if (Recorder.record) Recorder.record("Stack.setChannel", i + 1);
         }
         ci.updateAndDraw();
         return;
       }
     }
   }
 }
Пример #6
0
  /*------------------------------------------------------------------*/
  differentialsDialog(Frame parentWindow, String title, boolean isModal, int operation) {
    super(parentWindow, title, isModal);
    setLayout(new GridLayout(0, 1));

    Checkbox gradientMagnitude = new Checkbox("Gradient Magnitude", choice, false);
    Checkbox gradientDirection = new Checkbox("Gradient Direction", choice, false);
    Checkbox laplacian = new Checkbox("Laplacian", choice, false);
    Checkbox largestHessian = new Checkbox("Largest Hessian", choice, false);
    Checkbox smallestHessian = new Checkbox("Smallest Hessian", choice, false);
    Checkbox hessianOrientation = new Checkbox("Hessian Orientation", choice, false);
    this.operation = operation;
    switch (operation) {
      case Differentials_.GRADIENT_MAGNITUDE:
        choice.setSelectedCheckbox(gradientMagnitude);
        break;
      case Differentials_.GRADIENT_DIRECTION:
        choice.setSelectedCheckbox(gradientDirection);
        break;
      case Differentials_.LAPLACIAN:
        choice.setSelectedCheckbox(laplacian);
        break;
      case Differentials_.LARGEST_HESSIAN:
        choice.setSelectedCheckbox(largestHessian);
        break;
      case Differentials_.SMALLEST_HESSIAN:
        choice.setSelectedCheckbox(smallestHessian);
        break;
      case Differentials_.HESSIAN_ORIENTATION:
        choice.setSelectedCheckbox(hessianOrientation);
        break;
      default:
        cancel = true;
        IJ.error("Unexpected operation ID");
        setVisible(false);
    }

    gradientMagnitude.addItemListener(this);
    gradientDirection.addItemListener(this);
    laplacian.addItemListener(this);
    largestHessian.addItemListener(this);
    smallestHessian.addItemListener(this);
    hessianOrientation.addItemListener(this);

    Label separation1 = new Label("");
    Label separation2 = new Label("");
    Label separation3 = new Label("");
    Label separation4 = new Label("");

    Panel buttonPanel = new Panel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    Button cancelButton = new Button("Cancel");
    Button okButton = new Button("OK");
    cancelButton.addActionListener(this);
    okButton.addActionListener(this);
    buttonPanel.add(cancelButton);
    buttonPanel.add(okButton);

    add(separation1);
    add(gradientMagnitude);
    add(gradientDirection);
    add(separation2);
    add(laplacian);
    add(separation3);
    add(largestHessian);
    add(smallestHessian);
    add(hessianOrientation);
    add(separation4);
    add(buttonPanel);

    pack();
  } /* end differentialsDialog */