Class ProjectCommands

java.lang.Object
qupath.lib.gui.commands.ProjectCommands

public class ProjectCommands extends Object
Helper class implementing simple 'single-method' commands related to projects.
Author:
Pete Bankhead
  • Constructor Details

    • ProjectCommands

      public ProjectCommands()
  • Method Details

    • promptToCheckURIs

      public static boolean promptToCheckURIs(Project<?> project, boolean onlyIfMissing) throws IOException
      Check the URIs within a project, prompting the user to correct any broken links if required.
      Parameters:
      project - the project containing URIs to check
      onlyIfMissing - if true, only display a prompt if some links are broken
      Returns:
      true if the dialog was shown and closed successfully, false if it was cancelled
      Throws:
      IOException
    • promptToImportImages

      public static List<ProjectImageEntry<BufferedImage>> promptToImportImages(QuPathGUI qupath, String... defaultPaths)
      Show prompt for the user to select images to import into the current project in QuPath, choosing a suitable ImageServerBuilder.
      Parameters:
      qupath - the QuPath instance
      defaultPaths - image paths to include when the dialog is shown (useful when the dialog is shown with some paths already known)
      Returns:
      a list of project entries for all images that were successfully added to the project
    • promptToImportImages

      public static List<ProjectImageEntry<BufferedImage>> promptToImportImages(QuPathGUI qupath, ImageServerBuilder<BufferedImage> builder, String... defaultPaths)
      Show prompt for the user to select images to import into the current project in QuPath.
      Parameters:
      qupath - the QuPath instance
      builder - if not null, this will be used to create the servers. If null, a combobox will be shown to choose an installed builder.
      defaultPaths - image paths to include when the dialog is shown (useful when the dialog is shown with some paths already known)
      Returns:
      a list of project entries for all images that were successfully added to the project
    • addSingleImageToProject

      public static ProjectImageEntry<BufferedImage> addSingleImageToProject(Project<BufferedImage> project, ImageServer<BufferedImage> server, ImageData.ImageType type)
      Add a single image to a project.
      Parameters:
      project - the project
      server - the image to add
      type - optional image type, if known
      Returns:
      an entry corresponding to the image that was added
    • getThumbnailRGB

      public static BufferedImage getThumbnailRGB(ImageServer<BufferedImage> server) throws IOException
      Get an RGB thumbnail for an image server, suitable for showing as a project thumbnail.
      Parameters:
      server -
      Returns:
      an RGB thumbnail for server
      Throws:
      IOException
    • showProjectMetadataEditor

      public static void showProjectMetadataEditor(Project<?> project)
      Show the metadata editor for the specified project.
      Parameters:
      project -
    • promptToExportImageList

      public static void promptToExportImageList(Project<?> project)
      Prompt to export a text file containing a list of image paths for a project.
      Parameters:
      project -
    • promptToImportLegacyProject

      public static boolean promptToImportLegacyProject(QuPathGUI qupath)
      Prompt the user to select a legacy project file, and then import the images into the current project.

      In this case 'legacy' means QuPath v0.1.2 or earlier. Such projects contain a "data" subdirectory, containing data files in the form "name.qpdata".

      Note that the paths to the images need to be correct, because it is necessary to open each image during import.

      Parameters:
      qupath - the current instance of QuPath
      Returns:
      true if changes were made to the current project, false otherwise