Interface Project<T>

Type Parameters:
T -

public interface Project<T>
Data structure to manage images and associated data in QuPath.
Author:
Pete Bankhead
  • Method Details

    • getPathClasses

      List<PathClass> getPathClasses()
      Get an unmodifiable list representing the PathClasses 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

      boolean setPathClasses(Collection<? extends PathClass> pathClasses)
      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

      static String getNameFromURI(URI uri)
      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

      Project<T> createSubProject(String name, Collection<ProjectImageEntry<T>> entries)
      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-project
      entries - 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

      ProjectImageEntry<T> addDuplicate(ProjectImageEntry<T> entry, boolean copyData) throws IOException
      Add an image by duplicating an existing entry. This retains the same ImageServerBuilder.ServerBuilder, name, description and metadata, but assigns a new unique ID.
      Parameters:
      entry - the entry that should be copied
      copyData - 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

      ProjectImageEntry<T> getEntry(ImageData<T> imageData)
      Request a ProjectImageEntry associated with an ImageData
      Parameters:
      imageData -
      Returns:
    • removeImage

      void removeImage(ProjectImageEntry<?> entry, boolean removeAllData)
      Remove an image from the project, optionally including associated data.
      Parameters:
      entry -
      removeAllData -
    • removeAllImages

      void removeAllImages(Collection<ProjectImageEntry<T>> entries, boolean removeAllData)
      Remove multiple images from the project, optionally including associated data.
      Parameters:
      entries -
      removeAllData -
    • syncChanges

      void syncChanges() throws IOException
      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

      default ResourceManager.Manager<String> getScripts()
      Get a manager for scripts saved within this project.
      Returns:
      See Also:
    • getObjectClassifiers

      default ResourceManager.Manager<ObjectClassifier<T>> getObjectClassifiers()
      Get a manager for object classifiers saved within this project.
      Returns:
      See Also:
    • getPixelClassifiers

      default ResourceManager.Manager<PixelClassifier> 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 return
      ext - 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, or null if the project does not support the resource or extension.