Class AbstractSpectrumImageGenerator

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, Serializable
    Direct Known Subclasses:
    AbstractSpectrumImageGeneratorWithRange

    public abstract class AbstractSpectrumImageGenerator
    extends adams.core.option.AbstractOptionHandler
    Ancestor for image generators from spectra.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ImageType m_ImageType
      the image type to generate.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

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

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Field Detail

      • m_ImageType

        protected ImageType m_ImageType
        the image type to generate.
    • Constructor Detail

      • AbstractSpectrumImageGenerator

        public AbstractSpectrumImageGenerator()
    • Method Detail

      • 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
      • setImageType

        public void setImageType​(ImageType value)
        Sets the type of image to generate.
        Parameters:
        value - the type
      • getImageType

        public ImageType getImageType()
        Returns the type of image to generate.
        Returns:
        the type
      • imageTypeTipText

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

        protected String check​(Spectrum spectrum)
        Hook method for checks before generating the image.
        Parameters:
        spectrum - the spectrum to check
        Returns:
        null if successful, otherwise the error message
      • newImage

        protected BufferedImage newImage​(int width,
                                         int height)
        Creates a new image.
        Parameters:
        width - the width of the image
        height - the height of the image
        Returns:
        the image
      • setPixel

        protected void setPixel​(BufferedImage img,
                                int x,
                                int y,
                                int val)
        Sets the pixel in the image.
        Parameters:
        img - the image to update
        x - the x of the pixel
        y - the y of the pixel
        val - the value to set
      • doGenerate

        protected abstract BufferedImage doGenerate​(Spectrum spectrum)
        Converts the spectrum into an image.
        Parameters:
        spectrum - the spectrum to convert
        Returns:
        the generated image
      • generate

        public BufferedImage generate​(Spectrum spectrum)
        Converts the spectrum into an image.
        Parameters:
        spectrum - the spectrum to convert
        Returns:
        the generated image