Class PathPrefs

java.lang.Object
qupath.lib.gui.prefs.PathPrefs

public class PathPrefs extends Object
Central storage of QuPath preferences.

Most of these are 'persistent', and stored in a platform-dependent way using Java's Preferences API.

Author:
Pete Bankhead
  • Property Details

  • Constructor Details

    • PathPrefs

      public PathPrefs()
  • Method Details

    • useSystemMenubarProperty

      @Deprecated public static BooleanProperty useSystemMenubarProperty()
      Deprecated.
      Legacy property used to specify whether the system menubar should be used for the main QuPath stage. This should be bound bidirectionally to the corresponding property of any menubars created.
      Returns:
      a bound boolean property, which is true whenever systemMenubarProperty() is set to ALL_WINDOWS.
    • exportPreferences

      public static void exportPreferences(OutputStream stream) throws IOException, BackingStoreException
      Export preferences to a stream. Note that this will only export preferences that have been set explicitly; some preferences may be 'missing' because their defaults were never changed. This behavior may change in the future.
      Parameters:
      stream -
      Throws:
      IOException
      BackingStoreException
      See Also:
    • importPreferences

      public static void importPreferences(InputStream stream) throws IOException, InvalidPreferencesFormatException
      Import preferences from a stream.

      Note that if the plan is to re-import preferences previously exported by exportPreferences(OutputStream) then it may be worthwhile to resetPreferences() first to handle the fact that preferences may not have been saved because their default values were unchanged.

      Parameters:
      stream -
      Throws:
      IOException
      InvalidPreferencesFormatException
      See Also:
    • numCommandThreadsProperty

      public static IntegerProperty numCommandThreadsProperty()
      Property specifying the preferred number of threads QuPath should use for multithreaded commands.
      Returns:
    • showImageNameInTitleProperty

      public static BooleanProperty showImageNameInTitleProperty()
      Property specifying if QuPath should show the image title in the main window title. For privacy reasons it may be desirable to turn this off in some cases.
      Returns:
    • autoUpdateCheckProperty

      public static ObjectProperty<PathPrefs.AutoUpdateType> autoUpdateCheckProperty()
      Check for updates when launching QuPath, if possible.
      Returns:
    • maskImageNamesProperty

      public static BooleanProperty maskImageNamesProperty()
      Request that image names are hidden within the user interface.
      Returns:
    • defaultLocaleProperty

      public static ObjectProperty<Locale> defaultLocaleProperty()
      Get a property for setting the default Locale. Setting this locale impacts both Locale.Category.FORMAT and Locale.Category.DISPLAY, and may trigger an update to defaultLocaleDisplayProperty() and defaultLocaleFormatProperty() if these have been changed.
      Returns:
      an object property to control the locale
      Since:
      v0.4.0
    • defaultLocaleFormatProperty

      public static ObjectProperty<Locale> defaultLocaleFormatProperty()
      Get a property for setting the default Locale for Locale.Category.FORMAT. Setting this property also results in the Locale being changed to match.
      Returns:
      an object property to control the display locale
    • defaultLocaleDisplayProperty

      public static ObjectProperty<Locale> defaultLocaleDisplayProperty()
      Get a property for setting the default Locale for Locale.Category.DISPLAY. Setting this property also results in the Locale being changed to match.
      Returns:
      an object property to control the display locale
    • showStartupMessageProperty

      public static BooleanProperty showStartupMessageProperty()
      Show a startup message when QuPath is launched.
      Returns:
    • startupScriptProperty

      public static StringProperty startupScriptProperty()
      Path to a startup script that should be run immediately after QuPath's launch.
      Returns:
    • showToolBarBadgesProperty

      public static BooleanProperty showToolBarBadgesProperty()
      Show badges on the toolbar, e.g. to provide messages or warnings.
      Returns:
    • hasJavaPreferences

      public static boolean hasJavaPreferences()
      Attempt to load user JVM defaults - may fail if packager.jar (and any required native library) isn't found.
      Returns:
    • getConfigPath

      public static Path getConfigPath() throws IOException, URISyntaxException
      Try to get the path to the config file. Editing this is sometimes needed for preferences that need to be fixed during starting, such as the java.library.path or max memory settings.
      Returns:
      Throws:
      IOException
      URISyntaxException
    • maxMemoryMBProperty

      public static IntegerProperty maxMemoryMBProperty()
      Get property representing the maximum memory for the Java Virtual Machine, applied after restarting the application.

      Setting this will attempt to set -Xmx by writing to a .cfg file in the home launch directory.

      If successful, -Xmx will be set to the value that is specified or 512M, whichever is larger.

      Returns:
    • getUserPreferences

      @Deprecated public static Preferences getUserPreferences()
      Deprecated.
      since v0.5.0 - avoid direct use of the Preferences object, since this may be invalidated by a call to resetPreferences()
      Get the Preferences object for storing user preferences.

      Note that the preferences object returned by this method must not be retained and reused, because it may be invalidated by a call to resetPreferences(). Rather, as far as possible other methods of this class should be used rather than accessing the Preferences directly.

      Returns:
    • savePreferences

      public static boolean savePreferences()
      Save the preferences.
      Returns:
    • resetPreferences

      public static void resetPreferences()
      Reset the preferences to their defaults. This requires QuPath to be restarted.
    • scrollSpeedProperty

      public static IntegerProperty scrollSpeedProperty()
      Percentage to scale scroll speed for zooming etc. Helps customize the viewer according to more/less enthusiastic input devices.
      Returns:
    • getScaledScrollSpeed

      public static double getScaledScrollSpeed()
      Get scroll speed scaled as a proportion and forced to be in the range 0-1. For example, 100% becomes 1.
      Returns:
    • getScaledNavigationSpeed

      public static double getScaledNavigationSpeed()
      Get navigation speed scaled as a proportion and forced to be in the range 0-1. For example, 100% becomes 1.
      Returns:
      speed
    • getNavigationAccelerationProperty

      public static boolean getNavigationAccelerationProperty()
      Get whether to apply the navigation acceleration (& deceleration) effects or not.
      Returns:
    • skipMissingCoresProperty

      public static BooleanProperty skipMissingCoresProperty()
      Skip ('jump over') missing cores when navigating through TMA grids.
      Returns:
      skipMissingCoresProperty
    • getSkipMissingCoresProperty

      public static boolean getSkipMissingCoresProperty()
      Return whether the viewer skips missing TMA cores when navigating TMA grids with arrow keys.
      Returns:
    • getShowAllRGBTransforms

      public static boolean getShowAllRGBTransforms()
      Request that all available color transforms are shown for RGB images.
      Returns:
    • scriptsPathProperty

      public static StringProperty scriptsPathProperty()
      Path to a directory containing scripts for quick-access through the user interface.
      Returns:
    • useTileBrushProperty

      public static BooleanProperty useTileBrushProperty()
      Request that the brush tool automatically uses any available tiles, rather than creating 'circles' as normal.
      Returns:
    • selectionModeProperty

      public static BooleanProperty selectionModeProperty()
      Convert drawing tools to select objects, rather than creating new objects.
      Returns:
    • clipROIsForHierarchyProperty

      public static BooleanProperty clipROIsForHierarchyProperty()
      Request ROIs to be clipped and inserted as the right place in the hierarchy when drawing (to prevent overlapping ROIs being created accidentally).
      Returns:
    • showExperimentalOptionsProperty

      public static BooleanProperty showExperimentalOptionsProperty()
      Flag to indicate that menu items marked 'experimental' should be shown to the user.
      Returns:
    • showTMAOptionsProperty

      public static BooleanProperty showTMAOptionsProperty()
      Flag to indicate that the TMA menu should be shown to the user - only relevant when working with Tissue Microarrays.
      Returns:
    • showLegacyOptionsProperty

      public static BooleanProperty showLegacyOptionsProperty()
      Flag to indicate that the legacy options should be shown to the user - normally not desirable.
      Returns:
    • doCreateLogFilesProperty

      public static BooleanProperty doCreateLogFilesProperty()
      Request a log file to be generated. Requires the userPathProperty() to be set to a directory.
      Returns:
    • userPathProperty

      public static ObjectProperty<String> userPathProperty()
      A path where additional files may be stored, such as extensions and log files.
      Returns:
    • getRecentProjectList

      public static ObservableList<URI> getRecentProjectList()
      Get a list of the most recent projects that were opened.
      Returns:
    • maxUndoLevelsProperty

      public static IntegerProperty maxUndoLevelsProperty()
      The requested maximum number of undo levels that QuPath should support.
      Returns:
    • maxUndoHierarchySizeProperty

      public static IntegerProperty maxUndoHierarchySizeProperty()
      The requested maximum number of objects in a hierarchy for which QuPath should support undo/redo. This is to workaround an inconvenient implementation issue, whereby trying to support undo with huge datasets could be a significant performance issue.
      Returns:
    • getRecentScriptsList

      public static ObservableList<URI> getRecentScriptsList()
      Get a list of the most recent scripts that were opened.
      Returns:
    • invertScrollingProperty

      public static BooleanProperty invertScrollingProperty()
      Invert the scrolling direction of the mouse applied to the viewer. This can be helpful when the scrolling direction feels unnatural... perhaps because of how the 'natural' system preference is set.
      Returns:
    • invertZSliderProperty

      public static BooleanProperty invertZSliderProperty()
      Invert the z-slider for the viewer. This can help if the location of the zero position seems counterintuitive.
      Returns:
    • gridStartXProperty

      public static DoubleProperty gridStartXProperty()
      Starting x coordinate for any counting grid (usually 0). This depends upon gridScaleMicronsProperty().
      Returns:
    • gridStartYProperty

      public static DoubleProperty gridStartYProperty()
      Starting y coordinate for any counting grid (usually 0). This depends upon gridScaleMicronsProperty().
      Returns:
    • gridSpacingXProperty

      public static DoubleProperty gridSpacingXProperty()
      Horizontal spacing between lines for any counting grid. This depends upon gridScaleMicronsProperty().
      Returns:
    • gridSpacingYProperty

      public static DoubleProperty gridSpacingYProperty()
      Vertical spacing between lines for any counting grid. This depends upon gridScaleMicronsProperty().
      Returns:
    • gridScaleMicronsProperty

      public static BooleanProperty gridScaleMicronsProperty()
      Define counting grid optionally displayed on any viewer using microns rather than pixel coordinates.
      Returns:
    • autoBrightnessContrastSaturationPercentProperty

      public static DoubleProperty autoBrightnessContrastSaturationPercentProperty()
      Controls percentage of saturated pixels to apply when automatically setting brightness/contrast.

      A value of 1 indicates that approximately 1% dark pixels and 1% bright pixels should be saturated.

      Returns:
    • keepDisplaySettingsProperty

      public static BooleanProperty keepDisplaySettingsProperty()
      Retain display settings (channel colors, brightness/contrast) when opening new images that have the same properties (channels, channel names, bit-depths).
      Returns:
    • doubleClickToZoomProperty

      public static BooleanProperty doubleClickToZoomProperty()
      Request that double-clicking the viewer can be used to zoom in.
      Returns:
    • imageTypeSettingProperty

      public static ObjectProperty<PathPrefs.ImageTypeSetting> imageTypeSettingProperty()
      Specify how setting the image type should be handled for images when they are opened for the first time.
      Returns:
    • paintSelectedBoundsProperty

      public static BooleanProperty paintSelectedBoundsProperty()
      Specify whether the bounding box of selected objects should be painted. This offers an alternative to showing selected objects based on color.
      Returns:
    • tableDelimiterProperty

      public static StringProperty tableDelimiterProperty()
      Delimiter to use when exporting tables. Default is "\t". Commas should be used with caution because of potential localization trouble.
      Returns:
    • showMeasurementTableThumbnailsProperty

      public static BooleanProperty showMeasurementTableThumbnailsProperty()
      Specify whether measurement tables should show thumbnail images by default or not.
      Returns:
    • showMeasurementTableObjectIDsProperty

      public static BooleanProperty showMeasurementTableObjectIDsProperty()
      Specify whether measurement tables should show object IDs by default or not.
      Returns:
    • enableFreehandToolsProperty

      public static BooleanProperty enableFreehandToolsProperty()
      Enable polygon/polyline tools to support 'freehand' mode; this means that if the ROI is started by dragging, then it will end by lifting the mouse (rather than requiring a double-click).
      Returns:
    • getSerializationExtension

      public static String getSerializationExtension()
      File extension used for serialization of ImageData (without the dot)
      Returns:
    • useZoomGesturesProperty

      public static BooleanProperty useZoomGesturesProperty()
      Support zoom gestures for touchscreens and trackpads.
      Returns:
    • useRotateGesturesProperty

      public static BooleanProperty useRotateGesturesProperty()
      Support rotate gestures for touchscreens and trackpads.
      Returns:
    • useScrollGesturesProperty

      public static BooleanProperty useScrollGesturesProperty()
      Support scroll gestures for touchscreens and trackpads.
      Returns:
    • brushCreateNewObjectsProperty

      public static BooleanProperty brushCreateNewObjectsProperty()
      Create new objects by default when drawing with the Brush tool. The alternative is to append (discontinuous) regions to existing annotations.
      Returns:
    • brushScaleByMagProperty

      public static BooleanProperty brushScaleByMagProperty()
      Optionally scale the default brush tool diameter by the viewer magnification (downsample value).
      Returns:
    • brushDiameterProperty

      public static IntegerProperty brushDiameterProperty()
      Default brush tool diameter, in pixels.
      Returns:
    • returnToMoveModeProperty

      public static BooleanProperty returnToMoveModeProperty()
      Request that the GUI returns to using the PAN tool after a ROI is drawn. This helps keep errant clicking under control, but not permitting new ROIs to be made without explicitly activating a ROI too
      Returns:
    • tileCachePercentageProperty

      public static DoubleProperty tileCachePercentageProperty()
      Requested percentage of available memory to use for tile caching.
      Returns:
    • useCalibratedLocationStringProperty

      public static BooleanProperty useCalibratedLocationStringProperty()
      Show the cursor location on a viewer in calibrated units, rather than pixels.
      Returns:
    • useSelectedColorProperty

      public static BooleanProperty useSelectedColorProperty()
      Use a specified color for highlighting selected objects in the viewer.
      Returns:
    • showPointHullsProperty

      public static BooleanProperty showPointHullsProperty()
      Show the convex hull for point annotations within the viewer.
      Returns:
    • multipointToolProperty

      public static BooleanProperty multipointToolProperty()
      Create multiple points within the same annotation when using the counting tool. The alternative is to create a new annotation for each new point.
      Returns:
    • tmaExportDownsampleProperty

      public static DoubleProperty tmaExportDownsampleProperty()
      Default downsample factor to use when exporting TMA cores.
      Returns:
    • viewerGammaProperty

      public static DoubleProperty viewerGammaProperty()
      Requested gamma value applied to the image in each viewer (for display only).
      Returns:
    • viewerBackgroundColorProperty

      public static IntegerProperty viewerBackgroundColorProperty()
      Color to paint behind any image.
      Returns:
    • colorDefaultObjectsProperty

      public static IntegerProperty colorDefaultObjectsProperty()
      The default color used to display objects of any type, where a default has not otherwise been specified.
      Returns:
    • colorSelectedObjectProperty

      public static IntegerProperty colorSelectedObjectProperty()
      The default color used to display selected objects.
      Returns:
    • colorTMAProperty

      public static IntegerProperty colorTMAProperty()
      The default color used to display TMA core objects.
      Returns:
    • colorTMAMissingProperty

      public static IntegerProperty colorTMAMissingProperty()
      The default color used to display missing TMA core objects.
      Returns:
    • colorTileProperty

      public static IntegerProperty colorTileProperty()
      The default color used to display tile objects.
      Returns:
    • autoSetAnnotationClassProperty

      public static ObjectProperty<PathClass> autoSetAnnotationClassProperty()
      Classification that should automatically be applied to all new annotations. May be null.
      Returns:
    • alwaysPaintSelectedObjectsProperty

      public static BooleanProperty alwaysPaintSelectedObjectsProperty()
      Always paint selected objects in the viewer, even if the opacity setting is 0.
      Returns:
    • viewerInterpolateBilinearProperty

      public static BooleanProperty viewerInterpolateBilinearProperty()
      Request that images are displayed in viewers using bilinear interpolation.
      Returns:
    • detectionTreeDisplayModeProperty

      public static ObjectProperty<PathPrefs.DetectionTreeDisplayModes> detectionTreeDisplayModeProperty()
      Define how detections should be displayed in lists and tree views.

      Showing all detections can be a bad idea, since there may be serious performance issues (especially when selecting/deselecting objects on an expanded tree).

      Returns:
    • maxObjectsToClipboardProperty

      public static IntegerProperty maxObjectsToClipboardProperty()
      The maximum number of objects that can be copied to the system clipboard. This is to avoid accidentally putting very large amounts of data on the clipboard (causing the app to slow down or freeze), or attempting to create strings that are too long.
      Returns:
    • scalebarFontSizeProperty

      public static ObjectProperty<PathPrefs.FontSize> scalebarFontSizeProperty()
      Preferred font size for the scalebar in the viewer.
      Returns:
    • locationFontSizeProperty

      public static ObjectProperty<PathPrefs.FontSize> locationFontSizeProperty()
      Preferred font size for the location text in the viewer.
      Returns:
    • scalebarFontWeightProperty

      public static ObjectProperty<FontWeight> scalebarFontWeightProperty()
      Preferred font weight in the viewer.
      Returns:
    • scalebarLineWidthProperty

      public static DoubleProperty scalebarLineWidthProperty()
      Preferred line width for the scalebar.
      Returns:
    • allredMinPercentagePositiveProperty

      public static DoubleProperty allredMinPercentagePositiveProperty()
      The minimum positive percentage of cells for Allred proportion score to be non-zero. Using the strict definition, this would be 0... however for image analysis this can be very non-robust, in that it allows a single false detection to have a very high influence on the score.
      Returns:
    • minPyramidDimensionProperty

      public static IntegerProperty minPyramidDimensionProperty()
      Minimum image width or height before pyramidalizing (if required).
      Returns:
    • pointRadiusProperty

      public static IntegerProperty pointRadiusProperty()
      Radius of the circle used to draw individual points in a point annotation (in pixels).
      Returns:
    • createPersistentPreference

      public static BooleanProperty createPersistentPreference(String name, boolean defaultValue)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      Returns:
    • createPersistentPreference

      public static IntegerProperty createPersistentPreference(String name, int defaultValue)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      Returns:
    • createPersistentPreference

      public static DoubleProperty createPersistentPreference(String name, double defaultValue)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      Returns:
    • createPersistentPreference

      public static LongProperty createPersistentPreference(String name, long defaultValue)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      Returns:
    • createPersistentPreference

      public static StringProperty createPersistentPreference(String name, String defaultValue)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      Returns:
    • createPersistentPreference

      public static <T extends Enum<T>> ObjectProperty<T> createPersistentPreference(String name, T defaultValue, Class<T> enumType)
      Create a persistent property, which is one that will be saved to/reloaded from the user preferences.
      Parameters:
      name -
      defaultValue -
      enumType -
      Returns:
    • createPersistentPreference

      public static <T> ObjectProperty<T> createPersistentPreference(String name, T defaultValue, Function<T,String> serializer, Function<String,T> deserializer)
      Create a persistent property representing any object serializable as a String, which will be saved to/reloaded from the user preferences. Note that it is important that the serialization is short, i.e. fewer than Preferences.MAX_VALUE_LENGTH characters.
      Parameters:
      name -
      defaultValue -
      serializer - function to generate a string representation of the object
      deserializer - function to get an object from a string representation
      Returns:
      Since:
      v0.4.0
    • detectionStrokeThicknessProperty

      public static DoubleProperty detectionStrokeThicknessProperty()
      Preferred stroke thickness to use when drawing detections ROIs. This is defined in pixels at the full image resolution, and does not adapt to viewer magnification.
      Returns:
    • annotationStrokeThicknessProperty

      public static DoubleProperty annotationStrokeThicknessProperty()
      Preferred stroke thickness to use when drawing annotation ROIs. This is defined in pixels, scaled according to the current viewer magnification.
      Returns:
    • usePixelSnappingProperty

      public static BooleanProperty usePixelSnappingProperty()
      If true, pixels should be snapped to integer coordinates when using the drawing tools.
      Returns:
    • getDefaultQuPathUserDirectory

      public static Path getDefaultQuPathUserDirectory()
      Get the default location for extensions. This is platform and user-specific. It isn't necessarily used (and doesn't necessarily exist).
      Returns: