Class ImageViewer

    • Constructor Detail

      • ImageViewer

        public ImageViewer()
    • Method Detail

      • stepInit

        public void stepInit()
        Initialize the step. Nothing to do in the case of this step
        Specified by:
        stepInit in interface BaseStepExtender
        Specified by:
        stepInit in interface Step
      • getOutgoingConnectionTypes

        public List<String> getOutgoingConnectionTypes()
        Get a list of outgoing connections that can be generated given the current state of the step - will produce StepManager.CON_IMAGE data if we have at least one incoming image connection connection
        Specified by:
        getOutgoingConnectionTypes in interface BaseStepExtender
        Specified by:
        getOutgoingConnectionTypes in interface Step
        Returns:
        a list of outgoing connections
      • getImages

        public Map<String,​BufferedImage> getImages()
        Get a map of named images that this step has collected
        Returns:
        a map of named images
      • getInteractiveViewers

        public Map<String,​String> getInteractiveViewers()
        Gets a list of classes of viewers that can be popped up in the GUI Knowledge Flow from this step, given that we have received and stored some image data.
        Specified by:
        getInteractiveViewers in interface Step
        Overrides:
        getInteractiveViewers in class BaseStep
        Returns:
        a list of viewer classes
      • retrieveData

        public Object retrieveData()
        Retrieve the data stored in this step. This is a map of png image data (as raw bytes), keyed by image name.
        Specified by:
        retrieveData in interface DataCollector
        Returns:
        the data stored in this step
      • restoreData

        public void restoreData​(Object data)
                         throws WekaException
        Restore data for this step. Argument is expected to be a map of png image data (as raw bytes) keyed by image name
        Specified by:
        restoreData in interface DataCollector
        Parameters:
        data - the data to set
        Throws:
        WekaException - if a problem occurs
      • byteArrayImageMapToBufferedImageMap

        public static Map<String,​BufferedImage> byteArrayImageMapToBufferedImageMap​(Map<String,​byte[]> dataMap)
                                                                                   throws IOException
        Utility method to convert a map of byte[] png image data to a map of BufferedImage
        Parameters:
        dataMap - the map containing raw png byte arrays
        Returns:
        a map of BufferedImages
        Throws:
        IOException - if a problem occurs
      • bufferedImageMapToSerializableByteMap

        public static Map<String,​byte[]> bufferedImageMapToSerializableByteMap​(Map<String,​BufferedImage> images)
        Utility method to convert a map of BufferedImage to a map of byte arrays (that hold each image as png bytes)
        Parameters:
        images - the map of BufferedImages to convert
        Returns:
        a map of png byte arrays