weka.knowledgeflow.steps

## Class ImageViewer

- java.lang.Object
- - weka.knowledgeflow.steps.BaseStep
  - - weka.knowledgeflow.steps.ImageViewer

- All Implemented Interfaces:
    java.io.Serializable, BaseStepExtender, DataCollector, Step

      @KFStep(name="ImageViewer",
              category="Visualization",
              toolTipText="View images",
              iconPath="weka/gui/knowledgeflow/icons/StripChart.gif")
      public class ImageViewer
      extends BaseStep
      implements DataCollector

  A step for collecting and viewing image data
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageViewer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.util.Map<java.lang.String,byte[]>` | `bufferedImageMapToSerializableByteMap(java.util.Map<java.lang.String,java.awt.image.BufferedImage> images)` Utility method to convert a map of `BufferedImage` to a map of byte arrays (that hold each image as png bytes)
    `static java.util.Map<java.lang.String,java.awt.image.BufferedImage>` | `byteArrayImageMapToBufferedImageMap(java.util.Map<java.lang.String,byte[]> dataMap)` Utility method to convert a map of `byte[]` png image data to a map of `BufferedImage`
    `java.util.Map<java.lang.String,java.awt.image.BufferedImage>` | `getImages()` Get a map of named images that this step has collected
    `java.util.List<java.lang.String>` | `getIncomingConnectionTypes()` Get a list of acceptable incoming connections - only StepManager.CON_IMAGE in this case
    `java.util.Map<java.lang.String,java.lang.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.
    `java.util.List<java.lang.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
    `void` | `processIncoming(Data data)` Process incoming image data
    `void` | `restoreData(java.lang.Object data)` Restore data for this step.
    `java.lang.Object` | `retrieveData()` Retrieve the data stored in this step.
    `void` | `stepInit()` Initialize the step.

    - ### Methods inherited from class weka.knowledgeflow.steps.BaseStep

      `environmentSubstitute, getCustomEditorForStep, getDefaultSettings, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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`

    - #### getIncomingConnectionTypes

          public java.util.List<java.lang.String> getIncomingConnectionTypes()

      Get a list of acceptable incoming connections - only StepManager.CON_IMAGE in this case
      Specified by:
        `getIncomingConnectionTypes` in interface `BaseStepExtender`
      Specified by:
        `getIncomingConnectionTypes` in interface `Step`
      Returns:
        a list of acceptable incoming connections

    - #### getOutgoingConnectionTypes

          public java.util.List<java.lang.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

    - #### processIncoming

          public void processIncoming(Data data)
                               throws WekaException

      Process incoming image data
      Specified by:
        `processIncoming` in interface `BaseStepExtender`
      Specified by:
        `processIncoming` in interface `Step`
      Overrides:
        `processIncoming` in class `BaseStep`
      Parameters:
        `data` - the data to process
      Throws:
        `WekaException` - if a problem occurs

    - #### getImages

          public java.util.Map<java.lang.String,java.awt.image.BufferedImage> getImages()

      Get a map of named images that this step has collected
      Returns:
        a map of named images

    - #### getInteractiveViewers

          public java.util.Map<java.lang.String,java.lang.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 java.lang.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(java.lang.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 java.util.Map<java.lang.String,java.awt.image.BufferedImage> byteArrayImageMapToBufferedImageMap(java.util.Map<java.lang.String,byte[]> dataMap)
                                                                                                                  throws java.io.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 `BufferedImage`s
      Throws:
        `java.io.IOException` - if a problem occurs

    - #### bufferedImageMapToSerializableByteMap

          public static java.util.Map<java.lang.String,byte[]> bufferedImageMapToSerializableByteMap(java.util.Map<java.lang.String,java.awt.image.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 `BufferedImage`s to convert
      Returns:
        a map of png byte arrays