de.unihalle.informatik.MiToBo.tools.image
Class ImageConverter

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.tools.image.ImageConverter
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator

@ALDAOperator(genericExecutionMode=ALL)
public class ImageConverter
extends MTBOperator

Plugin to convert images that are represented by MTBImage. This plugin can be used as operator, because it provides more functionality than the MTBImage.convertType(..)-method, namely splitting of RGB color channels to true channels and merging of true channels to RGB color channels. See setChannelsAreRGBFlag(..)-method

Author:
Oliver Gress

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  java.lang.Boolean channelsAreRGB
           
private  MTBImage inputImg
           
private  MTBImage.MTBImageType outputType
           
private  MTBImage resultImg
           
private  boolean scaleValues
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
ImageConverter()
          Constructor.
ImageConverter(MTBImage _inputImg, MTBImage.MTBImageType _outputType, boolean _scaleValues, java.lang.Boolean _channelsAreRGB)
          Constructor
 
Method Summary
 java.lang.Boolean getChannelsAreRGBFlag()
          Get flag if RGB color channels are interpreted as real image channels.
 MTBImage getInputImg()
          Get input image
 MTBImage.MTBImageType getOutputType()
          Get output image type
 MTBImage getResultImg()
          Get result image
 boolean isScaleValues()
          Get flag if values are scaled to match the range of output type values if necessary
protected  void operate()
           
 void setChannelsAreRGBFlag(java.lang.Boolean channelsAreRGB1)
          Set flag if RGB color channels are interpreted as real image channels.
 void setInputImg(MTBImage _inputImg1)
          Set input image
 void setOutputType(MTBImage.MTBImageType outputType1)
          Set output image type
protected  void setResultImg(MTBImage resultImg1)
          Set result image
 void setScaleValues(boolean scaleValues1)
          Set flag if values are scaled to match the range of output type values if necessary
 void validateCustom()
           
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

channelsAreRGB

@Parameter(label="ChannelsAreRGB",
           required=false,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=4,
           description="Flag for interpretation of channels as RGB color channels (and vice versa) if converting from or to RGB")
private java.lang.Boolean channelsAreRGB

inputImg

@Parameter(label="InputImage",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=1,
           description="Input image")
private MTBImage inputImg

outputType

@Parameter(label="OutputType",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=2,
           description="output image type")
private MTBImage.MTBImageType outputType

resultImg

@Parameter(label="ResultingImage",
           required=true,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=1,
           description="Resulting image")
private MTBImage resultImg

scaleValues

@Parameter(label="ScaleValues",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=3,
           description="Scale image values to the range of values of the output type if necessary")
private boolean scaleValues
Constructor Detail

ImageConverter

public ImageConverter()
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. Use set-functions to specify parameters

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ImageConverter

public ImageConverter(MTBImage _inputImg,
                      MTBImage.MTBImageType _outputType,
                      boolean _scaleValues,
                      java.lang.Boolean _channelsAreRGB)
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Parameters:
_inputImg - input image that has to be converted
_outputType - output image type
_scaleValues - set true to scale values to the range of output type values if necessary
_channelsAreRGB - if true, RGB color channels are separated to true channels when converting from RGB to gray and channels are merged into RGB color channels when converting from gray to RGB. See setChannelsAreRGBFlag(..)-method. May be null for gray-to-gray conversion.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getChannelsAreRGBFlag

public java.lang.Boolean getChannelsAreRGBFlag()
Get flag if RGB color channels are interpreted as real image channels. (see setChannelsAreRGBFlag(..))


getInputImg

public MTBImage getInputImg()
Get input image


getOutputType

public MTBImage.MTBImageType getOutputType()
Get output image type


getResultImg

public MTBImage getResultImg()
Get result image


isScaleValues

public boolean isScaleValues()
Get flag if values are scaled to match the range of output type values if necessary


operate

protected void operate()
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator

setChannelsAreRGBFlag

public void setChannelsAreRGBFlag(java.lang.Boolean channelsAreRGB1)
Set flag if RGB color channels are interpreted as real image channels. If true and conversion is from gray value to RGB or vice versa, the each color channel is treated as separate channel. If false RGB values are converted to gray values (gray = (R+G+B)/3). In the other conversion direction, gray values are converted to gray RGB values (R=G=B = gray)


setInputImg

public void setInputImg(MTBImage _inputImg1)
Set input image


setOutputType

public void setOutputType(MTBImage.MTBImageType outputType1)
Set output image type


setResultImg

protected void setResultImg(MTBImage resultImg1)
Set result image


setScaleValues

public void setScaleValues(boolean scaleValues1)
Set flag if values are scaled to match the range of output type values if necessary


validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException