Class HeatmapToBufferedImageWithKey

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.data.conversion.AbstractConversion>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.conversion.Conversion, HeatmapToBufferedImageConversion, Serializable

    public class HeatmapToBufferedImageWithKey
    extends adams.data.conversion.AbstractConversion
    implements HeatmapToBufferedImageConversion
    Turns a heatmap into a BufferedImage, allows the generation of a key in the image.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -generator <adams.gui.visualization.core.ColorGradientGenerator> (property: generator)
        The generator to use for creating the gradient colors.
        default: adams.gui.visualization.core.BiColorGenerator
     
    -use-custom-range <boolean> (property: useCustomRange)
        Whether to use a custom user defined range rather than the range from the
        incoming heatmap
        default: false
     
    -min-range <double> (property: minRange)
        the minimum value of the heatmap colour range
        default: -1.0
     
    -max-range <double> (property: maxRange)
        the maximum value to use in the colour range
        default: 100.0
     
    -show-key <boolean> (property: showKey)
        Whether to display a key displaying the values corresponding to certain
        colours on the heatmap
        default: false
     
    -scale-factor <int> (property: scaleFactor)
        scale factor with which to increase the size of the heatmap image
        default: 1
     
    -missing-color <java.awt.Color> (property: missingColor)
        The color to use if a value in the heatmap is missing
        default: #ffffff
     
    Author:
    michael.fowke
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.gui.visualization.core.ColorGradientGenerator m_Generator
      The generator to use
      protected Color[] m_GradientColors
      the gradient colors
      protected double m_MaxRange
      Maximum value of the range
      protected double m_MinRange
      Minimum value of the range
      protected Color m_MissingColor
      colour to use to display a missing value
      protected int m_ScaleFactor
      scale factor to enlarge the heatmap
      protected boolean m_ShowKey
      Whether to display the colour key on the heatmap
      protected boolean m_UseCustomRange
      Whether to use a use defined range
      • Fields inherited from class adams.data.conversion.AbstractConversion

        m_Input, m_Output, m_Owner, m_Stopped
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Class accepts()  
      void defineOptions()
      Adds options to the internal list of options.
      protected Object doConvert()
      Performs the actual conversion.
      Class generates()  
      String generatorTipText()
      Returns the tip text for this property.
      adams.gui.visualization.core.ColorGradientGenerator getGenerator()
      Returns the number of gradient colors to use.
      protected Color[] getGradientColors()
      Generates the gradient colors.
      double getMaxRange()
      Get the maximum value in the user defined range
      double getMinRange()
      Get the mimum value in the user defined range
      Color getMissingColor()
      Get the colour to use for a missing value
      int getScaleFactor()
      Get the scale factor to enlarge the heatmap by
      boolean getShowKey()
      Get whether to display the colour key with the heatmap
      boolean getUseCustomRange()
      Set whether to use a custom range
      String globalInfo()
      Returns a string describing the object.
      double grayToIntensity​(Heatmap map, int gray)
      Turns the gray value back into an intensity value.
      String maxRangeTipText()
      Tip text for this property
      String minRangeTipText()
      Tip text for this property
      String missingColorTipText()
      Tip text for this property
      protected void reset()
      Resets the object.
      String scaleFactorTipText()
      Tip text for this property
      void setGenerator​(adams.gui.visualization.core.ColorGradientGenerator value)
      Sets the number of gradient colors to use.
      void setMaxRange​(double value)
      Set the maximum value in the user defined range
      void setMinRange​(double value)
      Set the minimum value in the user defined range
      void setMissingColor​(Color val)
      Set the colour to use for a missing value
      void setScaleFactor​(int val)
      Set the scale factor to enlarge the heatmap by
      void setShowKey​(boolean value)
      Set whether to display the colour key with the heatmap
      void setUseCustomRange​(boolean value)
      Set whether to use a custom range
      String showKeyTipText()
      Tip text for this property
      String useCustomRangeTipText()
      Tip text for this property
      • Methods inherited from class adams.data.conversion.AbstractConversion

        checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, getQuickInfo, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.CleanUpHandler

        cleanUp
      • Methods inherited from interface adams.data.conversion.Conversion

        convert, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.QuickInfoSupporter

        getQuickInfo
      • Methods inherited from interface adams.core.Stoppable

        stopExecution
    • Field Detail

      • m_Generator

        protected adams.gui.visualization.core.ColorGradientGenerator m_Generator
        The generator to use
      • m_UseCustomRange

        protected boolean m_UseCustomRange
        Whether to use a use defined range
      • m_MinRange

        protected double m_MinRange
        Minimum value of the range
      • m_MaxRange

        protected double m_MaxRange
        Maximum value of the range
      • m_ShowKey

        protected boolean m_ShowKey
        Whether to display the colour key on the heatmap
      • m_ScaleFactor

        protected int m_ScaleFactor
        scale factor to enlarge the heatmap
      • m_MissingColor

        protected Color m_MissingColor
        colour to use to display a missing value
      • m_GradientColors

        protected Color[] m_GradientColors
        the gradient colors
    • Constructor Detail

      • HeatmapToBufferedImageWithKey

        public HeatmapToBufferedImageWithKey()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • reset

        protected void reset()
        Resets the object.
        Overrides:
        reset in class adams.data.conversion.AbstractConversion
      • setGenerator

        public void setGenerator​(adams.gui.visualization.core.ColorGradientGenerator value)
        Sets the number of gradient colors to use.
        Parameters:
        value - the number of colors
      • getGenerator

        public adams.gui.visualization.core.ColorGradientGenerator getGenerator()
        Returns the number of gradient colors to use.
        Returns:
        the number of colors
      • generatorTipText

        public String generatorTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseCustomRange

        public void setUseCustomRange​(boolean value)
        Set whether to use a custom range
        Parameters:
        value - Whether to use a user defined range
      • getUseCustomRange

        public boolean getUseCustomRange()
        Set whether to use a custom range
        Returns:
        Whether to use a user defined range
      • useCustomRangeTipText

        public String useCustomRangeTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setMinRange

        public void setMinRange​(double value)
        Set the minimum value in the user defined range
        Parameters:
        value - Minimum value
      • getMinRange

        public double getMinRange()
        Get the mimum value in the user defined range
        Returns:
        Minimum value
      • minRangeTipText

        public String minRangeTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setMaxRange

        public void setMaxRange​(double value)
        Set the maximum value in the user defined range
        Parameters:
        value - maximum value
      • getMaxRange

        public double getMaxRange()
        Get the maximum value in the user defined range
        Returns:
        The maximum value
      • maxRangeTipText

        public String maxRangeTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setShowKey

        public void setShowKey​(boolean value)
        Set whether to display the colour key with the heatmap
        Parameters:
        value - Whether to display key
      • getShowKey

        public boolean getShowKey()
        Get whether to display the colour key with the heatmap
        Returns:
        Whether to display the key
      • showKeyTipText

        public String showKeyTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setScaleFactor

        public void setScaleFactor​(int val)
        Set the scale factor to enlarge the heatmap by
        Parameters:
        val - Scale factor
      • getScaleFactor

        public int getScaleFactor()
        Get the scale factor to enlarge the heatmap by
        Returns:
        Scale factor
      • scaleFactorTipText

        public String scaleFactorTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setMissingColor

        public void setMissingColor​(Color val)
        Set the colour to use for a missing value
        Parameters:
        val - Colour for representing a missing value
      • getMissingColor

        public Color getMissingColor()
        Get the colour to use for a missing value
        Returns:
        Colour for representing a missing value
      • missingColorTipText

        public String missingColorTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • accepts

        public Class accepts()
        Specified by:
        accepts in interface adams.data.conversion.Conversion
        Specified by:
        accepts in class adams.data.conversion.AbstractConversion
      • generates

        public Class generates()
        Specified by:
        generates in interface adams.data.conversion.Conversion
        Specified by:
        generates in class adams.data.conversion.AbstractConversion
      • getGradientColors

        protected Color[] getGradientColors()
        Generates the gradient colors.
        Returns:
        the colors
      • doConvert

        protected Object doConvert()
                            throws Exception
        Performs the actual conversion.
        Specified by:
        doConvert in class adams.data.conversion.AbstractConversion
        Returns:
        the converted object
        Throws:
        Exception - if conversion fails
      • grayToIntensity

        public double grayToIntensity​(Heatmap map,
                                      int gray)
        Turns the gray value back into an intensity value.
        Specified by:
        grayToIntensity in interface HeatmapToBufferedImageConversion
        Parameters:
        map - the map that got converted
        gray - the gray value (0-255)
        Returns:
        the generated intensity value