org.knime.core.node.port.image
Class ImagePortObject

java.lang.Object
  extended by org.knime.core.node.port.AbstractPortObject
      extended by org.knime.core.node.port.image.ImagePortObject
All Implemented Interfaces:
PortObject

public class ImagePortObject
extends AbstractPortObject

Port object representing a simple image (png, ...).

Author:
Thomas Gabriel, KNIME.com, Zurich, Switzerland

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObject
PortObject.PortObjectSerializer<T extends PortObject>
 
Field Summary
static PortType TYPE
          Convenience accessor for the port type.
 
Constructor Summary
ImagePortObject()
          Empty framework constructor.
ImagePortObject(ImageContent content, ImagePortObjectSpec spec)
          Create new port object based on the given arguments.
 
Method Summary
 ImagePortObjectSpec getSpec()
          Get specification to this port object.
 String getSummary()
          Get a short summary of this PortObject.
 JComponent[] getViews()
          The returned views are displayed in the out port view of the referring node.
protected  void load(PortObjectZipInputStream in, PortObjectSpec spec, ExecutionMonitor exec)
          Loads the content into the freshly instantiated object.
protected  void save(PortObjectZipOutputStream out, ExecutionMonitor exec)
          Saves this object to an output stream.
 DataCell toDataCell()
          Produces a single data cell containing the image.
 
Methods inherited from class org.knime.core.node.port.AbstractPortObject
getPortObjectSerializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final PortType TYPE
Convenience accessor for the port type.

Constructor Detail

ImagePortObject

public ImagePortObject()
Empty framework constructor. Do not use!


ImagePortObject

public ImagePortObject(ImageContent content,
                       ImagePortObjectSpec spec)
Create new port object based on the given arguments. The cell class that is generated by the ImageContent.toImageCell() method must be compatible to all DataValue of the spec's ImagePortObjectSpec.getDataType() return value.

Parameters:
content - The image content.
spec - The spec.
Throws:
NullPointerException - If either argument is null.
Method Detail

toDataCell

public DataCell toDataCell()
Produces a single data cell containing the image. This method also verifies the requirements stated in the ImagePortObject(ImageContent, ImagePortObjectSpec) constructor.

Returns:
A new cell representing the image.
See Also:
ImageContent.toImageCell()

getSummary

public String getSummary()
Get a short summary of this PortObject. The return value will be shown in a node port's tooltip, for instance.

Returns:
Summary of the object's content, suitable for a tooltip. Empty strings and null result values are ok (though not encouraged).

getSpec

public ImagePortObjectSpec getSpec()
Get specification to this port object. That is, the corresponding PortObjectSpec which is used to configure any successor node after execution, e.g. a BufferedDataTable can return a DataTableSpec.

Subclasses should narrow the return type if possible.

Returns:
underlying PortObjectSpec or any derived spec, never null.

getViews

public JComponent[] getViews()
The returned views are displayed in the out port view of the referring node. Each component is displayed in an extra tab. The name of the component is used as the title for the tab. It is important that no external members are kept in the component so it can be deleted, when the port object is deleted. If the port object has no view return an empty array.

Returns:
an array of views for the port object, each displayed as a tab in the out port view

load

protected void load(PortObjectZipInputStream in,
                    PortObjectSpec spec,
                    ExecutionMonitor exec)
             throws IOException,
                    CanceledExecutionException
Loads the content into the freshly instantiated object. This method is called at most once in the life time of the object (after the serializer has created a new object using the public no-arg constructor.)

Specified by:
load in class AbstractPortObject
Parameters:
in - To restore from
spec - The accompanying spec (which can be safely cast to the expected class).
exec - For progress/cancelation.
Throws:
IOException - If reading fails.
CanceledExecutionException - If canceled.

save

protected void save(PortObjectZipOutputStream out,
                    ExecutionMonitor exec)
             throws IOException,
                    CanceledExecutionException
Saves this object to an output stream. This method represents the implementation of #savePortObject(PortObject, PortObjectZipOutputStream, ExecutionMonitor).

Specified by:
save in class AbstractPortObject
Parameters:
out - A clean directory to write to.
exec - For progress/cancelation.
Throws:
IOException - If writing fails
CanceledExecutionException - If canceled.


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.