Package qupath.lib.projects
Interface Project<T>
- Type Parameters:
T
-
public interface Project<T>
Data structure to manage images and associated data in QuPath.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionaddDuplicate
(ProjectImageEntry<T> entry, boolean copyData) Add an image by duplicating an existing entry.addImage
(ImageServerBuilder.ServerBuilder<T> server) Add an image for a particular ImageServer.createSubProject
(String name, Collection<ProjectImageEntry<T>> entries) Create a sub-project that provides a view on the specified entries.long
Request a timestamp from when the project was created.Request aProjectImageEntry
associated with anImageData
Get a list of image entries for the project.boolean
Query whether 'true' or masked image names are being returned.long
Request a timestamp from when the project was last synchronized.getName()
Get the name of the project.static String
getNameFromURI
(URI uri) Extract a usable project name from a URI.default ResourceManager.Manager
<ObjectClassifier<T>> Get a manager for object classifiers saved within this project.getPath()
Get a path to this project, or null if this project is not on a local file system.Get an unmodifiable list representing thePathClass
es associated with this project.default ResourceManager.Manager
<PixelClassifier> Get a manager for pixel classifiers saved within this project.Sometimes projects move (unfortunately).default <S,
R extends S>
ResourceManager.Manager<R> getResources
(String location, Class<S> cls, String ext) Get a manager for objects of a specified class within this project.default ResourceManager.Manager
<String> Get a manager for scripts saved within this project.getURI()
Get a URI that can be used when saving/reloading this project.The version string for this project, which can be used to distinguish new and older project (which may contain different information).boolean
isEmpty()
Test if the project contains any images.void
removeAllImages
(Collection<ProjectImageEntry<T>> entries, boolean removeAllData) Remove multiple images from the project, optionally including associated data.void
removeImage
(ProjectImageEntry<?> entry, boolean removeAllData) Remove an image from the project, optionally including associated data.void
setMaskImageNames
(boolean maskNames) Request that entries return masked image names, rather than the 'true' image names.boolean
setPathClasses
(Collection<? extends PathClass> pathClasses) Update the available PathClasses.void
Save the project.
-
Method Details
-
getPathClasses
Get an unmodifiable list representing thePathClass
es associated with this project.- Returns:
-
getMaskImageNames
boolean getMaskImageNames()Query whether 'true' or masked image names are being returned.- Returns:
- See Also:
-
setMaskImageNames
void setMaskImageNames(boolean maskNames) Request that entries return masked image names, rather than the 'true' image names.The purpose of this is to support studies where the user ought not to see the image names during analysis, reducing the potential for user bias.
- Parameters:
maskNames
-- See Also:
-
setPathClasses
Update the available PathClasses.- Parameters:
pathClasses
-- Returns:
true
if the stored values changed, false otherwise.
-
getURI
URI getURI()Get a URI that can be used when saving/reloading this project.- Returns:
-
getPreviousURI
URI getPreviousURI()Sometimes projects move (unfortunately). This returns the previous URI, if known - which can be helpful for resolving relative paths to images in the event that both project and images have moved together.- Returns:
-
getNameFromURI
Extract a usable project name from a URI.- Parameters:
uri
-- Returns:
-
getVersion
String getVersion()The version string for this project, which can be used to distinguish new and older project (which may contain different information).This may be null if the version information is not stored.
- Returns:
-
getPath
Path getPath()Get a path to this project, or null if this project is not on a local file system.If not null, the path may be a file or a directory.
- Returns:
- See Also:
-
createSubProject
Create a sub-project that provides a view on the specified entries.The retains exactly the same references and data, i.e. it does not duplicate entries or data files - rather it is used to generate projects that provide access to a subset of the entries in the original project.
- Parameters:
name
- the name of the sub-projectentries
- the entries to retain within the sub-project- Returns:
-
isEmpty
boolean isEmpty()Test if the project contains any images.- Returns:
-
addImage
Add an image for a particular ImageServer.- Parameters:
server
-- Returns:
- Throws:
IOException
-
addDuplicate
Add an image by duplicating an existing entry. This retains the sameImageServerBuilder.ServerBuilder
, name, description and metadata, but assigns a new unique ID.- Parameters:
entry
- the entry that should be copiedcopyData
- if true, copy existing image data in addition to other properties- Returns:
- the new entry that has been added to the project
- Throws:
IOException
-
getEntry
Request aProjectImageEntry
associated with anImageData
- Parameters:
imageData
-- Returns:
-
removeImage
Remove an image from the project, optionally including associated data.- Parameters:
entry
-removeAllData
-
-
removeAllImages
Remove multiple images from the project, optionally including associated data.- Parameters:
entries
-removeAllData
-
-
syncChanges
Save the project.- Throws:
IOException
-
getImageList
List<ProjectImageEntry<T>> getImageList()Get a list of image entries for the project.- Returns:
-
getName
String getName()Get the name of the project.- Returns:
-
getCreationTimestamp
long getCreationTimestamp()Request a timestamp from when the project was created.- Returns:
-
getModificationTimestamp
long getModificationTimestamp()Request a timestamp from when the project was last synchronized.- Returns:
- See Also:
-
getScripts
Get a manager for scripts saved within this project.- Returns:
- See Also:
-
getObjectClassifiers
Get a manager for object classifiers saved within this project.- Returns:
- See Also:
-
getPixelClassifiers
Get a manager for pixel classifiers saved within this project.- Returns:
- See Also:
-
getResources
default <S,R extends S> ResourceManager.Manager<R> getResources(String location, Class<S> cls, String ext) Get a manager for objects of a specified class within this project.- Type Parameters:
S
-- Parameters:
location
- a location relative to the project where the resources should be stored, e.g. "classifiers/pixel classifiers". Projects may use this location in an implementation-dependent way.cls
- class of the resource to returnext
- extension to use with the resource. This is used for determining the type. Usually it should be "json".- Returns:
- a
ResourceManager.Manager
for the specified resource, ornull
if the project does not support the resource or extension.
-