📄 image manipulation.htm
字号:
<DT>
<DD>transforms an <CODE>ROI</CODE> using an imaging operation. The operation
is specified by a <CODE>RenderedImageFactory</CODE>. The operation's
<CODE>ParameterBlock</CODE>, minus the image source itself is supplied,
along with an index indicating where to insert the <CODE>ROI</CODE> image.
Rendering hints are taken to be null.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=3><EM>Parameters</EM>:
<P></P>
<TD><CODE>RIF</CODE>
<P></P>
<TD>A <CODE>RenderedImageFactory</CODE> that will be used to create
the op.
<P></P>
<TR vAlign=top>
<TD><CODE>paramBlock</CODE>
<P></P>
<TD>A <CODE>ParameterBlock</CODE> containing all sources and
parameters for the operation except for the <CODE>ROI</CODE> itself.
<P></P>
<TR vAlign=top>
<TD><CODE>sourceIndex</CODE>
<P></P>
<TD>The index of the <CODE>ParameterBlock</CODE>'s sources where the
<CODE>ROI</CODE> is to be inserted.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>ROI performImageOp(String name, ParameterBlock paramBlock,
int sourceIndex, Hashtable renderHints,
Hashtable renderHintsObserved)
<P></P></LI></UL></PRE>
<DL><A name=54445>
<DT>
<DD>transforms an <CODE>ROI</CODE> using an imaging operation. The operation
is specified by name; the default JAI registry is used to resolve this into
a RIF. The operation's <CODE>ParameterBlock</CODE>, minus the image source
itself is supplied, along with an index indicating where to insert the
<CODE>ROI</CODE> image. The usual <CODE>renderHints</CODE> and
<CODE>renderHintsObserved</CODE> arguments allow rendering hints to be
passed in and information on which hints were followed to be passed out.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=5><EM>Parameters</EM>:
<P></P>
<TD><CODE>name</CODE>
<P></P>
<TD>The name of the operation to be performed.
<P></P>
<TR vAlign=top>
<TD><CODE>paramBlock</CODE>
<P></P>
<TD>A <CODE>ParameterBlock</CODE> containing all sources and
parameters for the operation except for the <CODE>ROI</CODE> itself.
<P></P>
<TR vAlign=top>
<TD><CODE>sourceIndex</CODE>
<P></P>
<TD>The index of the <CODE>ParameterBlock</CODE>'s sources where the
<CODE>ROI</CODE> is to be inserted.
<P></P>
<TR vAlign=top>
<TD><CODE>renderHints</CODE>
<P></P>
<TD>A Hashtable of rendering hints.
<P></P>
<TR vAlign=top>
<TD><CODE>renderHints-Observed</CODE>
<P></P>
<TD>A Hashtable of observed rendering hints.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>ROI performImageOp(String name, ParameterBlock paramBlock,
int sourceIndex)
<P></P></LI></UL></PRE>
<DL><A name=54472>
<DT>
<DD>transforms an <CODE>ROI</CODE> using an imaging operation. The operation
is specified by name; the default JAI registry is used to resolve this into
a RIF. The operation's <CODE>ParameterBlock</CODE>, minus the image source
itself is supplied, along with an index indicating where to insert the ROI
image. Rendering hints are taken to be null.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=3><EM>Parameters</EM>:
<P></P>
<TD><CODE>name</CODE>
<P></P>
<TD>The name of the operation to be performed.
<P></P>
<TR vAlign=top>
<TD><CODE>paramBlock</CODE>
<P></P>
<TD>A <CODE>ParameterBlock</CODE> containing all sources and
parameters for the operation except for the <CODE>ROI</CODE> itself.
<P></P>
<TR vAlign=top>
<TD><CODE>sourceIndex</CODE>
<P></P>
<TD>The index of the <CODE>ParameterBlock</CODE>'s sources where the
<CODE>ROI</CODE> is to be inserted.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>Shape getAsShape()
<P></P></LI></UL></PRE>
<DL><A name=54490>
<DT>
<DD>returns a Shape representation of the <CODE>ROI</CODE>, if possible. If
none is available, null is returned. A proper instance of <CODE>ROI</CODE>
(one that is not an instance of any subclass of <CODE>ROI</CODE>) will
always return null. </A>
<P></P></DD></DL><PRE><UL>
<LI>PlanarImage getAsImage()
<P></P></LI></UL></PRE>
<DL><A name=54515>
<DT>
<DD>returns a <CODE>PlanarImage</CODE> representation of the
<CODE>ROI</CODE>. This method will always succeed. </A>
<P></P></DD></DL><A name=53075>
<H3>6.2.2 <IMG src="Image Manipulation.files/space.gif">The ROIShape
Class</H3></A>The <CODE>ROIShape</CODE> class is used to store a region of
interest within an image as an instance of a <CODE>java.awt.Shape</CODE>. Such
regions are binary by definition. Using a <CODE>Shape</CODE> representation
allows Boolean operations to be performed quickly and with compact storage. If
a <CODE>PropertyGenerator</CODE> responsible for generating the
<CODE>ROI</CODE> property of a particular <CODE>OperationDescriptor</CODE>
(such as a <CODE>warp</CODE>) cannot reasonably produce an
<CODE>ROIShape</CODE> representing the region, it should call the
<CODE>getAsImage()</CODE> method on its sources and produce its output
<CODE>ROI</CODE> in image form.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.ROIShape </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>ROIShape(Shape s)
<P></P></LI></UL></PRE>
<DL><A name=53871>
<DT>
<DD>constructs an <CODE>ROIShape</CODE> from a <CODE>Shape</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>s</CODE>
<P></P>
<TD>A <CODE>Shape</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>ROIShape(Area a)
<P></P></LI></UL></PRE>
<DL><A name=53875>
<DT>
<DD>constructs an <CODE>ROIShape</CODE> from an <CODE>Area</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>a</CODE>
<P></P>
<TD>An <CODE>Area</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><A name=55291>
<H4>6.2.2.1 <IMG src="Image Manipulation.files/space.gif">Determining the ROI
Bounds</H4></A>The following methods in the <CODE>ROIShape</CODE> class read
the bounds of the <CODE>ROI</CODE>.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.ROIShape </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>Rectangle getBounds()
<P></P></LI></UL></PRE>
<DL><A name=53752>
<DT>
<DD>returns the bounds of the ROI as a <CODE>Rectangle</CODE>. </A>
<P></P></DD></DL><PRE><UL>
<LI>Rectangle2D getBounds2D()
<P></P></LI></UL></PRE>
<DL><A name=53756>
<DT>
<DD>returns the bounds of the ROI as a <CODE>Rectangle2D</CODE>. </A>
<P></P></DD></DL><A name=55317>
<H4>6.2.2.2 <IMG src="Image Manipulation.files/space.gif">Determining if an
Area Lies Within or Intersects the ROIShape</H4></A>The
<CODE>ROIShape.contains</CODE> method is used to determine if a given pixel
lies within the region of interest. The <CODE>ROIShape.intersects</CODE>
method is used to determine if a rectangular region of the image intersects
the ROI.<CODE></CODE>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.ROIShape </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>boolean contains(Point p)
<P></P></LI></UL></PRE>
<DL><A name=53760>
<DT>
<DD>returns true if the pixel lies within the <CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>p</CODE>
<P></P>
<TD>The coordinates of the pixel to be queried.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean contains(Point2D p)
<P></P></LI></UL></PRE>
<DL><A name=53764>
<DT>
<DD>returns true if the pixel lies within the <CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>p</CODE>
<P></P>
<TD>The coordinates of the pixel to be queried.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean contains(int x, int y)
<P></P></LI></UL></PRE>
<DL><A name=53768>
<DT>
<DD>returns true if the pixel lies within the <CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>x</CODE>
<P></P>
<TD>The <EM>x</EM> coordinate of the pixel to be queried.
<P></P>
<TR vAlign=top>
<TD><CODE>y</CODE>
<P></P>
<TD>The <EM>y</EM> coordinate of the pixel to be queried.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean contains(double x, double y)
<P></P></LI></UL></PRE>
<DL><A name=53772>
<DT>
<DD>returns true if the pixel lies within the <CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>x</CODE>
<P></P>
<TD>The <EM>x</EM> coordinate of the pixel to be queried.
<P></P>
<TR vAlign=top>
<TD><CODE>y</CODE>
<P></P>
<TD>The <EM>y</EM> coordinate of the pixel to be queried.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean contains(Rectangle rect)
<P></P></LI></UL></PRE>
<DL><A name=53776>
<DT>
<DD>returns true if the rectangular region is entirely contained within the
<CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>rect</CODE>
<P></P>
<TD>The region to be tested for inclusion.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean contains(Rectangle2D r)
<P></P></LI></UL></PRE>
<DL><A name=53780>
<DT>
<DD>returns true if the rectangular region is entirely contained within the
<CODE>ROI</CODE>.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>r</CODE>
<P></P>
<TD>The region to be tested for inclusion.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -