📄 image properties.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0095)http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Properties.doc.html -->
<HTML><HEAD><TITLE>Image Properties</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=exclude name=collection>
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<CENTER><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/JAITOC.fm.html"><IMG
alt=Contents src="Image Properties.files/contents.gif"></A> <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Graphics.doc.html"><IMG
alt=Previous src="Image Properties.files/previous.gif"></A> <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Client-server.doc.html"><IMG
alt=Next src="Image Properties.files/next.gif"></A>
<P><FONT size=5><I>Programming in Java Advanced Imaging</I></FONT> </CENTER><BR>
<CENTER><A name=47227>
<TABLE width="90%" border=0>
<TBODY>
<TR>
<TD align=right><FONT size=3>C H A P T E R</FONT><FONT size=7><IMG
src="Image Properties.files/sm-space.gif">11</FONT></TD></TR></TBODY></TABLE></A></CENTER>
<CENTER><A name=47285>
<TABLE width="90%" border=0>
<TBODY>
<TR>
<TD align=right>
<HR noShade SIZE=7>
<FONT size=6>Image Properties</FONT></TD></TR></TBODY></TABLE></A></CENTER>
<BLOCKQUOTE>
<P><BR><BR><BR>
<P><FONT size=7><B>T</B></FONT>HIS chapter describes image properties.
<P><A name=50856>
<H2>11.1 <IMG src="Image Properties.files/space.gif">Introduction</H2></A>In
addition to the pixel data, images occasionally have many other kinds of data
associated with them. These data, known as <EM>properties</EM>, is a simple
database of arbitrary data attached to the images. Each property is simply an
Object with a unique, case-insensitive name.
<P>The properties are arbitrary and depend on the intended application. JAI
provides methods that enable effective use of properties in the context of an
image processing application but, in most cases, leaves the specification of
the property objects themselves to the developer.
<P>Some examples of properties are:
<P>
<UL>
<LI>Descriptions of exotic shapes, such as hexagonal grids
<P></P></LI></UL>
<UL>
<LI>Mapping from digital pixel values to photometric values
<P></P></LI></UL>
<UL>
<LI>A defined region of interest (ROI) in the source image
<P></P></LI></UL>Every node in an image chain may be queried for its
properties. The value of a property at a particular node may be derived by one
of the following mechanisms:
<P>
<UL>
<LI>It may be <EM>copied</EM> from the node's sources. This is the default
behavior if no other behavior is specified.
<P></P></LI></UL>
<UL>
<LI>It may be <EM>produced</EM> by the node from non-property information
available in the node.
<P></P></LI></UL>
<UL>
<LI>It may be <EM>synthesized</EM> by the node from a rendering.
<P></P></LI></UL>
<UL>
<LI>It may be <EM>inherited</EM> or produced computationally from the
properties of the node's sources.
<P></P></LI></UL>
<UL>
<LI>It may be <EM>set explicitly</EM> by the <CODE>setProperty</CODE> method
in one of the appropriate classes: <CODE>Planarimage</CODE>,
<CODE>RenderedOp</CODE>, or <CODE>RenderableOp</CODE>. Properties of a node
may not be set once the node has been rendered.
<P></P></LI></UL>When the value of a property is requested from a node in a
rendered chain, i.e., a <CODE>RenderedOp</CODE> node, it will be derived from
the first of the following for which it is defined:
<P>
<UL>1. Synthetic properties (see below).
<P>2. Local properties, i.e., those set by an invocation of setProperty() on
the node.
<P>3. The source image of the operation specified by invoking the method
<CODE>OperationRegsitry.copyPropertyFromSource()</CODE>.
<P>4. The rendering of the node. Note however that properties set by
invoking <CODE>setProperty()</CODE> on the rendering of the node rather than
on the node itself will not be propagated back to the node itself.
<P>5. Any PropertyGenerators either defined by the associated operation or
added by an invocation of <CODE>RenderedOp.addPropertyGenerator()</CODE>.
PropertyGenerators added by the latter method supersede those associated
with the operation, e.g., via its OperationDescriptor.
<P>6. The sources of the operation. The first source has higher precedence
than the second source and so on.
<P></P></UL>The same order of precedence applies in the case of renderable
chains, i.e., RenderableOp nodes, with the exception of item 4, viz.,
properties created within the contextual rendering of the RenderableOp are not
propagated back to the RenderableOp node itself.
<P>There are a couple of important items to note at this point. First, when a
node is created with another node or nodes as its source(s), it might invoke
methods on the source node that force the source node to be rendered.
Consequently properties should be set on a node before it is used as the
source of other operations. Second, the rendering of a node does <EM>not</EM>
inherit the properties of the node itself nor are properties set on the
rendering of the node propagated back to the node. Image properties are
controlled and generated by the <CODE>PropertySource</CODE> and
<CODE>PropertyGenerator</CODE> interfaces.
<P><A name=52071>
<H3>11.1.1 <IMG src="Image Properties.files/space.gif">The PropertySource
Interface</H3></A>The <CODE>PropertySource</CODE> interface contains methods
from the <CODE>RenderedImage</CODE> and <CODE>RenderableImage</CODE>
interfaces that identify and read properties. <CODE>PlanarImage</CODE>,
<CODE>RenderableOp</CODE>, and <CODE>RenderedOp</CODE> all implement
<CODE>PropertySource</CODE>.
<P>The interface consists of the <CODE>getProperty</CODE> and
<CODE>getPropertyNames</CODE> methods familiar from the
<CODE>RenderedImage</CODE> and <CODE>RenderableImage</CODE> interfaces.
<P><CODE>PropertySource</CODE> is implemented by <CODE>ImageJAI</CODE>. Since
all RenderedImages used within JAI are descendents of <CODE>PlanarImage</CODE>
which implements <CODE>ImageJAI</CODE>, all images may be assumed to implement
<CODE>PropertySource</CODE>.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Properties.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.PropertySource </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>String[] getPropertyNames()
<P></P></LI></UL></PRE>
<DL><A name=51562>
<DT>
<DD>returns an array of <CODE>Strings</CODE> recognized as names by this
property source. </A>
<P></P></DD></DL><PRE><UL>
<LI>String[] getPropertyNames(String prefix)
<P></P></LI></UL></PRE>
<DL><A name=51576>
<DT>
<DD>returns an array of <CODE>Strings</CODE> recognized as names by this
property source that begin with the supplied <CODE>prefix</CODE>. If the
method cannot find any property names that match, null is returned. </A>
<P></P></DD></DL><PRE><UL>
<LI>Object getProperty(String name)
<P></P></LI></UL></PRE>
<DL><A name=51608>
<DT>
<DD>returns the value of a property.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD>Parameters:<EM></EM>
<P></P>
<TD><CODE>name</CODE>
<P></P>
<TD>The name of the property, as a <CODE>String</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><A name=51630>
<H3>11.1.2 <IMG src="Image Properties.files/space.gif">The PropertyGenerator
Interface</H3></A>The <CODE>PropertyGenerator</CODE> interface allows you to
affect the property inheritance computation of an operation. A
<CODE>PropertyGenerator</CODE> simply implements two methods:
<P>
<UL>
<LI>The <CODE>getPropertyNames</CODE> method returns a list of the names of
all available properties.
<P></P></LI></UL>
<UL>
<LI>The <CODE>getProperty</CODE> method returns the value of the property,
given the property name and a <CODE>RenderedOp</CODE>.
<P></P></LI></UL>New <CODE>PropertyGenerators</CODE> may be added to the
<CODE>OperationRegistry</CODE> to be applied at a particular operation node.
The <CODE>OperationRegistry</CODE> also allows an existing property on a node
to be suppressed if it is no longer useful. See <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#47285">Chapter
14, "Extending the API</A>," for more information on the
<CODE>OperationRegistry</CODE>.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Properties.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.PropertyGenerator </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>String[] getPropertyNames()
<P></P></LI></UL></PRE>
<DL><A name=51677>
<DT>
<DD>returns an array of <CODE>Strings</CODE> naming properties emitted by
this property generator. </A>
<P></P></DD></DL><PRE><UL>
<LI>Object getProperty(String name, RenderedOp op)
<P></P></LI></UL></PRE>
<DL><A name=51692>
<DT>
<DD>computes the value of a property relative to an environment of
pre-existing properties emitted by the sources of a <CODE>RenderedOp</CODE>,
and the parameters of that operation.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:<EM></EM>
<P></P>
<TD><CODE>name</CODE>
<P></P>
<TD>The name of the property, as a <CODE>String</CODE>.
<P></P>
<TR vAlign=top>
<TD><CODE>op</CODE>
<P></P>
<TD>The <CODE>RenderedOp</CODE> representing the operation.
<P></P></TR></TBODY></TABLE></A>
<P><A name=51735></P>
<DT>
<DD>The operation name, sources, and <CODE>ParameterBlock</CODE> of the
<CODE>RenderedOp</CODE> being processed may be obtained by means of the
<CODE>op.getOperationName</CODE>, <CODE>op.getSources()</CODE>, and
<CODE>op.getParameterBlock()</CODE> methods. It is legal to call
<CODE>getProperty()</CODE> on the operation's sources. </A>
<P></P></DD></DL><A name=52095>
<H2>11.2 <IMG src="Image Properties.files/space.gif">Synthetic
Properties</H2></A>Certain properties are <EM>synthesized</EM> when a node is
rendered. These synthetic properties are image width
(<CODE>image_width</CODE>), image height (<CODE>image_height</CODE>), minimum
<EM>x</EM> coordinate (<CODE>image_min_x_coord</CODE>), and minimum <EM>y</EM>
coordinate (<CODE>image_min_y_coord</CODE>). All of these properties have a
value of class <CODE>java.lang.Integer</CODE>. These properties are fixed and
any attempt to set them will result in an error.
<P><A name=51632>
<H2>11.3 <IMG src="Image Properties.files/space.gif">Regions of
Interest</H2></A>The specification of a region of interest (ROI) is a common
property that is supported by all of the standard operators. The ROI is simply
a description of some portion of an image. This description is propogated,
along with the image, through the rendering chain. The ROI is transformed
appropriately (inherited) for all geometric and area operators. For all other
types of operations it is simply copied. The ROI has no bearing on the
processing of image pixels, although in its rendered form it can be used as
input to histogram operations. For more information, see <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-manipulation.doc.html#51458">Section
6.2, "Region of Interest Control</A>."
<P>The ROI may be used as an argument to the <CODE>TiledImage.set</CODE> and
<CODE>TiledImage.setData</CODE> methods so as to copy a selected area of a
source or <CODE>Raster</CODE> into an existing <CODE>TiledImage</CODE> (see <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Acquisition.doc.html#52363">Section
4.2.2, "Tiled Image</A>"<CODE>)</CODE>. The ROI may also be used as an
argument to many compositing (see <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#61005">Section
7.11.2, "Image Compositing</A>") and statistical operators (see <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Analysis.doc.html#55366">Chapter
9, "Image Analysis</A>").
<P><A name=52134>
<H2>11.4 <IMG src="Image Properties.files/space.gif">Complex Data</H2></A>The
COMPLEX property has value of class <CODE>java.lang.Boolean</CODE> and
indicates whether the pixel values of an image represent complex-value data.
(A complex-valued image wherein each pixel has N complex elements contains 2N
bands with the real and imaginary components of the <EM>i</EM>th complex
element being stored in bands 2i and 2i + 1, respectively.) This property may
be <EM>produced</EM> by a given node either with a fixed value or with a value
dependent on the parameters of the node. See <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#59829">Section
7.9, "Frequency Domain Processing</A>."
<P>
<P>
<HR>
<BR>
<CENTER><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/JAITOC.fm.html"><IMG
alt=Contents src="Image Properties.files/contents.gif"></A> <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Graphics.doc.html"><IMG
alt=Previous src="Image Properties.files/previous.gif"></A> <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Client-server.doc.html"><IMG
alt=Next src="Image Properties.files/next.gif"></A>
<P><FONT size=5><I>Programming in Java Advanced Imaging</I></FONT>
</CENTER><BR>
<H5><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/copyright.html">Copyright</A>
© 1999, Sun Microsystems, Inc. All rights reserved.</H5><!-- Last updated: Tue Nov 02 18:06:08 1999 --></BLOCKQUOTE>
<SCRIPT language=JavaScript
src="Image Properties.files/s_code_remote.js"></SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -