Package weka.knowledgeflow.steps
Class ImageViewer
java.lang.Object
weka.knowledgeflow.steps.BaseStep
weka.knowledgeflow.steps.ImageViewer
- All Implemented Interfaces:
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionUtility method to convert a map ofBufferedImage
to a map of byte arrays (that hold each image as png bytes)static Map<String,
BufferedImage> byteArrayImageMapToBufferedImageMap
(Map<String, byte[]> dataMap) Utility method to convert a map ofbyte[]
png image data to a map ofBufferedImage
Get a map of named images that this step has collectedGet a list of acceptable incoming connections - only StepManager.CON_IMAGE in this caseGets 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.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 connectionvoid
processIncoming
(Data data) Process incoming image datavoid
restoreData
(Object data) Restore data for this step.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, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
-
Constructor Details
-
ImageViewer
public ImageViewer()
-
-
Method Details
-
stepInit
public void stepInit()Initialize the step. Nothing to do in the case of this step- Specified by:
stepInit
in interfaceBaseStepExtender
- Specified by:
stepInit
in interfaceStep
-
getIncomingConnectionTypes
Get a list of acceptable incoming connections - only StepManager.CON_IMAGE in this case- Specified by:
getIncomingConnectionTypes
in interfaceBaseStepExtender
- Specified by:
getIncomingConnectionTypes
in interfaceStep
- Returns:
- a list of acceptable incoming connections
-
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 interfaceBaseStepExtender
- Specified by:
getOutgoingConnectionTypes
in interfaceStep
- Returns:
- a list of outgoing connections
-
processIncoming
Process incoming image data- Specified by:
processIncoming
in interfaceBaseStepExtender
- Specified by:
processIncoming
in interfaceStep
- Overrides:
processIncoming
in classBaseStep
- Parameters:
data
- the data to process- Throws:
WekaException
- if a problem occurs
-
getImages
Get a map of named images that this step has collected- Returns:
- a map of named images
-
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 interfaceStep
- Overrides:
getInteractiveViewers
in classBaseStep
- Returns:
- a list of viewer classes
-
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 interfaceDataCollector
- Returns:
- the data stored in this step
-
restoreData
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 interfaceDataCollector
- Parameters:
data
- the data to set- Throws:
WekaException
- if a problem occurs
-
byteArrayImageMapToBufferedImageMap
public static Map<String,BufferedImage> byteArrayImageMapToBufferedImageMap(Map<String, byte[]> dataMap) throws IOExceptionUtility method to convert a map ofbyte[]
png image data to a map ofBufferedImage
- Parameters:
dataMap
- the map containing raw png byte arrays- Returns:
- a map of
BufferedImage
s - Throws:
IOException
- if a problem occurs
-
bufferedImageMapToSerializableByteMap
public static Map<String,byte[]> bufferedImageMapToSerializableByteMap(Map<String, BufferedImage> images) Utility method to convert a map ofBufferedImage
to a map of byte arrays (that hold each image as png bytes)- Parameters:
images
- the map ofBufferedImage
s to convert- Returns:
- a map of png byte arrays
-