Package qupath.lib.gui.commands
Class ProjectCommands
java.lang.Object
qupath.lib.gui.commands.ProjectCommands
Helper class implementing simple 'single-method' commands related to projects.
- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProjectImageEntry
<BufferedImage> addSingleImageToProject
(Project<BufferedImage> project, ImageServer<BufferedImage> server, ImageData.ImageType type) Add a single image to a project.static BufferedImage
getThumbnailRGB
(ImageServer<BufferedImage> server) Get an RGB thumbnail for an image server, suitable for showing as a project thumbnail.static boolean
promptToCheckURIs
(Project<?> project, boolean onlyIfMissing) Check the URIs within a project, prompting the user to correct any broken links if required.static void
promptToExportImageList
(Project<?> project) Prompt to export a text file containing a list of image paths for a project.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 suitableImageServerBuilder
.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.static boolean
promptToImportLegacyProject
(QuPathGUI qupath) Prompt the user to select a legacy project file, and then import the images into the current project.static void
showProjectMetadataEditor
(Project<?> project) Show the metadata editor for the specified project.
-
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 checkonlyIfMissing
- 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 suitableImageServerBuilder
.- Parameters:
qupath
- the QuPath instancedefaultPaths
- 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 instancebuilder
- 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 projectserver
- the image to addtype
- optional image type, if known- Returns:
- an entry corresponding to the image that was added
-
getThumbnailRGB
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
Show the metadata editor for the specified project.- Parameters:
project
-
-
promptToExportImageList
Prompt to export a text file containing a list of image paths for a project.- Parameters:
project
-
-
promptToImportLegacyProject
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
-