Package qupath.imagej.gui
Class IJExtension
java.lang.Object
qupath.imagej.gui.IJExtension
- All Implemented Interfaces:
QuPathExtension
QuPath extension & associated static helper methods used to support integration of ImageJ with QuPath.
- Author:
- Pete Bankhead
-
Property Summary
TypePropertyDescriptionstatic StringProperty
Property representing the path to a local ImageJ installation, or null if no path has been set. -
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Commands to install with the ImageJ extension. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Overlay
extractOverlay
(PathObjectHierarchy hierarchy, RegionRequest request, OverlayOptions options, Predicate<PathObject> filter) Extract an ImageJ overlay for the specified region.extractROI
(ImageServer<BufferedImage> server, PathObject pathObject, RegionRequest request, boolean setROI) Similar toextractROI(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).extractROI
(ImageServer<BufferedImage> server, ROI pathROI, RegionRequest request, boolean setROI) Extract a region of interest from an image as an ImageJ ImagePlus.extractROIWithOverlay
(ImageServer<BufferedImage> server, PathObject pathObject, PathObjectHierarchy hierarchy, RegionRequest request, boolean setROI, OverlayOptions options) Extract an image region as an ImagePlus, optionally setting ImageJ Rois corresponding to QuPath objects.A short description of the extension for displaying in the main GUI.static Image
getImageJIcon
(int width, int height) Try to read the ImageJ icon from its jar.static ImageJ
Get an instance of ImageJ, or start one, for interactive use (with GUI displayed).static String
Get the path for a local ImageJ installation, if set.getName()
A readable name for the extension.Returns the version stored within this jar, because it is matched to the QuPath version.static StringProperty
Property representing the path to a local ImageJ installation, or null if no path has been set.void
installExtension
(QuPathGUI qupath) Install the extension for a QuPathGUI instance.static void
setImageJPath
(String path) Set the path for a local ImageJ installation, if required.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface qupath.lib.gui.extensions.QuPathExtension
getVersion
-
Property Details
-
imageJPath
Property representing the path to a local ImageJ installation, or null if no path has been set.- See Also:
-
-
Constructor Details
-
IJExtension
public IJExtension()
-
-
Method Details
-
setImageJPath
Set the path for a local ImageJ installation, if required. This can be used to help load external ImageJ plugins.- Parameters:
path
-
-
getImageJPath
Get the path for a local ImageJ installation, if set.- Returns:
-
imageJPathProperty
Property representing the path to a local ImageJ installation, or null if no path has been set.- Returns:
- See Also:
-
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 imagepathROI
-request
-setROI
- true if a ROI should be converted to the closest matching ImageJRoi
& set on the image, false otherwise- Returns:
- an
ImagePlus
wrapped in aPathImage
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 toextractROI(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 requestedpathObject
- the primary object, which may have its ROI set on the imagehierarchy
- object hierarchy containing objects whose ROIs should be added to the ImagePlus overlayrequest
- the region being requestedsetROI
- 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 displayedfilter
- optional additional filter used to determine which objects will be included (may be used in combination with options)- Returns:
-
getImageJIcon
Try to read the ImageJ icon from its jar.- Parameters:
width
-height
-- Returns:
-
installExtension
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 interfaceQuPathExtension
- Parameters:
qupath
-- See Also:
-
getName
Description copied from interface:QuPathExtension
A readable name for the extension.- Specified by:
getName
in interfaceQuPathExtension
- Returns:
-
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 interfaceQuPathExtension
- Returns:
-
getQuPathVersion
Returns the version stored within this jar, because it is matched to the QuPath version.- Specified by:
getQuPathVersion
in interfaceQuPathExtension
- Returns:
- a semantic version corresponding to a QuPath version, e.g. "0.3.0".
- See Also:
-