Class ImageDisplay
- All Implemented Interfaces:
- ImageRenderer
Warning! This implementation is likely to change in a future version.
- 
Property SummaryPropertiesTypePropertyDescriptionCounter for the number of display changes that have been made.Property indicating which channel should be used ifuseGrayscaleLutProperty()is turned on.Property that specifies whether grayscale lookup tables should be preferred to color lookup tablesProperty that specifies whether the background should be inverted (i.e.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionapplyTransforms(BufferedImage imgInput, BufferedImage imgOutput) Apply the required transforms to a BufferedImage to get the appropriate display.static BufferedImageapplyTransforms(BufferedImage imgInput, BufferedImage imgOutput, List<? extends ChannelDisplayInfo> selectedChannels, ChannelDisplayMode mode) Convert an image to RGB by applying the specified ChannelDisplayInfos andChannelDisplayMode.voidAutomatically set the display range for a channel, using the default saturation defined inPathPrefs.autoBrightnessContrastSaturationPercentProperty().voidautoSetDisplayRange(ChannelDisplayInfo info, double saturation) Automatically set the display range for a channel.Read-only observable list containing the channels currently available for display.static ImageDisplaycreate(ImageData<BufferedImage> imageData) Create a new image display, and set the specified image data.Get the value ofuseInvertedBackgroundProperty()Counter for the number of display changes that have been made.getHistogram(ChannelDisplayInfo channel) Returns a histogram for a channel of the current image.Get the current image datalongGet the event count, which is here used as an alternative to a timestamp.Get the value ofswitchToGrayscaleChannelProperty().getTransformedValueAsString(BufferedImage img, int x, int y) Get a string representation of a transformed pixel value, using the currently-selected channels.booleanisCompatible(ImageDisplay display) Check if an image display is 'compatible' with this one.voidRefresh the channel options.voidSave color channels in the ImageData properties.Read-only observable list containing the channels currently selected for display.voidsetChannelSelected(ChannelDisplayInfo channel, boolean selected) Set the selection of a channel on or off.voidsetImageData(ImageData<BufferedImage> imageData, boolean retainDisplaySettings) Set theImageDatato a new valuevoidsetMinMaxDisplay(ChannelDisplayInfo info, float minDisplay, float maxDisplay) Set the min/max display values for a specified ChannelDisplayInfo.voidSet the value ofswitchToGrayscaleChannelProperty().voidsetUseGrayscaleLuts(boolean useGrayscaleLuts) Set the value ofuseGrayscaleLutProperty()voidsetUseInvertedBackground(boolean useInvertedBackground) Set the value ofuseInvertedBackgroundProperty()Property indicating which channel should be used ifuseGrayscaleLutProperty()is turned on.toJSON(boolean prettyPrint) Create a JSON representation of the main components of the current display.booleanupdateFromDisplay(ImageDisplay display) Update the current display based upon a different display.booleanThe opposite ofuseGrayscaleLuts()Property that specifies whether grayscale lookup tables should be preferred to color lookup tablesbooleanGet the value ofuseGrayscaleLutProperty()booleanGet the value ofuseInvertedBackgroundProperty()Property that specifies whether the background should be inverted (i.e.Methods inherited from class qupath.lib.gui.images.stores.AbstractImageRenderergetUniqueID
- 
Property Details- 
useGrayscaleLutProperty that specifies whether grayscale lookup tables should be preferred to color lookup tables- See Also:
 
- 
useInvertedBackgroundProperty that specifies whether the background should be inverted (i.e. to make fluorescence resemble brightfield, and vice versa)- See Also:
 
- 
eventCountCounter for the number of display changes that have been made.Note: This replaces a timestamp property used before v0.6.0. It should be more reliable, because changes occurring in quick succession can still be captured - whereas previously any changes that were faster than the millisecond close might get lost. - See Also:
 
- 
switchToGrayscaleChannelProperty indicating which channel should be used ifuseGrayscaleLutProperty()is turned on. This is useful to develop more intuitive interfaces and prevent surprises when switching to grayscale mode.Settings this value does not have any immediate effect on whether channels are selected or not, but rather it is only used when switching to grayscale mode. - Since:
- v0.5.0
- See Also:
 
 
- 
- 
Constructor Details- 
ImageDisplaypublic ImageDisplay()Constructor.
 
- 
- 
Method Details- 
createCreate a new image display, and set the specified image data.- Parameters:
- imageData- the image to set initially; may be null
- Returns:
- a new instance
- Throws:
- IOException- if an exception occurs when trying to set the image
 
- 
setImageDatapublic void setImageData(ImageData<BufferedImage> imageData, boolean retainDisplaySettings) throws IOException Set theImageDatato a new value- Parameters:
- imageData- image data that should be displayed
- retainDisplaySettings- if true, retain the same display settings as for the previous image if possible (i.e. the images have similar channels)
- Throws:
- IOException
 
- 
getImageDataGet the current image data- Returns:
 
- 
useGrayscaleLutPropertyProperty that specifies whether grayscale lookup tables should be preferred to color lookup tables- Returns:
 
- 
useGrayscaleLutspublic boolean useGrayscaleLuts()Get the value ofuseGrayscaleLutProperty()- Returns:
 
- 
setUseGrayscaleLutspublic void setUseGrayscaleLuts(boolean useGrayscaleLuts) Set the value ofuseGrayscaleLutProperty()- Parameters:
- useGrayscaleLuts-
 
- 
useInvertedBackgroundPropertyProperty that specifies whether the background should be inverted (i.e. to make fluorescence resemble brightfield, and vice versa)- Returns:
- See Also:
 
- 
useInvertedBackgroundpublic boolean useInvertedBackground()Get the value ofuseInvertedBackgroundProperty()- Returns:
 
- 
displayModeGet the value ofuseInvertedBackgroundProperty()- Returns:
 
- 
setUseInvertedBackgroundpublic void setUseInvertedBackground(boolean useInvertedBackground) Set the value ofuseInvertedBackgroundProperty()- Parameters:
- useInvertedBackground-
 
- 
useColorLUTspublic boolean useColorLUTs()The opposite ofuseGrayscaleLuts()- Returns:
 
- 
getLastChangeTimestamppublic long getLastChangeTimestamp()Get the event count, which is here used as an alternative to a timestamp.- Returns:
 
- 
eventCountPropertyCounter for the number of display changes that have been made.Note: This replaces a timestamp property used before v0.6.0. It should be more reliable, because changes occurring in quick succession can still be captured - whereas previously any changes that were faster than the millisecond close might get lost. - Returns:
 
- 
refreshChannelOptionspublic void refreshChannelOptions()Refresh the channel options. This may be used if an underlying property of the image has changed, such as the channel names or lookup tables.
- 
switchToGrayscaleChannelPropertyProperty indicating which channel should be used ifuseGrayscaleLutProperty()is turned on. This is useful to develop more intuitive interfaces and prevent surprises when switching to grayscale mode.Settings this value does not have any immediate effect on whether channels are selected or not, but rather it is only used when switching to grayscale mode. - Returns:
- Since:
- v0.5.0
- See Also:
 
- 
setSwitchToGrayscaleChannelSet the value ofswitchToGrayscaleChannelProperty().- Parameters:
- channel-
- Since:
- v0.5.0
 
- 
getSwitchToGrayscaleChannelGet the value ofswitchToGrayscaleChannelProperty().- Returns:
- Since:
- v0.5.0
 
- 
setMinMaxDisplaySet the min/max display values for a specified ChannelDisplayInfo.The benefit of calling this method is that it will update the ImageData metadata if appropriate. - Parameters:
- info-
- minDisplay-
- maxDisplay-
 
- 
saveChannelColorPropertiespublic void saveChannelColorProperties()Save color channels in the ImageData properties. This lets them be deserialized later.
- 
selectedChannelsRead-only observable list containing the channels currently selected for display.- Returns:
- the selected channels
- See Also:
 
- 
availableChannelsRead-only observable list containing the channels currently available for display.- Returns:
- the available channels
- See Also:
 
- 
setChannelSelectedSet the selection of a channel on or off.If a channel's isAdditive() method returns false, all other selected channels will be cleared. Otherwise, other selected channels will be cleared if they are non-additive - but kept if they are additive (and therefore can be sensibly displayed in combination with this channel). - Parameters:
- channel- the channel
- selected- true if the channel should be selected, false if it should not
 
- 
applyTransformsApply the required transforms to a BufferedImage to get the appropriate display.Warning: This is not thread-safe. - Parameters:
- imgInput- the input image; this should not be null, and should be of a type that matches the- ImageData(i.e. same number of channels, same bit-depth).
- imgOutput- the output image (optional); if not null, this should be an RGB image (usually- TYPE_INT_RGB).
- Returns:
- the transformed image; this may be the same as imgOutput, if provided
 
- 
applyTransformspublic static BufferedImage applyTransforms(BufferedImage imgInput, BufferedImage imgOutput, List<? extends ChannelDisplayInfo> selectedChannels, ChannelDisplayMode mode) Convert an image to RGB by applying the specified ChannelDisplayInfos andChannelDisplayMode.- Parameters:
- imgInput- the input image to transform
- imgOutput- optional output image (must be the same size as the input image, and RGB)
- selectedChannels- the channels to use
- mode- the mode used to determine RGB colors for each channel
- Returns:
- an RGB image determined by transforming the input image using the specified channels
 
- 
getTransformedValueAsStringGet a string representation of a transformed pixel value, using the currently-selected channels.- Parameters:
- img- image providing the value
- x- x-coordinate of the pixel
- y- y-coordinate of the pixels
- Returns:
- a String representation of the pixel's transformed value
 
- 
autoSetDisplayRangeAutomatically set the display range for a channel, using the default saturation defined inPathPrefs.autoBrightnessContrastSaturationPercentProperty().- Parameters:
- info- channel to update
 
- 
autoSetDisplayRangeAutomatically set the display range for a channel.- Parameters:
- info- channel to update
- saturation- proportion of pixels that may be saturated, i.e. have the max/min display values (between 0.0 and 1.0)
 
- 
getHistogramReturns a histogram for a channel of the current image.- Parameters:
- channel- the channel
- Returns:
- the histogram for the specified channel, or null if no histogram is available (e.g. the channel is a packed RGB representation that can't have a single histogram associated with it)
 
- 
toJSONCreate a JSON representation of the main components of the current display.- Parameters:
- prettyPrint- optionally request pretty printing
- Returns:
- the Json representation, or null if no image has been set
 
- 
isCompatibleCheck if an image display is 'compatible' with this one. Compatible means that they have the same number of channels, and the same channel names.- Parameters:
- display- the other display with which to check compatibility
- Returns:
- true if the display is compatible, false otherwise
 
- 
updateFromDisplayUpdate the current display based upon a different display. This only makes changes ifisCompatible(ImageDisplay)returns true.This method exists to make it easier to sync display settings across viewers. - Parameters:
- display-
- Returns:
 
 
-