Package sc.fiji.snt

Class SNTPrefs

java.lang.Object
sc.fiji.snt.SNTPrefs

public class SNTPrefs extends Object
Class handling SNT preferences.
Author:
Tiago Ferreira
  • Field Details

  • Constructor Details

    • SNTPrefs

      public SNTPrefs(SNT snt)
      Constructs a new SNTPrefs instance for the specified SNT instance.
      Parameters:
      snt - the SNT instance to manage preferences for
  • Method Details

    • get3DViewerResamplingFactor

      protected int get3DViewerResamplingFactor()
    • set3DViewerResamplingFactor

      protected void set3DViewerResamplingFactor(int factor)
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
      Gets a boolean preference value.
      Parameters:
      key - the preference key
      defaultValue - the default value if the key is not found
      Returns:
      the boolean preference value
    • get

      public String get(String key, String defaultValue)
      Gets a string preference value.
      Parameters:
      key - the preference key
      defaultValue - the default value if the key is not found
      Returns:
      the string preference value
    • set

      public void set(String key, String value)
      Sets a string preference value.
      Parameters:
      key - the preference key
      value - the value to set
    • set

      public void set(String key, boolean defaultValue)
      Sets a boolean preference value.
      Parameters:
      key - the preference key
      defaultValue - the value to set
    • getTemp

      public boolean getTemp(String key, boolean defaultValue)
      Gets a temporary boolean preference value that will be cleared at session end.
      Parameters:
      key - the preference key
      defaultValue - the default value if the key is not found
      Returns:
      the boolean preference value
    • setTemp

      public void setTemp(String key, boolean value)
      Sets a temporary boolean preference value that will be cleared at session end.
      Parameters:
      key - the preference key
      value - the value to set
    • getTemp

      public String getTemp(String key, String defaultValue)
      Gets a temporary string preference value that will be cleared at session end.
      Parameters:
      key - the preference key
      defaultValue - the default value if the key is not found
      Returns:
      the string preference value
    • setTemp

      public void setTemp(String key, String value)
      Sets a temporary string preference value that will be cleared at session end.
      Parameters:
      key - the preference key
      value - the value to set
    • getAutosaveFile

      public File getAutosaveFile()
    • setAutosaveFile

      public void setAutosaveFile(File file)
    • loadPluginPrefs

      protected void loadPluginPrefs()
    • loadStartupPrefs

      @Deprecated protected void loadStartupPrefs()
      Deprecated.
    • saveStartupPrefs

      @Deprecated protected void saveStartupPrefs()
      Deprecated.
    • savePluginPrefs

      protected void savePluginPrefs(boolean restoreIJ1prefs)
    • is2DDisplayCanvas

      public boolean is2DDisplayCanvas()
      Checks if 2D display canvas is forced.
      Returns:
      true if 2D display canvas is forced, false otherwise
    • set2DDisplayCanvas

      public void set2DDisplayCanvas(boolean bool)
      Sets whether to force 2D display canvas.
      Parameters:
      bool - true to force 2D display canvas, false otherwise
    • isSaveCompressedTraces

      public boolean isSaveCompressedTraces()
      Checks if traces should be saved in compressed format.
      Returns:
      true if compressed traces are enabled, false otherwise
    • setSaveCompressedTraces

      public void setSaveCompressedTraces(boolean bool)
      Sets whether to save traces in compressed format.
      Parameters:
      bool - true to enable compressed traces, false otherwise
    • isSomaDisplayTriangle

      public boolean isSomaDisplayTriangle()
      Sets whether single-node paths tagged as are rendered w/ triangular shape.
      Returns:
      true if triangular shape is enable, false otherwise
    • setSomaDisplayTriangle

      public void setSomaDisplayTriangle(boolean bool)
      Sets whether single-node paths tagged as soma should render w/ triangular shape.
      Parameters:
      bool - true to enable triangular shape, false for default representation
    • isSaveWinLocations

      public boolean isSaveWinLocations()
      Checks if window locations should be saved and restored.
      Returns:
      true if window locations are saved, false otherwise
    • setSaveWinLocations

      public void setSaveWinLocations(boolean value)
      Sets whether window locations should be saved and restored.
      Parameters:
      value - true to save window locations, false otherwise
    • setFirstRunAfterUpdate

      protected static void setFirstRunAfterUpdate(boolean b)
    • firstRunAfterUpdate

      public static boolean firstRunAfterUpdate()
      Checks if this is the first run after an SNT update.
      Returns:
      true if this is the first run after an update, false otherwise
    • setThreads

      public static void setThreads(int n)
      Sets the number of threads to use for multi-threaded operations.
      Parameters:
      n - the number of threads (if less than 1, uses available processors)
    • getLookAndFeel

      public static String getLookAndFeel()
      Gets the current look and feel preference.
      Returns:
      the look and feel class name
    • setLookAndFeel

      public static void setLookAndFeel(String laf)
      Sets the look and feel preference.
      Parameters:
      laf - the look and feel class name
    • getThreads

      public static int getThreads()
      Gets the current number of threads setting.
      Returns:
      the number of threads
    • getPathWindowLocation

      protected Point getPathWindowLocation()
    • getFillWindowLocation

      protected Point getFillWindowLocation()
    • resetOptions

      protected void resetOptions()
    • clearAll

      public static void clearAll()
    • getDefaultLookAndFeel

      public static String getDefaultLookAndFeel()
    • setRecentDir

      public void setRecentDir(File file)
    • getRecentDir

      public File getRecentDir()
    • getWorkspaceDir

      public File getWorkspaceDir()
    • setWorkspaceDir

      public void setWorkspaceDir(File dir)
    • getBackupDir

      public File getBackupDir()
      Returns the backup directory, or null if workspace doesn't exist. Does NOT create directories.
    • ensureWorkspaceExists

      public boolean ensureWorkspaceExists()
      Creates workspace directory if it doesn't exist.
      Returns:
      true if directory exists or was created successfully
    • workspaceIsValid

      public boolean workspaceIsValid()
      Returns:
      true if workspace directory exists and has write permissions.
    • getSessionsDir

      public File getSessionsDir()
      Returns the sessions directory, or null if workspace doesn't exist. Does NOT create directories.
    • lastKnownDir

      public static File lastKnownDir()
    • setLastKnownDir

      public static void setLastKnownDir(File file)
    • getNextImgExtensions

      public List<String> getNextImgExtensions()
      Returns the list of filename suffixes used to identify images when navigating to the next/previous image in a folder (see SNTUI). Matching is case-insensitive and applied to the end of the filename (i.e., endsWith). Suffixes may include a leading dot (e.g., ".tif") or a partial filename suffix (e.g., "_max.tif").
      Returns:
      a non-null, non-empty list of suffixes; defaults to [".tif", ".tiff"] if no preference has been set
    • setNextImgExtensions

      public void setNextImgExtensions(List<String> extensions)
      Sets the list of filename suffixes used to identify images when navigating to the next/previous image in a folder. Null, blank, and empty entries are silently ignored. If the resulting cleaned list is empty or null is passed, the preference is cleared and the default ([".tif", ".tiff"]) will be used on the next call to getNextImgExtensions().
      Parameters:
      extensions - the list of suffixes to store (e.g., [".tif", ".png"]); may be null to reset to defaults
      See Also:
    • setNextImgExtensions

      public void setNextImgExtensions(String csvString)
      Convenience method for setting filename suffixes from a comma-separated string. Whitespace around entries is trimmed and blank entries are ignored. Delegates to setNextImgExtensions(List).
      Parameters:
      csvString - a comma-separated string of filename suffixes (e.g., ".tif, .tiff, .png"); may be null or empty to reset to defaults
      See Also: