public class TLcdSemanticsOp extends ALcdImageOperator
semantics
of an image.
This can for example be used to interpret 3 measurement bands as the red, green and blue component of a color.
This operator can be used to change the semantics in any way except for the number of bands. This operator also does
not allow re-ordering bands. The semantics of the i'th input band is changed to the i'th semantics that are specified.
When changing the semantics the values can be adjusted using a scale and offset. If no explicit scale and offset
are specified then the behavior is as follows:
1 / 255
on the normalized values. However in case of a conversion from (measurement, 1 band, float,
normalized range=[-Inf,+Inf]) to (color, 1 band, ubyte, normalized range=[0,1]) the scale factor should usually be
specified to get a sensible results. In this case if you for example want to map the float range in [-100,100] to
[0,1], you would use offset 100
and scale 1 / 200
. You can find more details about the image
processing model here
.
// Using the static method
ALcdImage inputImage = ...;
ALcdImage outputImage = TLcdSemanticsOp.semantics(inputImage, ALcdBandSemantics.DataType.FLOAT);
// Using a data object
ALcdImage inputImage = ...;
double[] scales = ...;
double[] offsets = ...;
TLcdSemanticsOp op = new TLcdSemanticsOp();
ILcdDataObject params = op.getParameterDataType().newInstance();
params.setValue(TLcdSemanticsOp.BAND_SEMANTICS, ALcdBandSemantics.DataType.FLOAT);
params.setValue(TLcdSemanticsOp.SCALES, scales);
params.setValue(TLcdSemanticsOp.OFFSETS, offsets);
ALcdImage outputImage = op.apply(params);
ALcdImageOperator.ImageOperatorTypeBuilder
Modifier and Type | Field and Description |
---|---|
static TLcdDataProperty |
BAND_SEMANTICS
Semantics to set on the image.
|
static TLcdDataProperty |
INPUT_IMAGE
The input image.
|
static String |
NAME
Name of the operator.
|
static TLcdDataProperty |
OFFSETS
The (optional) offset to apply to the scaled input image values.
|
static TLcdDataProperty |
SCALES
The (optional) scale to apply to the input image values.
|
static TLcdDataType |
SEMANTICS_FILTER_TYPE
Input data type of the operator.
|
INPUT_IMAGE_NAME
Constructor and Description |
---|
TLcdSemanticsOp()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ALcdImage |
apply(ILcdDataObject aParameters)
Applies this operator to the given input parameters.
|
static ALcdImage |
semantics(ALcdImage aSource,
ALcdBandSemantics.DataType aOutputFormat)
Changes the
ALcdBandSemantics.getDataType() data type of all bands. |
static ALcdImage |
semantics(ALcdImage aImage,
ALcdBandSemantics[] aBandSemantics)
Set new band semantics on an image.
|
static ALcdImage |
semantics(ALcdImage aImage,
ALcdBandSemantics[] aBandSemantics,
double[] aScales,
double[] aOffsets)
Set new band semantics on an image and additionally apply scales and offsets to the
values in each band.
|
static ALcdImage |
semantics(ALcdImage aImage,
List<ALcdBandSemantics> aBandSemantics)
Equivalent to
semantics(com.luciad.imaging.ALcdImage, com.luciad.imaging.ALcdBandSemantics[]) ,
but takes a list instead of an array as input. |
static ALcdImage |
semantics(ALcdImage aImage,
List<ALcdBandSemantics> aBandSemantics,
double[] aScales,
double[] aOffsets)
Equivalent to
semantics(com.luciad.imaging.ALcdImage, com.luciad.imaging.ALcdBandSemantics[], double[], double[]) ,
but takes a list instead of an array as input. |
createTypeBuilder, createTypeBuilder, equals, getParameterDataType, hashCode, toString
public static final String NAME
public static final TLcdDataProperty INPUT_IMAGE
public static final TLcdDataProperty BAND_SEMANTICS
public static final TLcdDataProperty SCALES
TLcdPixelRescaleOp.SCALES
public static final TLcdDataProperty OFFSETS
TLcdPixelRescaleOp.OFFSETS
public static final TLcdDataType SEMANTICS_FILTER_TYPE
public ALcdImage apply(ILcdDataObject aParameters)
ALcdImageOperator
apply
in class ALcdImageOperator
aParameters
- the parameters for the operatorpublic static ALcdImage semantics(ALcdImage aImage, ALcdBandSemantics[] aBandSemantics)
aImage
- the input imageaBandSemantics
- semantics to set on the imagepublic static ALcdImage semantics(ALcdImage aImage, ALcdBandSemantics[] aBandSemantics, double[] aScales, double[] aOffsets)
aScales
and aOffsets
parameters is equivalent to those in TLcdPixelRescaleOp
.
The length of the scale and offset arrays must match the number of bands.aImage
- the input imageaBandSemantics
- semantics to set on the imageaScales
- scale factors to be applied to the values of each bandaOffsets
- offsets to be applied to the values of each bandpublic static ALcdImage semantics(ALcdImage aImage, List<ALcdBandSemantics> aBandSemantics)
semantics(com.luciad.imaging.ALcdImage, com.luciad.imaging.ALcdBandSemantics[])
,
but takes a list instead of an array as input.aImage
- the input imageaBandSemantics
- semantics to set on the imagepublic static ALcdImage semantics(ALcdImage aImage, List<ALcdBandSemantics> aBandSemantics, double[] aScales, double[] aOffsets)
semantics(com.luciad.imaging.ALcdImage, com.luciad.imaging.ALcdBandSemantics[], double[], double[])
,
but takes a list instead of an array as input.aImage
- the input imageaBandSemantics
- semantics to set on the imageaScales
- scale factors to be applied to the values of each bandaOffsets
- offsets to be applied to the values of each bandpublic static ALcdImage semantics(ALcdImage aSource, ALcdBandSemantics.DataType aOutputFormat)
ALcdBandSemantics.getDataType()
data type of all bands.aSource
- the input imageaOutputFormat
- the output format