Class ImageData<T>

java.lang.Object
qupath.lib.images.ImageData<T>
Type Parameters:
T -
All Implemented Interfaces:
EventListener, PathObjectHierarchyListener, WorkflowListener

public class ImageData<T> extends Object implements WorkflowListener, PathObjectHierarchyListener
Class that brings together the main data in connection with the analysis of a single image.

Currently, this is really the server (to access the image & its pixels) and the object hierarchy that represents detections. In addition, there is an ImageType - as some options may change depending on this.

One particularly significant example is that of Brightfield images in pathology, for which stain vectors are often required for effective stain separation.

Author:
Pete Bankhead
  • Constructor Details

    • ImageData

      public ImageData(ImageServer<T> server, PathObjectHierarchy hierarchy, ImageData.ImageType type)
      Create a new ImageData with a specified object hierarchy and type.
      Parameters:
      server -
      hierarchy -
      type -
    • ImageData

      public ImageData(ImageServer<T> server, ImageData.ImageType type)
      Create a new ImageData with a specified type and creating a new object hierarchy.
      Parameters:
      server -
      type -
    • ImageData

      public ImageData(ImageServer<T> server, PathObjectHierarchy hierarchy)
      Create a new ImageData with ImageType.UNKNOWN.
      Parameters:
      server -
      hierarchy -
    • ImageData

      public ImageData(ImageServer<T> server)
      Create a new ImageData with ImageType.UNKNOWN and a new PathObjectHierarchy.
      Parameters:
      server -
  • Method Details

    • getHistoryWorkflow

      public Workflow getHistoryWorkflow()
      Get a workflow representing a history of the processing steps applied to the ImageData.
      Returns:
    • setColorDeconvolutionStains

      public void setColorDeconvolutionStains(ColorDeconvolutionStains stains)
      Set the color deconvolution stain vectors for the current image type.

      If the type is not brightfield, an IllegalArgumentException is thrown.

      Parameters:
      stains -
    • updateServerMetadata

      public void updateServerMetadata(ImageServerMetadata newMetadata)
      Update the ImageServer metadata. The benefit of using this method rather than manipulating the ImageServer directly is that it will fire a property change.
      Parameters:
      newMetadata -
    • isBrightfield

      public boolean isBrightfield()
      Returns true if the image type is set to brightfield.
      Returns:
    • isFluorescence

      public boolean isFluorescence()
      Returns true if the image type is set to fluorescence.
      Returns:
    • setImageType

      public void setImageType(ImageData.ImageType type)
      Set the image type.
      Parameters:
      type -
    • getServer

      public ImageServer<T> getServer()
      Get the ImageServer.
      Returns:
    • getServerPath

      public String getServerPath()
      Get the path of the ImageServer.
      Returns:
    • getHierarchy

      public PathObjectHierarchy getHierarchy()
      Get the object hierarchy.
      Returns:
    • getImageType

      public ImageData.ImageType getImageType()
      Get the image type
      Returns:
    • getColorDeconvolutionStains

      public ColorDeconvolutionStains getColorDeconvolutionStains()
      Get the stains defined for this image, or null if this is not a brightfield image suitable for color deconvolution.
      Returns:
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Add a new property change listener.
      Parameters:
      listener -
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Remove a property change listener.
      Parameters:
      listener -
    • getProperty

      public Object getProperty(String key)
      Get a specified property.
      Parameters:
      key -
      Returns:
    • setProperty

      public Object setProperty(String key, Object value)
      Set a property. Note that if properties are Serializable, they will be included in associated data files - otherwise they are stored only transiently.
      Parameters:
      key -
      value -
      Returns:
    • removeProperty

      public Object removeProperty(String key)
      Remove a specified property.
      Parameters:
      key -
      Returns:
    • getProperties

      public Map<String,Object> getProperties()
      Get an unmodifiable map representing all known properties for this ImageData.
      Returns:
    • getLastSavedPath

      public String getLastSavedPath()
      Get the last path used to save this object;
      Returns:
    • isChanged

      public boolean isChanged()
      Returns true if changes have been recorded since the last time this object was notified that it was saved.
      Returns:
      See Also:
    • setChanged

      public void setChanged(boolean isChanged)
      Set isChanged() status.
      Parameters:
      isChanged -
    • setLastSavedPath

      public void setLastSavedPath(String path, boolean resetChanged)
      Set the last path used to save this object;
      Parameters:
      path -
      resetChanged - If true, then the isChanged() flag will be reset to false;
    • hierarchyChanged

      public void hierarchyChanged(PathObjectHierarchyEvent event)
      Description copied from interface: PathObjectHierarchyListener
      Notify listeners of a change in the hierarchy or its objects.
      Specified by:
      hierarchyChanged in interface PathObjectHierarchyListener
      Parameters:
      event -
    • workflowUpdated

      public void workflowUpdated(Workflow workflow)
      Description copied from interface: WorkflowListener
      Called whenever a Workflow has been updated in some way, such as a new step added.
      Specified by:
      workflowUpdated in interface WorkflowListener
      Parameters:
      workflow -
    • toString

      public String toString()
      Overrides:
      toString in class Object