Class JImageJ

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class JImageJ extends JPanel implements ActionListener
See Also:
  • Field Details

    • theImage

      protected BufferedImage theImage
    • margin

      protected Insets margin
    • xOrg

      protected int xOrg
    • yOrg

      protected int yOrg
    • snapToGrid

      protected boolean snapToGrid
    • grid

      protected int grid
    • xAxis

      protected JLAxis xAxis
    • xAxisHeight

      protected int xAxisHeight
    • xAxisUpMargin

      protected int xAxisUpMargin
    • yAxis

      protected JLAxis yAxis
    • yAxisWidth

      protected int yAxisWidth
    • yAxisRightMargin

      protected int yAxisRightMargin
    • crossCursor

      protected boolean crossCursor
    • cursorColor

      protected Color cursorColor
    • xCursor

      protected int xCursor
    • yCursor

      protected int yCursor
    • roiColor

      protected Color roiColor
    • roiSelectionColor

      protected Color roiSelectionColor
    • roiInsideColor

      protected Color roiInsideColor
    • roiInsideSelectionColor

      protected Color roiInsideSelectionColor
    • roiOutsideColor

      protected Color roiOutsideColor
    • roiOutsideSelectionColor

      protected Color roiOutsideSelectionColor
    • imp

      protected AdvancedImagePlus imp
    • canvas

      protected JImageJ.RenderedImageCanvas canvas
    • hiddenIJ

      protected ij.ImageJ hiddenIJ
    • canvasRenderer

      protected JImageJ.CanvasRenderer canvasRenderer
    • imagePane

      protected JScrollPane imagePane
    • toolbarPanel

      protected JPanel toolbarPanel
    • buttonGroup

      protected ButtonGroup buttonGroup
    • rectangleButton

      protected JToggleButton rectangleButton
    • ellipseButton

      protected JToggleButton ellipseButton
    • freeHandButton

      protected JToggleButton freeHandButton
    • polygonButton

      protected JToggleButton polygonButton
    • lineButton

      protected JToggleButton lineButton
    • angleButton

      protected JToggleButton angleButton
    • wandButton

      protected JToggleButton wandButton
    • zoomButton

      protected JToggleButton zoomButton
    • handButton

      protected JToggleButton handButton
    • arrowButton

      protected JToggleButton arrowButton
    • clearButton

      protected JButton clearButton
    • deleteButton

      protected JButton deleteButton
    • selectedButton

      protected JToggleButton selectedButton
    • innerButton

      protected JButton innerButton
    • outerButton

      protected JButton outerButton
    • maskButton

      protected JButton maskButton
    • invalidateButton

      protected JButton invalidateButton
    • resetButton

      protected JButton resetButton
    • intersectionButton

      protected JButton intersectionButton
    • unionButton

      protected JButton unionButton
    • substractButton

      protected JButton substractButton
    • xorButton

      protected JButton xorButton
    • undoButton

      protected JButton undoButton
    • redoButton

      protected JButton redoButton
    • rectangleTitle

      protected String rectangleTitle
    • ellipseTitle

      protected String ellipseTitle
    • freeHandTitle

      protected String freeHandTitle
    • polygonTitle

      protected String polygonTitle
    • lineTitle

      protected String lineTitle
    • angleTitle

      protected String angleTitle
    • wandTitle

      protected String wandTitle
    • zoomTitle

      protected String zoomTitle
    • handTitle

      protected String handTitle
    • selectionTitle

      protected String selectionTitle
    • deleteTitle

      protected String deleteTitle
    • deleteUndoRedoTitle

      protected String deleteUndoRedoTitle
    • clearTitle

      protected String clearTitle
    • clearUndoRedoTitle

      protected String clearUndoRedoTitle
    • innerTitle

      protected String innerTitle
    • outerTitle

      protected String outerTitle
    • maskTitle

      protected String maskTitle
    • maskUndoRedoTitle

      protected String maskUndoRedoTitle
    • invalidateTitle

      protected String invalidateTitle
    • resetTitle

      protected String resetTitle
    • resetUndoRedoTitle

      protected String resetUndoRedoTitle
    • intersectionTitle

      protected String intersectionTitle
    • intersectionUndoRedoTitle

      protected String intersectionUndoRedoTitle
    • unionTitle

      protected String unionTitle
    • unionUndoRedoTitle

      protected String unionUndoRedoTitle
    • substractTitle

      protected String substractTitle
    • substractUndoRedoTitle

      protected String substractUndoRedoTitle
    • xorTitle

      protected String xorTitle
    • xorUndoRedoTitle

      protected String xorUndoRedoTitle
    • undoTitle

      protected String undoTitle
    • redoTitle

      protected String redoTitle
    • undoManager

      protected UndoManager undoManager
    • undoLimit

      protected static final int undoLimit
      See Also:
    • ignoreROITitle

      protected String ignoreROITitle
    • ignoreROIMessage

      protected String ignoreROIMessage
    • ignoreROIContinueMessage

      protected String ignoreROIContinueMessage
    • deleteAllROIsTitle

      protected String deleteAllROIsTitle
    • deleteAllROIsMessage

      protected String deleteAllROIsMessage
    • NO_MARGIN

      protected static final Insets NO_MARGIN
  • Constructor Details

    • JImageJ

      public JImageJ()
  • Method Details

    • initCanvasRenderer

      protected void initCanvasRenderer()
    • initToolbar

      protected void initToolbar()
    • updateUndoRedoButtons

      protected void updateUndoRedoButtons()
    • initMessages

      protected void initMessages()
    • setMargin

      public void setMargin(Insets i)
      Sets the margin of the JImage
      Parameters:
      i - Image margin
    • getMargin

      public Insets getMargin()
      Returns margin of the image
      Returns:
      Image margin
    • getImagePlus

      public AdvancedImagePlus getImagePlus()
    • measureAxis

      protected void measureAxis()
    • paintAxis

      protected void paintAxis(Graphics g)
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • getToolbar

      public ij.gui.Toolbar getToolbar()
    • setImage

      public void setImage(BufferedImage i)
      Stes the image to be displayed
      Parameters:
      i - Image
    • refreshImage

      public void refreshImage()
    • setZoom

      public void setZoom(double zoom)
    • setZoomRoi

      public void setZoomRoi(ij.gui.Roi zoomRoi)
    • setSelectionRoi

      public void setSelectionRoi(ij.gui.Roi selectionRoi)
    • getZoom

      public double getZoom()
    • getXAxis

      public JLAxis getXAxis()
      Returns:
      a handle of the X axis.
    • getYAxis

      public JLAxis getYAxis()
      Returns:
      a handle of the Y axis.
    • getImage

      public BufferedImage getImage()
      Returns a handle to the image displayed
      Returns:
      Image handle
    • getImageSize

      public Dimension getImageSize()
      Returns size of the image (does not include margin)
      Returns:
      Image size
    • getXOrigin

      public int getXOrigin()
      Return origin of the image within the component
      Returns:
      X origin in pixel
    • getYOrigin

      public int getYOrigin()
      Return origin of the image within the component
      Returns:
      Y origin in pixel
    • getSelectionPoint

      public Point[] getSelectionPoint()
      Returns the current line selected.
      Returns:
      null when no selection or a 2 points array
    • getCurrentRoiBounds

      public Rectangle getCurrentRoiBounds()
      Returns the current ROI bounds.
      Returns:
      null when no ROI or its bounds
    • deleteAllROIs

      public void deleteAllROIs()
      Clears the current selection.
    • deleteSelectedRois

      public void deleteSelectedRois()
    • setSelectedRoisAsInner

      public void setSelectedRoisAsInner()
    • setSelectedRoisAsOuter

      public void setSelectedRoisAsOuter()
    • applyMask

      public void applyMask()
    • resetMask

      public void resetMask()
    • invalidateROI

      public void invalidateROI()
    • setSelection

      public void setSelection(int _x1, int _y1, int _x2, int _y2)
      Sets the current selection.
      Parameters:
      _x1 - Top left corner x coordinate
      _y1 - Top left corner y coordinate
      _x2 - Bottom right corner x coordinate
      _y2 - Bottom right corner y coordinate
    • transformX

      public int transformX(int x)
    • transformY

      public int transformY(int y)
    • canCombineROIs

      protected boolean canCombineROIs()
      Checks out whether it is possible to combine ROIs
      Returns:
      true if it is possible, false otherwise.
    • intersectROIs

      public void intersectROIs()
    • unifyROIs

      public void unifyROIs()
    • substractROIs

      public void substractROIs()
    • xorROIs

      public void xorROIs()
    • undo

      public void undo()
    • redo

      public void redo()
    • getRoiColor

      public Color getRoiColor()
    • setRoiColor

      public void setRoiColor(Color selectionColor)
    • getRoiSelectionColor

      public Color getRoiSelectionColor()
      Returns:
      the roiSelectionColor
    • setRoiSelectionColor

      public void setRoiSelectionColor(Color roiSelectionColor)
      Parameters:
      roiSelectionColor - the roiSelectionColor to set
    • getRoiInsideColor

      public Color getRoiInsideColor()
      Returns:
      the roiInsideColor
    • setRoiInsideColor

      public void setRoiInsideColor(Color roiInsideColor)
      Parameters:
      roiInsideColor - the roiInsideColor to set
    • getRoiInsideSelectionColor

      public Color getRoiInsideSelectionColor()
      Returns:
      the roiInsideSelectionColor
    • setRoiInsideSelectionColor

      public void setRoiInsideSelectionColor(Color roiInsideSelectionColor)
      Parameters:
      roiInsideSelectionColor - the roiInsideSelectionColor to set
    • getRoiOutsideColor

      public Color getRoiOutsideColor()
      Returns:
      the roiOutsideColor
    • setRoiOutsideColor

      public void setRoiOutsideColor(Color roiOutsideColor)
      Parameters:
      roiOutsideColor - the roiOutsideColor to set
    • getRoiOutsideSelectionColor

      public Color getRoiOutsideSelectionColor()
      Returns:
      the roiOutsideSelectionColor
    • setRoiOutsideSelectionColor

      public void setRoiOutsideSelectionColor(Color roiOutsideSelectionColor)
      Parameters:
      roiOutsideSelectionColor - the roiOutsideSelectionColor to set
    • getImageRenderer

      public JComponent getImageRenderer()
      Returns:
      the image renderer
    • getImagePane

      public JScrollPane getImagePane()
      Returns:
      the imagePane
    • getIgnoreROITitle

      public String getIgnoreROITitle()
      Returns:
      the ignoreValidatedROITitle
    • setIgnoreROITitle

      public void setIgnoreROITitle(String ignoreROITitle)
      Parameters:
      ignoreROITitle - the ignoreROITitle to set
    • setIgnoreValidatedROITitle

      public void setIgnoreValidatedROITitle(String ignoreValidatedROITitle)
      Parameters:
      ignoreValidatedROITitle - the ignoreValidatedROITitle to set
    • getIgnoreROIMessage

      public String getIgnoreROIMessage()
      Returns:
      the ignoreValidatedROIMessage
    • setIgnoreValidatedROIMessage

      public void setIgnoreValidatedROIMessage(String ignoreValidatedROIMessage)
      Parameters:
      ignoreValidatedROIMessage - the ignoreValidatedROIMessage to set
    • getIgnoreROIContinueMessage

      public String getIgnoreROIContinueMessage()
      Returns:
      the ignoreValidatedROIContinueMessage
    • setIgnoreValidatedROIContinueMessage

      public void setIgnoreValidatedROIContinueMessage(String ignoreValidatedROIContinueMessage)
      Parameters:
      ignoreValidatedROIContinueMessage - the ignoreValidatedROIContinueMessage to set
    • getDeleteAllROIsTitle

      public String getDeleteAllROIsTitle()
      Returns:
      the deleteAllROIsTitle
    • setDeleteAllROIsTitle

      public void setDeleteAllROIsTitle(String deleteAllROIsTitle)
      Parameters:
      deleteAllROIsTitle - the deleteAllROIsTitle to set
    • getDeleteAllROIsMessage

      public String getDeleteAllROIsMessage()
      Returns:
      the deleteAllROIsMessage
    • setDeleteAllROIsMessage

      public void setDeleteAllROIsMessage(String deleteAllROIsMessage)
      Parameters:
      deleteAllROIsMessage - the deleteAllROIsMessage to set
    • getToolbarPanel

      public JPanel getToolbarPanel()
      Returns:
      the toolbarPanel
    • getRectangleButton

      public JToggleButton getRectangleButton()
      Returns:
      the rectangleButton
    • getEllipseButton

      public JToggleButton getEllipseButton()
      Returns:
      the ellipseButton
    • getFreeHandButton

      public JToggleButton getFreeHandButton()
      Returns:
      the freeHandButton
    • getPolygonButton

      public JToggleButton getPolygonButton()
      Returns:
      the polygonButton
    • getLineButton

      public JToggleButton getLineButton()
      Returns:
      the lineButton
    • getAngleButton

      public JToggleButton getAngleButton()
      Returns:
      the angleButton
    • getWandButton

      public JToggleButton getWandButton()
      Returns:
      the wandButton
    • getZoomButton

      public JToggleButton getZoomButton()
      Returns:
      the zoomButton
    • getArrowButton

      public JToggleButton getArrowButton()
      Returns:
      the arrowButton
    • getClearButton

      public JButton getClearButton()
      Returns:
      the clearButton
    • getDeleteButton

      public JButton getDeleteButton()
      Returns:
      the deleteButton
    • getSelectedButton

      public JToggleButton getSelectedButton()
      Returns:
      the selectedButton
    • getInnerButton

      public JButton getInnerButton()
      Returns:
      the innerButton
    • getOuterButton

      public JButton getOuterButton()
      Returns:
      the outerButton
    • getMaskButton

      public JButton getMaskButton()
      Returns:
      the maskButton
    • getInvalidateButton

      public JButton getInvalidateButton()
      Returns:
      the invalidateButton
    • getResetButton

      public JButton getResetButton()
      Returns:
      the resetButton
    • getIntersectionButton

      public JButton getIntersectionButton()
      Returns:
      the intersectionButton
    • getUnionButton

      public JButton getUnionButton()
      Returns:
      the unionButton
    • getSubstractButton

      public JButton getSubstractButton()
      Returns:
      the substractButton
    • getXorButton

      public JButton getXorButton()
      Returns:
      the xorButton
    • getRectangleTitle

      public String getRectangleTitle()
      Returns:
      the rectangleTitle
    • setRectangleTitle

      public void setRectangleTitle(String rectangleTitle)
      Parameters:
      rectangleTitle - the rectangleTitle to set
    • getEllipseTitle

      public String getEllipseTitle()
      Returns:
      the ellipseTitle
    • setEllipseTitle

      public void setEllipseTitle(String ellipseTitle)
      Parameters:
      ellipseTitle - the ellipseTitle to set
    • getFreeHandTitle

      public String getFreeHandTitle()
      Returns:
      the freeHandTitle
    • setFreeHandTitle

      public void setFreeHandTitle(String freeHandTitle)
      Parameters:
      freeHandTitle - the freeHandTitle to set
    • getPolygonTitle

      public String getPolygonTitle()
      Returns:
      the polygonTitle
    • setPolygonTitle

      public void setPolygonTitle(String polygonTitle)
      Parameters:
      polygonTitle - the polygonTitle to set
    • getLineTitle

      public String getLineTitle()
      Returns:
      the lineTitle
    • setLineTitle

      public void setLineTitle(String lineTitle)
      Parameters:
      lineTitle - the lineTitle to set
    • getAngleTitle

      public String getAngleTitle()
      Returns:
      the angleTitle
    • setAngleTitle

      public void setAngleTitle(String angleTitle)
      Parameters:
      angleTitle - the angleTitle to set
    • getWandTitle

      public String getWandTitle()
      Returns:
      the wandTitle
    • setWandTitle

      public void setWandTitle(String wandTitle)
      Parameters:
      wandTitle - the wandTitle to set
    • getZoomTitle

      public String getZoomTitle()
      Returns:
      the zoomTitle
    • setZoomTitle

      public void setZoomTitle(String zoomTitle)
      Parameters:
      zoomTitle - the zoomTitle to set
    • getSelectionTitle

      public String getSelectionTitle()
      Returns:
      the selectionTitle
    • setSelectionTitle

      public void setSelectionTitle(String selectionTitle)
      Parameters:
      selectionTitle - the selectionTitle to set
    • getDeleteTitle

      public String getDeleteTitle()
      Returns:
      the deleteTitle
    • setDeleteTitle

      public void setDeleteTitle(String deleteTitle)
      Parameters:
      deleteTitle - the deleteTitle to set
    • getDeleteUndoRedoTitle

      public String getDeleteUndoRedoTitle()
      Returns:
      the deleteUndoRedoTitle
    • setDeleteUndoRedoTitle

      public void setDeleteUndoRedoTitle(String deleteUndoRedoTitle)
      Parameters:
      deleteUndoRedoTitle - the deleteUndoRedoTitle to set
    • getClearTitle

      public String getClearTitle()
      Returns:
      the clearTitle
    • setClearTitle

      public void setClearTitle(String clearTitle)
      Parameters:
      clearTitle - the clearTitle to set
    • getClearUndoRedoTitle

      public String getClearUndoRedoTitle()
      Returns:
      the clearUndoRedoTitle
    • setClearUndoRedoTitle

      public void setClearUndoRedoTitle(String clearUndoRedoTitle)
      Parameters:
      clearUndoRedoTitle - the clearUndoRedoTitle to set
    • getInnerTitle

      public String getInnerTitle()
      Returns:
      the innerTitle
    • setInnerTitle

      public void setInnerTitle(String innerTitle)
      Parameters:
      innerTitle - the innerTitle to set
    • getOuterTitle

      public String getOuterTitle()
      Returns:
      the outerTitle
    • setOuterTitle

      public void setOuterTitle(String outerTitle)
      Parameters:
      outerTitle - the outerTitle to set
    • getMaskTitle

      public String getMaskTitle()
      Returns:
      the maskTitle
    • setMaskTitle

      public void setMaskTitle(String maskTitle)
      Parameters:
      maskTitle - the maskTitle to set
    • getMaskUndoRedoTitle

      public String getMaskUndoRedoTitle()
      Returns:
      the maskUndoRedoTitle
    • setMaskUndoRedoTitle

      public void setMaskUndoRedoTitle(String maskUndoRedoTitle)
      Parameters:
      maskUndoRedoTitle - the maskUndoRedoTitle to set
    • getInvalidateTitle

      public String getInvalidateTitle()
      Returns:
      the invalidateTitle
    • setInvalidateTitle

      public void setInvalidateTitle(String invalidateTitle)
      Parameters:
      invalidateTitle - the invalidateTitle to set
    • getResetTitle

      public String getResetTitle()
      Returns:
      the resetTitle
    • setResetTitle

      public void setResetTitle(String resetTitle)
      Parameters:
      resetTitle - the resetTitle to set
    • getResetUndoRedoTitle

      public String getResetUndoRedoTitle()
      Returns:
      the resetUndoRedoTitle
    • setResetUndoRedoTitle

      public void setResetUndoRedoTitle(String resetUndoRedoTitle)
      Parameters:
      resetUndoRedoTitle - the resetUndoRedoTitle to set
    • getIntersectionTitle

      public String getIntersectionTitle()
      Returns:
      the intersectionTitle
    • setIntersectionTitle

      public void setIntersectionTitle(String intersectionTitle)
      Parameters:
      intersectionTitle - the intersectionTitle to set
    • getIntersectionUndoRedoTitle

      public String getIntersectionUndoRedoTitle()
      Returns:
      the intersectionUndoRedoTitle
    • setIntersectionUndoRedoTitle

      public void setIntersectionUndoRedoTitle(String intersectionUndoRedoTitle)
      Parameters:
      intersectionUndoRedoTitle - the intersectionUndoRedoTitle to set
    • getUnionTitle

      public String getUnionTitle()
      Returns:
      the unionTitle
    • setUnionTitle

      public void setUnionTitle(String unionTitle)
      Parameters:
      unionTitle - the unionTitle to set
    • getUnionUndoRedoTitle

      public String getUnionUndoRedoTitle()
      Returns:
      the unionUndoRedoTitle
    • setUnionUndoRedoTitle

      public void setUnionUndoRedoTitle(String unionUndoRedoTitle)
      Parameters:
      unionUndoRedoTitle - the unionUndoRedoTitle to set
    • getSubstractTitle

      public String getSubstractTitle()
      Returns:
      the substractTitle
    • setSubstractTitle

      public void setSubstractTitle(String substractTitle)
      Parameters:
      substractTitle - the substractTitle to set
    • getSubstractUndoRedoTitle

      public String getSubstractUndoRedoTitle()
      Returns:
      the substractUndoRedoTitle
    • setSubstractUndoRedoTitle

      public void setSubstractUndoRedoTitle(String substractUndoRedoTitle)
      Parameters:
      substractUndoRedoTitle - the substractUndoRedoTitle to set
    • getXorTitle

      public String getXorTitle()
      Returns:
      the xorTitle
    • setXorTitle

      public void setXorTitle(String xorTitle)
      Parameters:
      xorTitle - the xorTitle to set
    • getXorUndoRedoTitle

      public String getXorUndoRedoTitle()
      Returns:
      the xorUndoRedoTitle
    • setXorUndoRedoTitle

      public void setXorUndoRedoTitle(String xorUndoRedoTitle)
      Parameters:
      xorUndoRedoTitle - the xorUndoRedoTitle to set
    • getUndoTitle

      public String getUndoTitle()
      Returns:
      the undoTitle
    • setUndoTitle

      public void setUndoTitle(String undoTitle)
      Parameters:
      undoTitle - the undoTitle to set
    • getRedoTitle

      public String getRedoTitle()
      Returns:
      the redoTitle
    • setRedoTitle

      public void setRedoTitle(String redoTitle)
      Parameters:
      redoTitle - the redoTitle to set
    • scrollTo

      protected void scrollTo(int x, int y)
    • zoomIn

      public void zoomIn()
    • zoomOut

      public void zoomOut()