Package qupath.lib.projects
Interface ProjectImageEntry<T>
- Type Parameters:
T
- Depends upon the project used; typically BufferedImage for QuPath
- All Superinterfaces:
UriResource
Class to represent an image entry within a project.
This stores the path to the image, and some optional metadata.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Remove all metadata.boolean
containsMetadata
(String key) Check if a metadata value is present for a specified key.Get a description; this is free text describing the image.Get a path to the data for this image entry, or null if this entry is not stored on the local file system.getID()
Get a unique ID to represent this entry.Get a name that may be used for this entry.Access additional images associated with the project entry, e.g.Get an unmodifiable collection of the metadata map's keys.Get an unmodifiable view of the underlying metadata map.default String
Get a formatted string representation of the metadata map's contents.getMetadataValue
(String key) Request a metadata value.Get the original image name, without any randomization.Get aImageServerBuilder.ServerBuilder
that can be used to open this image.default Collection
<URI> Deprecated.Get a summary string representing this image entry.Request a thumbnail for the image.boolean
Check if this entry has savedImageData
already available.putMetadataValue
(String key, String value) Store a metadata value.Read thePathObjectHierarchy
for this entry, or return an empty hierarchy if none is available.Read theImageData
associated with this entry, or create a new ImageData if none is currently present.Remove a metadata value.void
saveImageData
(ImageData<T> imageData) Save theImageData
for this entry using the default storage location for the project.void
setDescription
(String description) Set the description.void
setImageName
(String name) Set the image name for this project entry.void
setThumbnail
(T img) Set a thumbnail for the image.default boolean
updateServerURIs
(Map<URI, URI> replacements) Deprecated.use insteadUriResource.updateURIs(Map)
Methods inherited from interface qupath.lib.io.UriResource
getUris, getURIs, updateUris, updateURIs
-
Method Details
-
getID
String getID()Get a unique ID to represent this entry.- Returns:
-
setImageName
Set the image name for this project entry.- Parameters:
name
-
-
getImageName
String getImageName()Get a name that may be used for this entry.This may be derived automatically from the server path, or set explicitly to be something else. It may also be randomized to support blinded analysis.
- Returns:
- See Also:
-
getOriginalImageName
String getOriginalImageName()Get the original image name, without any randomization. Most UI elements should prefergetImageName()
to ensure that the randomization does its job.- Returns:
-
getEntryPath
Path getEntryPath()Get a path to the data for this image entry, or null if this entry is not stored on the local file system.If not null, the path may be a file or a directory and is not guaranteed to exist. Rather, it represents where the data for this entry either is or would be stored.
- Returns:
-
removeMetadataValue
Remove a metadata value.- Parameters:
key
-- Returns:
-
getMetadataValue
Request a metadata value.Note that this may return
null
.- Parameters:
key
-- Returns:
-
putMetadataValue
Store a metadata value.This is intended as storage of short key-value pairs. Extended text should be stored under
setDescription
.- Parameters:
key
-value
-- Returns:
-
containsMetadata
Check if a metadata value is present for a specified key.- Parameters:
key
-- Returns:
true
ifgetDescription()
does not return null or an empty string,false
otherwise.
-
getDescription
String getDescription()Get a description; this is free text describing the image.- Returns:
-
setDescription
Set the description.- Parameters:
description
-- See Also:
-
clearMetadata
void clearMetadata()Remove all metadata. -
getMetadataMap
Get an unmodifiable view of the underlying metadata map.- Returns:
-
getMetadataKeys
Collection<String> getMetadataKeys()Get an unmodifiable collection of the metadata map's keys.- Returns:
-
getServerBuilder
ImageServerBuilder.ServerBuilder<T> getServerBuilder()Get aImageServerBuilder.ServerBuilder
that can be used to open this image.- Returns:
-
readImageData
Read theImageData
associated with this entry, or create a new ImageData if none is currently present.If the full data is not needed, but rather only the objects
readHierarchy()
can be much faster.- Returns:
- Throws:
IOException
- See Also:
-
saveImageData
Save theImageData
for this entry using the default storage location for the project.- Parameters:
imageData
-- Throws:
IOException
-
readHierarchy
Read thePathObjectHierarchy
for this entry, or return an empty hierarchy if none is available.- Returns:
- Throws:
IOException
- See Also:
-
hasImageData
boolean hasImageData()Check if this entry has savedImageData
already available.- Returns:
-
getSummary
String getSummary()Get a summary string representing this image entry.- Returns:
-
getThumbnail
Request a thumbnail for the image.- Returns:
- a thumbnail if one has already been set, otherwise null.
- Throws:
IOException
-
setThumbnail
Set a thumbnail for the image. This will replace any existing thumbnail.- Parameters:
img
-- Throws:
IOException
-
getServerURIs
Deprecated.use insteadUriResource.getURIs()
Get a collection of the URIs required by this project's ImageServer.The purpose of this is to help query if they can be found. They might not be e.g. if the images have been moved.
- Returns:
- Throws:
IOException
-
updateServerURIs
Deprecated.use insteadUriResource.updateURIs(Map)
Update the URIs for the server (optional operation).- Parameters:
replacements
- a map with current URIs as keys, and desired URIs as values.- Returns:
- true if changes were made
- Throws:
IOException
-
getMetadataSummaryString
Get a formatted string representation of the metadata map's contents.- Returns:
-
getImages
ResourceManager.Manager<ImageServer<T>> getImages()Access additional images associated with the project entry, e.g. pixel classifications or aligned slides.- Returns:
-
UriResource.getURIs()