| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 --> |
| <title>PixelIterator (Apache SIS 1.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2019-09-20"> |
| <meta name="keywords" content="org.apache.sis.image.PixelIterator class"> |
| <meta name="keywords" content="create()"> |
| <meta name="keywords" content="isWritable()"> |
| <meta name="keywords" content="getTransferType()"> |
| <meta name="keywords" content="getSampleRanges()"> |
| <meta name="keywords" content="getNumBands()"> |
| <meta name="keywords" content="getDomain()"> |
| <meta name="keywords" content="getPosition()"> |
| <meta name="keywords" content="moveTo()"> |
| <meta name="keywords" content="next()"> |
| <meta name="keywords" content="getSample()"> |
| <meta name="keywords" content="getSampleFloat()"> |
| <meta name="keywords" content="getSampleDouble()"> |
| <meta name="keywords" content="getPixel()"> |
| <meta name="keywords" content="createWindow()"> |
| <meta name="keywords" content="rewind()"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="PixelIterator (Apache SIS 1.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":9,"i1":6,"i2":10,"i3":10,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":10,"i12":10,"i13":10,"i14":6,"i15":6,"i16":6}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = false; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/PixelIterator.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.sis.image</a></div> |
| <h2 title="Class PixelIterator" class="title">Class PixelIterator</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>PixelIterator</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><code><a href="WritablePixelIterator.html" title="class in org.apache.sis.image">WritablePixelIterator</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public abstract class <span class="typeNameLabel">PixelIterator</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></pre> |
| <div class="block">An iterator over sample values in a raster or an image. This iterator makes easier to read and write efficiently |
| pixel or sample values. The iterator <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true#getTile(int,int)" title="class or interface in java.awt.image" class="externalLink">acquires tiles</a> and releases them |
| automatically. Unless otherwise specified, iterators are free to use an <a href="#getIterationOrder()">iteration |
| order</a> that minimize the "acquire / release tile" operations (in other words, iterations are not necessarily from |
| left to right). Iteration can be performed on a complete image or only a sub-region of it. Some optimized iterator |
| implementations exist for a few commonly used <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/SampleModel.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">sample models</a>. |
| |
| <div class="note"><b>Example:</b> |
| <blockquote><pre>PixelIterator it = PixelIterator.<b>create</b>(image); |
| <font color="green">double</font>[] samples = <font color="green">null</font>; |
| <font color="green">while</font> (it.<b>next</b>()) { |
| samples = it.<b>getPixel</b>(samples); <i><font color="gray">// Get values in all bands.</font></i> |
| <i><font color="gray">// Perform computation here...</font></i> |
| }</pre></blockquote> |
| </div></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| |
| <p><font size="-1">Defined in the <code>sis-feature</code> module</font></p> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Class</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PixelIterator.Builder.html" title="class in org.apache.sis.image">PixelIterator.Builder</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">Builds pixel iterators for specified region of interest, window size or iteration order.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a><<a href="PixelIterator.Window.html" title="type parameter in PixelIterator.Window">T</a> extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>></span></code></th> |
| <td class="colLast"> |
| <div class="block">Contains the sample values in a moving window over the image.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <a href="PixelIterator.html" title="class in org.apache.sis.image">PixelIterator</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(java.awt.image.RenderedImage)">create</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">RenderedImage</a> data)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates an iterator for all pixels in the given image.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>abstract <T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>><br><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a><T></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createWindow(org.apache.sis.image.TransferType)">createWindow</a></span>​(<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a><T> type)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a moving window over the sample values in a rectangular region starting at iterator position.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt" class="externalLink">Rectangle</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDomain()">getDomain</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the pixel coordinates of the region where this iterator is doing the iteration.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNumBands()">getNumBands</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>abstract double[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(double%5B%5D)">getPixel</a></span>​(double[] dest)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample values of current pixel for all bands.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>abstract float[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(float%5B%5D)">getPixel</a></span>​(float[] dest)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample values of current pixel for all bands.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>abstract int[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(int%5B%5D)">getPixel</a></span>​(int[] dest)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample values of current pixel for all bands.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Point.html?is-external=true" title="class or interface in java.awt" class="externalLink">Point</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPosition()">getPosition</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the column (x) and row (y) indices of the current pixel.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>abstract int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSample(int)">getSample</a></span>​(int band)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample value in the specified band of current pixel, rounded toward zero.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>abstract double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleDouble(int)">getSampleDouble</a></span>​(int band)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample value in the specified band of current pixel, without precision lost.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>abstract float</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleFloat(int)">getSampleFloat</a></span>​(int band)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sample value in the specified band of current pixel as a single-precision floating point number.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="../measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a><?>[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleRanges()">getSampleRanges</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the range of sample values that can be stored in each band of the rendered image or raster.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code><a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a><?></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTransferType()">getTransferType</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the most efficient type (<code>int</code>, <code>float</code> or <code>double</code>) for transferring data between the |
| underlying rasters and this iterator.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isWritable()">isWritable</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns <code>true</code> if this iterator can write pixel values (after cast to <code>WritablePixelIterator</code>).</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>abstract void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#moveTo(int,int)">moveTo</a></span>​(int x, |
| int y)</code></th> |
| <td class="colLast"> |
| <div class="block">Moves the pixel iterator to the given column (x) and row (y) indices.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>abstract boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#next()">next</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Moves the iterator to the next pixel.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>abstract void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rewind()">rewind</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Restores the iterator to the start position.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="create(java.awt.image.RenderedImage)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>create</h4> |
| <pre class="methodSignature">public static <a href="PixelIterator.html" title="class in org.apache.sis.image">PixelIterator</a> create​(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">RenderedImage</a> data)</pre> |
| <div class="block">Creates an iterator for all pixels in the given image. |
| This is a convenience method for <code>new Builder().create(data)</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - the image which contains the sample values on which to iterate.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a new iterator traversing all pixels in the given image, in arbitrary order.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isWritable()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isWritable</h4> |
| <pre class="methodSignature">public boolean isWritable()</pre> |
| <div class="block">Returns <code>true</code> if this iterator can write pixel values (after cast to <code>WritablePixelIterator</code>). |
| This method should be used instead than <code>instanceof</code> check because, for some implementations, being |
| an instance of <code>WritablePixelIterator</code> is not a sufficient condition.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if this iterator can safely be casted to <a href="WritablePixelIterator.html" title="class in org.apache.sis.image"><code>WritablePixelIterator</code></a> and used for |
| writing pixel values.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getTransferType()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTransferType</h4> |
| <pre class="methodSignature">public <a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a><?> getTransferType()</pre> |
| <div class="block">Returns the most efficient type (<code>int</code>, <code>float</code> or <code>double</code>) for transferring data between the |
| underlying rasters and this iterator. The transfer type is not necessarily the storage type used by the rasters. |
| For example <code>int</code> values will be used for transferring data even if the underlying rasters store all sample |
| values as <code>byte</code>s. |
| |
| <p>The transfer type is only a hint since all iterator methods work for any type (conversions are applied as needed). |
| However if this method returns <a href="TransferType.html#INT"><code>TransferType.INT</code></a>, then <a href="#getSample(int)"><code>getSample(int)</code></a> and <a href="#getPixel(int%5B%5D)"><code>getPixel(int[])</code></a> |
| will be slightly more efficient than equivalent methods for other types. Conversely if this method returns |
| <a href="TransferType.html#DOUBLE"><code>TransferType.DOUBLE</code></a>, then <a href="#getSampleDouble(int)"><code>getSampleDouble(int)</code></a> will be both more efficient and avoid accuracy lost.</p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the most efficient data type for transferring data.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSampleRanges()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSampleRanges</h4> |
| <pre class="methodSignature">public <a href="../measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a><?>[] getSampleRanges()</pre> |
| <div class="block">Returns the range of sample values that can be stored in each band of the rendered image or raster. |
| The ranges depend on the data type (byte, integer, <i>etc.</i>) and the number of bits per sample. |
| If the samples are stored as floating point values, then the ranges are infinite (unbounded). |
| |
| <p>Usually, the range is the same for all bands. A situation where the ranges may differ is when an |
| image uses <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/SinglePixelPackedSampleModel.html?is-external=true" title="class or interface in java.awt.image" class="externalLink"><code>SinglePixelPackedSampleModel</code></a>, in which case the number of bits per pixel may vary |
| for different bands.</p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the ranges of valid sample values for each band. Ranges may be <a href="../measure/Range.html#isBounded()">unbounded</a>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getNumBands()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNumBands</h4> |
| <pre class="methodSignature">public int getNumBands()</pre> |
| <div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>number of bands.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getDomain()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDomain</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt" class="externalLink">Rectangle</a> getDomain()</pre> |
| <div class="block">Returns the pixel coordinates of the region where this iterator is doing the iteration. |
| If no region was specified at construction time, then this method returns the image or raster bounds.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>pixel coordinates of the iteration region.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getPosition()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPosition</h4> |
| <pre class="methodSignature">public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Point.html?is-external=true" title="class or interface in java.awt" class="externalLink">Point</a> getPosition()</pre> |
| <div class="block">Returns the column (x) and row (y) indices of the current pixel. |
| The <a href="#next()"><code>next()</code></a> or <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have been invoked before this method. |
| Indices of the first pixel are not necessarily zero; they can even be negative.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>column and row indices of current iterator position.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code> - if this method is invoked before the first call to <a href="#next()"><code>next()</code></a> |
| or <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a>, or after <code>next()</code> returned <code>false</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="moveTo(int,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>moveTo</h4> |
| <pre class="methodSignature">public abstract void moveTo​(int x, |
| int y)</pre> |
| <div class="block">Moves the pixel iterator to the given column (x) and row (y) indices. After this method invocation, |
| the iterator state is as if the <a href="#next()"><code>next()</code></a> method has been invoked just before to reach the |
| specified position. |
| |
| <div class="note"><b>Usage example:</b> |
| <blockquote><pre>iterator.<b>moveTo</b>(x, y); |
| <font color="green">do</font> { |
| <font color="green">int</font> sample = iterator.<b>getSample</b>(band); |
| <i><font color="gray">// Use sample value here...</font></i> |
| } <font color="green">while</font> (iterator.<b>next</b>());</pre></blockquote> |
| </div></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>x</code> - the column index of the pixel to make current.</dd> |
| <dd><code>y</code> - the row index of the pixel to make current.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the given indices are outside the iteration domain.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="next()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>next</h4> |
| <pre class="methodSignature">public abstract boolean next()</pre> |
| <div class="block">Moves the iterator to the next pixel. A pixel iterator is initially positioned before the first pixel. |
| The first call to <code>next()</code> makes the first pixel the current one; the second call makes the second |
| pixel the current one, <i>etc.</i> The second pixel is not necessarily on the same row than the first one; |
| iteration order is implementation dependent. |
| |
| <p>When a call to <code>next()</code> returns <code>false</code>, the iterator is positioned after the last pixel. |
| Any invocation of a <code>getSample(int)</code> method will result in a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>NoSuchElementException</code></a> to be |
| thrown.</p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the current pixel is valid, or <code>false</code> if there is no more pixels.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code> - if this iterator already reached end of iteration in a previous call |
| to <code>next()</code>, and <a href="#rewind()"><code>rewind()</code></a> or <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> have not been invoked.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSample(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSample</h4> |
| <pre class="methodSignature">public abstract int getSample​(int band)</pre> |
| <div class="block">Returns the sample value in the specified band of current pixel, rounded toward zero. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getSample(int)</code> method is invoked. If above condition is not met, |
| then this method behavior is undefined: it may throw any runtime exception or return a meaningless value |
| (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>band</code> - the band for which to get the sample value.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>sample value in specified band of current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSample(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getSample(int, int, int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSampleFloat(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSampleFloat</h4> |
| <pre class="methodSignature">public abstract float getSampleFloat​(int band)</pre> |
| <div class="block">Returns the sample value in the specified band of current pixel as a single-precision floating point number. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getSampleFloat(int)</code> method is invoked. If above condition is |
| not met, then this method behavior is undefined: it may throw any runtime exception or return a meaningless |
| value (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>band</code> - the band for which to get the sample value.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>sample value in specified band of current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSampleFloat(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getSampleFloat(int, int, int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSampleDouble(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSampleDouble</h4> |
| <pre class="methodSignature">public abstract double getSampleDouble​(int band)</pre> |
| <div class="block">Returns the sample value in the specified band of current pixel, without precision lost. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getSampleDouble(int)</code> method is invoked. If above condition is |
| not met, then this method behavior is undefined: it may throw any runtime exception or return a meaningless |
| value (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>band</code> - the band for which to get the sample value.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>sample value in specified band of current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSampleDouble(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getSampleDouble(int, int, int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getPixel(int[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPixel</h4> |
| <pre class="methodSignature">public abstract int[] getPixel​(int[] dest)</pre> |
| <div class="block">Returns the sample values of current pixel for all bands. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getPixel(…)</code> method is invoked. If above condition is not met, |
| then this method behavior is undefined: it may throw any runtime exception or return a meaningless value |
| (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the sample values for current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,int%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getPixel(int, int, int[])</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getPixel(float[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPixel</h4> |
| <pre class="methodSignature">public abstract float[] getPixel​(float[] dest)</pre> |
| <div class="block">Returns the sample values of current pixel for all bands. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getPixel(…)</code> method is invoked. If above condition is not met, |
| then this method behavior is undefined: it may throw any runtime exception or return a meaningless value |
| (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the sample values for current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,float%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getPixel(int, int, float[])</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getPixel(double[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPixel</h4> |
| <pre class="methodSignature">public abstract double[] getPixel​(double[] dest)</pre> |
| <div class="block">Returns the sample values of current pixel for all bands. |
| The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> method must have |
| been invoked successfully, before this <code>getPixel(…)</code> method is invoked. If above condition is not met, |
| then this method behavior is undefined: it may throw any runtime exception or return a meaningless value |
| (there is no explicit bounds check for performance reasons).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the sample values for current pixel.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,double%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getPixel(int, int, double[])</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createWindow(org.apache.sis.image.TransferType)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createWindow</h4> |
| <pre class="methodSignature">public abstract <T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>> <a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a><T> createWindow​(<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a><T> type)</pre> |
| <div class="block">Returns a moving window over the sample values in a rectangular region starting at iterator position. |
| The <cite>window size</cite> must have been specified at <code>PixelIterator</code> construction time. |
| The current iterator position is the window corner having the smallest <var>x</var> and <var>y</var> coordinates. |
| This is typically, but not necessarily (depending on axis orientations) the window upper-left corner. |
| Sample values are stored in a sequence of length |
| <var>(number of bands)</var> × <var>(window width)</var> × <var>(window height)</var>. |
| Values are always stored with band index varying fastest, then column index, then row index. |
| Columns are traversed from left to right and rows are traversed from top to bottom |
| (linear iteration order). |
| That order is the same regardless the <a href="#getIterationOrder()">iteration order</a> of this iterator. |
| |
| <div class="note"><b>Example:</b> |
| for an RGB image, the 3 first values are the red, green and blue components of the pixel at |
| <a href="#getPosition()">current iterator position</a>. The 3 next values are the red, green |
| and blue components of the pixel at the right of current iterator position (not necessarily |
| the position where a call to <a href="#next()"><code>next()</code></a> would have go), <i>etc.</i></div> |
| |
| Calls to <a href="#next()"><code>next()</code></a> or <a href="#moveTo(int,int)"><code>moveTo(int,int)</code></a> followed by <a href="PixelIterator.Window.html#update()"><code>PixelIterator.Window.update()</code></a> |
| replaces the window content with values starting at the new iterator position. |
| Before the first <a href="PixelIterator.Window.html#update()"><code>PixelIterator.Window.update()</code></a> invocation, the window is filled with zero values. |
| |
| <p>If this iterator is used for |
| <a href="WritablePixelIterator.html#setPixel(int%5B%5D)">writing pixel values at current position</a>, |
| those write operations may change the content of windows at <a href="#next()">next positions</a> |
| unless the iteration order of this iterator is <code>SequenceType.LINEAR</code>.</p> |
| |
| <div class="note"><b>Usage example:</b> |
| following code creates an iterator over the full area of given image, then a window of 5×5 pixels. |
| The window is moved over all the image area in iteration order. Inside the window, data are copied |
| in linear order regardless the iteration order. |
| |
| <blockquote><pre>PixelIterator it = <b>create</b>(image, <font color="green">null</font>, <font color="green">new</font> <b>Dimension</b>(5, 5), <font color="green">null</font>); <i><font color="gray">// Windows size will be 5×5 pixels.</font></i> |
| PixelIterator<FloatBuffer> window = it.<b>createWindow</b>(TransferType.FLOAT); |
| FloatBuffer values = window.values; |
| <font color="green">while</font> (it.<b>next</b>()) { |
| window.<b>update</b>(); |
| <font color="green">while</font> (buffer.<b>hasRemaining</b>()) { |
| <font color="green">float</font> sample = buffer.<b>get</b>(); |
| <i><font color="gray">// use the sample value here.</font></i> |
| } |
| }</pre></blockquote> |
| </div></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the type of the data buffer to use for transferring data.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>type</code> - the desired type of values (<code>int</code>, <code>float</code> or <code>double</code>). |
| Use <a href="#getTransferType()"><code>getTransferType()</code></a> if the most efficient type is desired.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a window over the sample values in the underlying image or raster.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixels(int,int,int,int,double%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster.getPixels(int, int, int, int, double[])</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="rewind()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>rewind</h4> |
| <pre class="methodSignature">public abstract void rewind()</pre> |
| <div class="block">Restores the iterator to the start position. After this method has been invoked, |
| the iterator is in the same state than after construction.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/PixelIterator.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2010–2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |