本文整理汇总了Java中javax.media.jai.RenderedOp.getParameterBlock方法的典型用法代码示例。如果您正苦于以下问题:Java RenderedOp.getParameterBlock方法的具体用法?Java RenderedOp.getParameterBlock怎么用?Java RenderedOp.getParameterBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.jai.RenderedOp
的用法示例。
在下文中一共展示了RenderedOp.getParameterBlock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKey
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/** Derives a hash key string for this RenderedOp. */
private static final String getKey(RenderedOp op) {
// Initialize the key string to the RenderedOp hash code.
String key = new String(String.valueOf(op.hashCode()));
// Get the ParameterBlock
ParameterBlock pb = op.getParameterBlock();
// Add the sources.
int numSources = pb.getNumSources();
for(int s = 0; s < numSources; s++) {
RenderedImage src = pb.getRenderedSource(s);
// If the source is a node recurse up the chain.
if(src instanceof RenderedOp) {
key += getKey((RenderedOp)src);
} else {
key += String.valueOf(src.hashCode());
}
}
// Add the parameters.
int numParameters = pb.getNumParameters();
for(int p = 0; p < numParameters; p++) {
// Use toString() instead of hashCode() here because the
// majority of parameters are numerical.
key += pb.getObjectParameter(p).toString();
}
return key;
}
示例2: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
@Override
public Object getProperty(
final String name,
final Object opNode ) {
validate(
name,
opNode);
if ((opNode instanceof RenderedOp) && name.equalsIgnoreCase("sourceThreshold")) {
final RenderedOp op = (RenderedOp) opNode;
final ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
final RenderedImage src = pb.getRenderedSource(0);
final Object property = src.getProperty("sourceThreshold");
if (property != null) {
return property;
} // Getting the Threshold to use
final double threshold = CoverageUtilities.getMosaicThreshold(src.getSampleModel().getDataType());
// Setting the Threshold object for the mosaic
return new double[][] {
{
threshold
}
};
}
return java.awt.Image.UndefinedProperty;
}
示例3: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property in the rendered layer.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name, Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
Object roiProperty = src.getProperty("ROI");
if(roiProperty == null ||
roiProperty == java.awt.Image.UndefinedProperty ||
!(roiProperty instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI roi = (ROI)roiProperty;
// Determine the effective destination bounds.
Rectangle dstBounds = null;
PlanarImage dst = op.getRendering();
if(dst instanceof AreaOpImage &&
((AreaOpImage)dst).getBorderExtender() == null) {
AreaOpImage aoi = (AreaOpImage)dst;
dstBounds =
new Rectangle(aoi.getMinX() + aoi.getLeftPadding(),
aoi.getMinY() + aoi.getTopPadding(),
aoi.getWidth() -
aoi.getLeftPadding() -
aoi.getRightPadding(),
aoi.getHeight() -
aoi.getTopPadding() -
aoi.getBottomPadding());
} else {
dstBounds = dst.getBounds();
}
// If necessary, clip the ROI to the destination bounds.
// XXX Is this desirable?
if(!dstBounds.contains(roi.getBounds())) {
roi = roi.intersect(new ROIShape(dstBounds));
}
return roi;
}
return java.awt.Image.UndefinedProperty;
}
示例4: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return null;
}
ROI srcROI = (ROI)property;
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if(dst instanceof WarpOpImage && !((OpImage)dst).hasExtender(0)) {
WarpOpImage warpIm = (WarpOpImage)dst;
srcBounds =
new Rectangle(src.getMinX() + warpIm.getLeftPadding(),
src.getMinY() + warpIm.getTopPadding(),
src.getWidth() - warpIm.getWidth() + 1,
src.getHeight() - warpIm.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the scale factors
float sx = 1.0F/pb.getIntParameter(1);
float sy = 1.0F/pb.getIntParameter(2);
// Create an equivalent transform.
AffineTransform transform =
new AffineTransform(sx, 0.0, 0.0, sy, 0, 0);
// Create the scaled ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
} else {
return null;
}
}
示例5: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
// Return undefined also if source ROI is empty.
ROI srcROI = (ROI)property;
if (srcROI.getBounds().isEmpty()) {
return java.awt.Image.UndefinedProperty;
}
/// This should really create a proper AffineTransform
/// and transform the ROI with it to avoid forcing
/// ROI.getAsImage to be called.
// Retrieve the transpose type and create a nearest neighbor
// Interpolation object.
TransposeType transposeType =
(TransposeType)pb.getObjectParameter(0);
Interpolation interp =
Interpolation.getInstance(Interpolation.INTERP_NEAREST);
// Return the transposed ROI.
return new ROI(JAI.create("transpose", srcROI.getAsImage(),
transposeType));
}
return java.awt.Image.UndefinedProperty;
}
示例6: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property in the rendered layer.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Retrieve the Interpolation object.
Interpolation interp = (Interpolation)pb.getObjectParameter(1);
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if (dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if (!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the AffineTransform object.
AffineTransform transform =
(AffineTransform)pb.getObjectParameter(0);
// Create the transformed ROI.
ROI dstROI = srcROI.transform((AffineTransform)transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the transformed ROI to the
// destination bounds.
if (!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the transformed and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
}
示例7: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Retrieve the Interpolation object.
Interpolation interp = (Interpolation)pb.getObjectParameter(3);
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if (dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the translation and rotation angle.
double xorig = (double)pb.getFloatParameter(0);
double yorig = (double)pb.getFloatParameter(1);
double angle = (double)pb.getFloatParameter(2);
// Create an transform representing the rotation.
AffineTransform transform =
AffineTransform.getRotateInstance(angle, xorig, yorig);
// Create the rotated/translated ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the rotated ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the rotated and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
}
示例8: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Determine the effective source bounds.
Rectangle srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the scale factors and translation values.
float sx = pb.getFloatParameter(0);
float sy = pb.getFloatParameter(1);
// Create an equivalent transform.
AffineTransform transform =
new AffineTransform(sx, 0.0, 0.0, sy, 0.0, 0.0);
// Create the scaled ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
}
示例9: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Retrieve the Interpolation object.
Interpolation interp = (Interpolation)pb.getObjectParameter(2);
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if (dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the translation values.
float tx = pb.getFloatParameter(0);
float ty = pb.getFloatParameter(1);
// Create a transform representing the translation.
AffineTransform transform =
AffineTransform.getTranslateInstance((double) tx,
(double) ty);
// Create the translated ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
}
示例10: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Retrieve the Interpolation object.
Interpolation interp = (Interpolation)pb.getObjectParameter(4);
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if (dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the scale factors and translation values.
float sx = pb.getFloatParameter(0);
float sy = pb.getFloatParameter(1);
float tx = pb.getFloatParameter(2);
float ty = pb.getFloatParameter(3);
// Create an equivalent transform.
AffineTransform transform =
new AffineTransform(sx, 0.0, 0.0, sy, tx, ty);
// Create the scaled ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
}
示例11: getProperty
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param op Operation node.
*/
public Object getProperty(String name,
RenderedOp op) {
if(name == null || op == null) {
throw new IllegalArgumentException
(JaiI18N.getString("SubsampleAveragePropertyGenerator4"));
}
if (name.equals("roi")) {
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return null;
}
ROI srcROI = (ROI)property;
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if(dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
GeometricOpImage geomIm = (GeometricOpImage)dst;
Interpolation interp = geomIm.getInterpolation();
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = src.getBounds();
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the scale factors and translation values.
double sx = pb.getDoubleParameter(0);
double sy = pb.getDoubleParameter(1);
// Create an equivalent transform.
AffineTransform transform =
new AffineTransform(sx, 0.0, 0.0, sy, 0, 0);
// Create the scaled ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
} else {
return null;
}
}