Class SimpleImageViewer

java.lang.Object
qupath.lib.gui.panes.SimpleImageViewer

public class SimpleImageViewer extends Object
A simple viewer for a single image, with options to save or copy.

This is primarily intended for RGB images, but can also be used for other types after applying automatic brightness/contrast settings.

This stores (and can be updated with) a BufferedImage or a JavaFX Image, because both serve different purposes can be useful in different contexts.

Since:
v0.5.0
  • Property Details

  • Constructor Details

    • SimpleImageViewer

      public SimpleImageViewer()
      Create a new simple image viewer. The stage will be created, but not shown.
  • Method Details

    • getPlaceholderText

      public String getPlaceholderText()
      Get the placeholder text to show if no image is available.
      Returns:
    • setPlaceholderText

      public void setPlaceholderText(String placeholder)
      Set the placeholder text to show if no image is available.
      Parameters:
      placeholder -
    • placeholderTextProperty

      public StringProperty placeholderTextProperty()
      Get the placeholder text to show if no image is available.
      Returns:
      See Also:
    • saturationPercentProperty

      public DoubleProperty saturationPercentProperty()
      Get the percentage of any non-8-bit image that should be saturated when applying auto contrast settings.
      Returns:
      See Also:
    • getSaturationPercent

      public double getSaturationPercent()
      Get the percentage of pixels to use when applying auto contrast settings to a non-8-bit image.
      Returns:
    • setSaturationPercent

      public void setSaturationPercent(double percent)
      Set the percentage of pixels to use when applying auto contrast settings to a non-8-bit image.
      Parameters:
      percent -
    • expandToWindowProperty

      public BooleanProperty expandToWindowProperty()
      Get the property indicating whether the image should grow to fill the window (while maintaining its aspect ratio). If false, the image will grow no larger than its preferred width and height.
      Returns:
      See Also:
    • getExpandToWindow

      public boolean getExpandToWindow()
      Query whether the image is allowed to expand beyond its preferred width and height to fill the window. If false, the image will grow no larger than its preferred width and height.
      Returns:
    • setExpandToWindow

      public void setExpandToWindow(boolean limit)
      Control whether the image should be allowed to expand beyond its preferred width and height to fill the window. If false, the image will grow no larger than its preferred width and height.
      Parameters:
      limit -
    • getStage

      public Stage getStage()
      Get the stage used to display the image.
      Returns:
    • updateImage

      public void updateImage(String name, Image image)
      Update the image using a JavaFX image.
      Parameters:
      name -
      image -
    • resetImage

      public void resetImage()
      Remove the image.
    • updateImage

      public void updateImage(String name, BufferedImage img)
      Update the image using a buffered image.
      Parameters:
      name -
      img -
    • imageNameProperty

      public ReadOnlyObjectProperty<String> imageNameProperty()
      Get a read-only property indicating the name of the image.
      Returns:
    • getName

      public String getName()
      Get the name of the image.
      Returns:
    • imageProperty

      public ReadOnlyObjectProperty<Image> imageProperty()
      Get a read-only property representing the JavaFX image.
      Returns:
      See Also:
    • getImage

      public Image getImage()
      Get the JavaFX image.
      Returns:
    • bufferedImageProperty

      public ReadOnlyObjectProperty<BufferedImage> bufferedImageProperty()
      Get a read-only property representing the buffered image.
      Returns:
      See Also:
    • getBufferedImage

      public BufferedImage getBufferedImage()
      Get the buffered image.
      Returns: