Class IJExtension

java.lang.Object
qupath.imagej.gui.IJExtension
All Implemented Interfaces:
QuPathExtension

public class IJExtension extends Object implements QuPathExtension
QuPath extension & associated static helper methods used to support integration of ImageJ with QuPath.
Author:
Pete Bankhead
  • Property Details

  • Constructor Details

    • IJExtension

      public IJExtension()
  • Method Details

    • setImageJPath

      public static void setImageJPath(String path)
      Set the path for a local ImageJ installation, if required. This can be used to help load external ImageJ plugins.
      Parameters:
      path -
    • getImageJPath

      public static String getImageJPath()
      Get the path for a local ImageJ installation, if set.
      Returns:
    • imageJPathProperty

      public static StringProperty imageJPathProperty()
      Property representing the path to a local ImageJ installation, or null if no path has been set.
      Returns:
      See Also:
    • getImageJInstance

      public static ImageJ getImageJInstance()
      Get an instance of ImageJ, or start one, for interactive use (with GUI displayed).
      Returns:
      an ImageJ instance, or null if ImageJ could not be started
    • extractROI

      public static PathImage<ImagePlus> extractROI(ImageServer<BufferedImage> server, ROI pathROI, RegionRequest request, boolean setROI) throws IOException
      Extract a region of interest from an image as an ImageJ ImagePlus.
      Parameters:
      server - the image
      pathROI -
      request -
      setROI - true if a ROI should be converted to the closest matching ImageJ Roi & set on the image, false otherwise
      Returns:
      an ImagePlus wrapped in a PathImage to give additional calibration information
      Throws:
      IOException
    • extractROI

      public static PathImage<ImagePlus> extractROI(ImageServer<BufferedImage> server, PathObject pathObject, RegionRequest request, boolean setROI) throws IOException
      Similar to extractROI(ImageServer, ROI, RegionRequest, boolean), except that the title of the ImagePlus is set according to the parent object type (which is used to get the ROI). Specifically, if a TMA core is passed as a parent, then the core name will be included in the title.
      Parameters:
      server -
      pathObject -
      request -
      setROI -
      Returns:
      Throws:
      IOException
      See Also:
    • extractROIWithOverlay

      public static PathImage<ImagePlus> extractROIWithOverlay(ImageServer<BufferedImage> server, PathObject pathObject, PathObjectHierarchy hierarchy, RegionRequest request, boolean setROI, OverlayOptions options) throws IOException
      Extract an image region as an ImagePlus, optionally setting ImageJ Rois corresponding to QuPath objects.
      Parameters:
      server - server from which pixels should be requested
      pathObject - the primary object, which may have its ROI set on the image
      hierarchy - object hierarchy containing objects whose ROIs should be added to the ImagePlus overlay
      request - the region being requested
      setROI - if true, the ROI of the pathObject will be set on the image as the 'main' ROI (i.e. not an overlay)
      options - options determining which kinds of objects will have ROIs added, to match with the display in the QuPath viewer
      Returns:
      Throws:
      IOException
    • extractOverlay

      public static Overlay extractOverlay(PathObjectHierarchy hierarchy, RegionRequest request, OverlayOptions options, Predicate<PathObject> filter)
      Extract an ImageJ overlay for the specified region.
      Parameters:
      hierarchy -
      request -
      options - options to control which objects are being displayed
      filter - optional additional filter used to determine which objects will be included (may be used in combination with options)
      Returns:
    • getImageJIcon

      public static Image getImageJIcon(int width, int height)
      Try to read the ImageJ icon from its jar.
      Parameters:
      width -
      height -
      Returns:
    • installExtension

      public void installExtension(QuPathGUI qupath)
      Description copied from interface: QuPathExtension
      Install the extension for a QuPathGUI instance.

      This generally involves adding new commands to appropriate menus.

      Note that if an extension is only expected to be compatible with a specific QuPath version, this method provides an opportunity to test version compatibility before making any changes.

      Specified by:
      installExtension in interface QuPathExtension
      Parameters:
      qupath -
      See Also:
    • getName

      public String getName()
      Description copied from interface: QuPathExtension
      A readable name for the extension.
      Specified by:
      getName in interface QuPathExtension
      Returns:
    • getDescription

      public String getDescription()
      Description copied from interface: QuPathExtension
      A short description of the extension for displaying in the main GUI.

      This could also contain licensing information.

      Specified by:
      getDescription in interface QuPathExtension
      Returns:
    • getQuPathVersion

      public Version getQuPathVersion()
      Returns the version stored within this jar, because it is matched to the QuPath version.
      Specified by:
      getQuPathVersion in interface QuPathExtension
      Returns:
      a semantic version corresponding to a QuPath version, e.g. "0.3.0".
      See Also: