Difference between revisions of "PlugIn Algorithm Median (con't, part 3)"

From MIPAV
Jump to: navigation, search
(Created page with '{| 804 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (numberOfSlices > 1...')
 
 
Line 1: Line 1:
 
{|
 
{|
 
804 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (numberOfSlices &gt; 1) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">3D image update progressBar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 805 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">do a progress bar update</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 806 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 807 (( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)(currentSlice*iterations pass)/<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 808 (iterations*numberOfSlices))* 100)));<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 809 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 810 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 811 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = 0; i &lt; imageSliceLength &amp;&amp; !threadStopped; i ){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 812 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (numberOfSlices == 1) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D image update progressBar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 813 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 814 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 815 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)( (pass*imageSliceLength) i)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 816 /(iterations*(imageSliceLength -1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 817 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 818 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 819 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(a) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 820 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 821 row = i/width;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 822 col = i%width;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 823 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 824 destBuffer[a] = srcBuffer[a]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 825 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 826 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 827 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((col &lt; leftBound) || (col &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 828 destBuffer[a] = srcBuffer[a]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 829 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // -out of </font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 830 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 831 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 832 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 833 maskedList = getNeighborList(a, srcBuffer, true);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 834 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 835 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 836 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 837 destBuffer[a] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 838 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 839 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 840 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 841 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 842 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 843 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 844 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 845 destBuffer[a] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 846 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 847 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 848 destBuffer[a] = srcBuffer[a];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 849 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 850 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 851 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 852 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 853 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this into the destination</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 854 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 855 destBuffer[a] = srcBuffer[a];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 856 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 857 a ; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// address the next data element from the bufferStartingPoint</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 858 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 859 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 860 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 861 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 862 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 863 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 864 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap dest &amp; src buffers</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 865 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 866 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 867 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 868 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 869 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// destBuffer should now be copied over for the size of imageSliceLength. </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 870 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // You may return.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 871 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 872 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 873 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 874 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 875 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Filter a 3D image with a 3D kernel. Allows median filtering to include the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 876 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * picture elements at greater depths than only the current slice.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 877 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * &lt;p&gt;&lt;em&gt;Note that this volume filter will correctly filter color images on all</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 878 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * bands (aRGB) because the neighbor list is correct (see getNeighborList()). </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 879 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * This means, however, it will not selectivly filter any bands (one may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 880 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * filter only the Red channel, for instance), and will also filter all alpha</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 881 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * values as well. Of course, progress bar updates will not include any</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 882 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * color information. For these reasons it a useable, but limited color</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 883 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * filter.&lt;/em&gt;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 884 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param srcBuffer Source image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 885 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param destBuffer Destination image.</font></span><br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 886 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see volumeColorFilter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 887 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see getNeighborList</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 888 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 889 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 890 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // some code has been left in to allow this method to properly filter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 891 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // color images, although the other method is included.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 892 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 893 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> volumeFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> srcBuffer[], <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> destBuffer[]) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 894 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> i, pass; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// counting the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 895 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> row, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// ease of reading to find the row, column and slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 896 column, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (all starting at 0) associated with the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 897 slice; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// [(0,0,0) starts at the closest upper-left corner]</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 898 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int </font>'''</span>imageSliceLength = srcImage.getSliceSize() * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 899 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageLength = imageSliceLength * numberOfSlices;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 900 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kCenter = maskCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 901 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> width = srcImage.getExtents()[0]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 902 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> height = srcImage.getExtents()[1]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// height of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 903 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceWidth = width*valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of intensity</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 904 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// values (as in colors per pixel (1 for</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 905 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mono, 4 for color))</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 906 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> tempBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 907 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 908 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> average; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// arithmetic mean</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 909 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> sigma; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// standard deviation</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 910 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 911 float maskedList[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// list of buffer-values that were showing inside the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 912 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mask these bounds "frame" the interior of the slice which may be filtered</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 913 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (&amp;adjusted); image outside the frame may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 914 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> leftBound, rightBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the column</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 915 upperBound, lowerBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the row</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 916 aheadBound, behindBound; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 917 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (a note on orientation: object front is facing in the same direction as</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 918 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // viewer, thus ahead of viewer is into monitor, behind is out of monitor and</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 919 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // a more positive number of slices is farther forward.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 920 upperBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 921 lowerBound = height - halfK -1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 922 behindBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 923 aheadBound = numberOfSlices - halfK - 1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 924 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// we may say that each column is a pixel intensity: mono images have 1 per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 925 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel, 4 in color;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 926 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// these calculations are done separately for color &amp; mono images in</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 927 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // sliceFilter().</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 928 leftBound = halfK * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 929 rightBound = sliceWidth - valuesPerPixel*halfK - 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in color:</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">(4*width - 4*halfK</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 930 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // - 1); mono: (width - </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 931 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // halfK - 1)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 932 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> mod = (imageLength)/100; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mod is 1 percent of length of slice * the number </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 933 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of slices.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 934 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 935 BitSet mask = srcImage.generateVOIMask();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 936 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">for</font></span> (pass = 0; pass &lt; iterations &amp;&amp; !threadStopped; pass ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 937 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 938 progressBar.setMessage("Filtering image (pass " String.valueOf(pass 1) " of " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 939 iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 940 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 941 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 942 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = 0; i &lt; imageLength &amp;&amp; !threadStopped; i ){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 943 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>(i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 944 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 945 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)( (pass*imageLength) i)/(iterations*(imageLength-1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 946 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 947 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 948 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(i/valuesPerPixel) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 949 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 950 slice = i/imageSliceLength;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 951 row = (i%imageSliceLength)/sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 952 column = i%sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 953 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 954 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 955 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 956 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 957 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 958 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((column &lt; leftBound) || (column &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 959 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right--out</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 960 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 961 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 962 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((slice &lt; behindBound) || (slice &gt; aheadBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 963 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice too far ahead or behind--out</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 964 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 965 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 966 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 967 maskedList = getNeighborList(i, srcBuffer, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span>);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 968 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 969 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 970 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 971 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 972 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 973 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { /<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/ look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 974 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 975 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 976 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 977 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 978 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 979 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 980 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 981 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 982 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 983 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 984 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 985 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 986 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 987 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 988 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // into the destination buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 989 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 990 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 991 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 992 /<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/ now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 993 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 994 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 995 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 996 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 997 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 998 }<br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 999 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1000 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1001 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1002 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Filter a Color 3D image with a 3D kernel. Allows median filtering to</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1003 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * include the picture elements at greater depths than only the current</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1004 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * slice. This method allows selected band filtering, and does not filter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1005 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * the alpha band.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1006 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param srcBuffer Source image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1007 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param destBuffer Destination image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1008 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see volumeFilter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1009 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1010 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1011 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> volumeColorFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> srcBuffer[], <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> destBuffer[]) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1012 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> i, pass; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// counting the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1013 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> initialIndex; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // reference to the color band being filtered/copied: aRBG:</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1014 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // 0, 1, 2, 3;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1015 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// it is an offset to the identified pixel, or column, of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1016 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1017 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> row, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// ease of reading to find the row, column and slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1018 column, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (all starting at 0) associated with the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1019 slice; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// [(0,0,0) starts at the closest upper-left corner]</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1020 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kCenter = maskCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1021 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> width = srcImage.getExtents()[0]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1022 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> height = srcImage.getExtents()[1]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// height of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1023 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceWidth = width*valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1024 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // intensity values (as in colors per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1025 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel (1 for mono, 4 for color))</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1026 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceSize = width * height; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in pixels (or elements</font></span>)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1027 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSliceLength = width * height * valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in values-pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1028 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSize = sliceSize * numberOfSlices; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in pixels (or elements)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1029 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageLength = imageSliceLength * numberOfSlices; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in (values-pixels)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1030 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> tempBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1031 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1032 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> average; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// arithmetic mean</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1033 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> sigma; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// standard deviation</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1034 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1035 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> maskedList[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// list of buffer-values that were showing inside the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1036 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mask</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1037 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// these bounds "frame" the interior of the slice which may be </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1038 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // filtered (&amp;adjusted); image outside the frame may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1039 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> leftBound, rightBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the column</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1040 upperBound, lowerBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the row</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1041 aheadBound, behindBound; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1042 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (a note on orientation: object front is facing in the same direction as</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1043 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // viewer, thus ahead of viewer is into monitor, behind is out of monitor and</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1044 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // a more positive number of slices is farther forward.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1045 upperBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1046 lowerBound = height - halfK -1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1047 behindBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1048 aheadBound = numberOfSlices - halfK - 1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1049 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// we may say that each column is a pixel intensity: mono images have 1 per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1050 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel, 4 in color; these calculations are done separately for color &amp; </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1051 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mono images in sliceFilter().</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1052 leftBound = halfK * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1053 rightBound = sliceWidth - valuesPerPixel*halfK - 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in color: (4*width - </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1054 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // 4*halfK - 1); mono: </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1055 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (width - halfK - 1)</font></span><br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1056 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> mod = (imageSize)/100; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mod is 1 percent of length of slice * the number </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1057 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of slices.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1058 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1059 BitSet mask = srcImage.generateVOIMask();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1060 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1061 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy all alpha values in the image</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1062 setCopyColorText("alpha");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1063 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = 0; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1064 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy alpha;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1065 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1066 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1067 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// choose i so the proper colors go alongside the initial index</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1068 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // so we get the right output statements in the progress bar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1069 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // copy only needed RGB values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1070 initialIndex = 0; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// start with alpha on each pass (routine moved so we don't</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1071 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">do it for each pass)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1072 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">while</font>'''</span> (initialIndex &lt; 3 &amp;&amp; !threadStopped) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// alpha:0, R:1, G:2, B:3. But</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1073 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // alpha must be copied</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1074 initialIndex; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// next initial index</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1075 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1076 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!rChannel &amp;&amp; initialIndex==1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1077 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image reds but we're not filtering the red</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1078 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // channel copy all red values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1079 setCopyColorText("red");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1080 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1081 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1082 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1083 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1084 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (!gChannel &amp;&amp; initialIndex==2) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image greens</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1085 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // but we're not filtering the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1086 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // greens channel copy all greens </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1087 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1088 setCopyColorText("green");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1089 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1090 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1091 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1092 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1093 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (!bChannel &amp;&amp; initialIndex==3) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1094 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image blues but we're not filtering the </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1095 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // blues channel copy all blue values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1096 setCopyColorText("blue");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1097 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1098 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1099 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1100 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1101 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1102 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (pass = 0; pass &lt; iterations &amp;&amp; !threadStopped; pass ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1103 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1104 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> if</font>'''</span> (initialIndex == 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1105 progressBar.setMessage("Filtering red channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1106 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1107 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1108 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> else if</font>'''</span> (initialIndex == 2) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1109 progressBar.setMessage("Filtering green channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1110 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1111 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1112 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1113 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (initialIndex == 3) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1114 progressBar.setMessage("Filtering blue channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1115 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1116 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1117 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1118 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if we needed to filter the image, we dropped through the </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1119 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // selection to filter the color given by ints initialIndex</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1120 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = initialIndex; i &lt; imageLength &amp;&amp; !threadStopped; i =4){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1121 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1122 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1123 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)(iterations*(initialIndex - 1)*imageSize imageSize*pass<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1124 i/4)/(3*iterations*(imageSize-1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1125 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1126 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1127 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(i/valuesPerPixel) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1128 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1129 slice = i/imageSliceLength;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1130 row = (i%imageSliceLength)/sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1131 column = i%sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1132 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1133 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1134 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1135 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1136 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1137 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((column &lt; leftBound) || (column &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1138 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right--</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1139 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // out of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1140 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1141 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((slice &lt; behindBound) || (slice &gt; aheadBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1142 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice too far ahead or behind--</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1143 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // out of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1144 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1145 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1146 maskedList = getNeighborList(i, srcBuffer, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span>);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1147 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1148 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1149 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1150 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1151 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1152 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1153 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1154 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1155 if ((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1156 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1157 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1158 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1159 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1160 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1161 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1162 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1163 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1164 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1165 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1166 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1167 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this into the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1168 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // destination buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1169 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1170 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1171 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1172 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1173 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1174 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1175 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1176 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1177 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1178 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1179 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1180 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (iterations%2 == 0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if even number of iterations, then</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1181 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer is necessary</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1182 destBuffer = srcBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// to keep other colors not-yet-filtered</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1183 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // from</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1184 srcBuffer = tempBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filtering from the wrong buffer,</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1185 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // overwriting the real src</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1186 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1187 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1188 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1189 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1190 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1191 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1192 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Forms kernel. Note that the &lt;bold&gt;kernel&lt;/bold&gt; uses the 0th place, unlike the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1193 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * kernelMask where counting starts at 1.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1194 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1195 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1196 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> makeKernel(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1197 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">try</font>'''</span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1198 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (sliceFiltering)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1199 kernel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new byte</font>'''</span>[kernelSize*kernelSize];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> |}
 
804 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (numberOfSlices &gt; 1) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">3D image update progressBar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 805 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">do a progress bar update</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 806 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 807 (( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)(currentSlice*iterations pass)/<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 808 (iterations*numberOfSlices))* 100)));<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 809 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 810 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 811 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = 0; i &lt; imageSliceLength &amp;&amp; !threadStopped; i ){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 812 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (numberOfSlices == 1) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D image update progressBar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 813 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 814 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 815 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)( (pass*imageSliceLength) i)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 816 /(iterations*(imageSliceLength -1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 817 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 818 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 819 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(a) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 820 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 821 row = i/width;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 822 col = i%width;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 823 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 824 destBuffer[a] = srcBuffer[a]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 825 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 826 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 827 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((col &lt; leftBound) || (col &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 828 destBuffer[a] = srcBuffer[a]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 829 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // -out of </font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 830 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 831 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 832 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 833 maskedList = getNeighborList(a, srcBuffer, true);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 834 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 835 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 836 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 837 destBuffer[a] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 838 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 839 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 840 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 841 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 842 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 843 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 844 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 845 destBuffer[a] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 846 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 847 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 848 destBuffer[a] = srcBuffer[a];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 849 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 850 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 851 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 852 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 853 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this into the destination</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 854 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 855 destBuffer[a] = srcBuffer[a];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 856 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 857 a ; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// address the next data element from the bufferStartingPoint</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 858 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 859 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 860 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 861 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 862 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 863 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 864 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap dest &amp; src buffers</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 865 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 866 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 867 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 868 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 869 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// destBuffer should now be copied over for the size of imageSliceLength. </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 870 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // You may return.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 871 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 872 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 873 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 874 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 875 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Filter a 3D image with a 3D kernel. Allows median filtering to include the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 876 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * picture elements at greater depths than only the current slice.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 877 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * &lt;p&gt;&lt;em&gt;Note that this volume filter will correctly filter color images on all</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 878 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * bands (aRGB) because the neighbor list is correct (see getNeighborList()). </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 879 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * This means, however, it will not selectivly filter any bands (one may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 880 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * filter only the Red channel, for instance), and will also filter all alpha</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 881 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * values as well. Of course, progress bar updates will not include any</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 882 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * color information. For these reasons it a useable, but limited color</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 883 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * filter.&lt;/em&gt;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 884 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param srcBuffer Source image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 885 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param destBuffer Destination image.</font></span><br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 886 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see volumeColorFilter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 887 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see getNeighborList</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 888 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 889 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 890 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // some code has been left in to allow this method to properly filter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 891 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // color images, although the other method is included.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 892 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 893 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> volumeFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> srcBuffer[], <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> destBuffer[]) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 894 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> i, pass; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// counting the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 895 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> row, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// ease of reading to find the row, column and slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 896 column, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (all starting at 0) associated with the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 897 slice; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// [(0,0,0) starts at the closest upper-left corner]</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 898 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int </font>'''</span>imageSliceLength = srcImage.getSliceSize() * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 899 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageLength = imageSliceLength * numberOfSlices;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 900 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kCenter = maskCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 901 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> width = srcImage.getExtents()[0]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 902 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> height = srcImage.getExtents()[1]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// height of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 903 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceWidth = width*valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of intensity</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 904 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// values (as in colors per pixel (1 for</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 905 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mono, 4 for color))</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 906 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> tempBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 907 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 908 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> average; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// arithmetic mean</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 909 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> sigma; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// standard deviation</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 910 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 911 float maskedList[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// list of buffer-values that were showing inside the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 912 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mask these bounds "frame" the interior of the slice which may be filtered</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 913 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (&amp;adjusted); image outside the frame may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 914 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> leftBound, rightBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the column</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 915 upperBound, lowerBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the row</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 916 aheadBound, behindBound; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 917 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (a note on orientation: object front is facing in the same direction as</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 918 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // viewer, thus ahead of viewer is into monitor, behind is out of monitor and</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 919 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // a more positive number of slices is farther forward.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 920 upperBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 921 lowerBound = height - halfK -1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 922 behindBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 923 aheadBound = numberOfSlices - halfK - 1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 924 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// we may say that each column is a pixel intensity: mono images have 1 per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 925 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel, 4 in color;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 926 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// these calculations are done separately for color &amp; mono images in</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 927 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // sliceFilter().</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 928 leftBound = halfK * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 929 rightBound = sliceWidth - valuesPerPixel*halfK - 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in color:</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">(4*width - 4*halfK</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 930 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // - 1); mono: (width - </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 931 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // halfK - 1)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 932 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> mod = (imageLength)/100; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mod is 1 percent of length of slice * the number </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 933 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of slices.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 934 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 935 BitSet mask = srcImage.generateVOIMask();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 936 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">for</font></span> (pass = 0; pass &lt; iterations &amp;&amp; !threadStopped; pass ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 937 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 938 progressBar.setMessage("Filtering image (pass " String.valueOf(pass 1) " of " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 939 iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 940 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 941 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 942 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = 0; i &lt; imageLength &amp;&amp; !threadStopped; i ){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 943 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>(i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 944 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 945 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)( (pass*imageLength) i)/(iterations*(imageLength-1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 946 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 947 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 948 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(i/valuesPerPixel) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 949 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 950 slice = i/imageSliceLength;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 951 row = (i%imageSliceLength)/sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 952 column = i%sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 953 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 954 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 955 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 956 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 957 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 958 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((column &lt; leftBound) || (column &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 959 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right--out</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 960 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 961 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 962 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((slice &lt; behindBound) || (slice &gt; aheadBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 963 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice too far ahead or behind--out</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 964 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 965 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 966 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 967 maskedList = getNeighborList(i, srcBuffer, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span>);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 968 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 969 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 970 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 971 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 972 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 973 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { /<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/ look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 974 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 975 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 976 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 977 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 978 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 979 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 980 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 981 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 982 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 983 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 984 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 985 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 986 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 987 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 988 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // into the destination buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 989 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 990 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 991 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 992 /<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/ now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 993 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 994 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 995 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 996 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 997 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 998 }<br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 999 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1000 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1001 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1002 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Filter a Color 3D image with a 3D kernel. Allows median filtering to</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1003 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * include the picture elements at greater depths than only the current</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1004 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * slice. This method allows selected band filtering, and does not filter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1005 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * the alpha band.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1006 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param srcBuffer Source image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1007 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @param destBuffer Destination image.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1008 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * @see volumeFilter</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1009 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1010 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1011 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> volumeColorFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> srcBuffer[], <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> destBuffer[]) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1012 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> i, pass; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// counting the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1013 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> initialIndex; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // reference to the color band being filtered/copied: aRBG:</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1014 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // 0, 1, 2, 3;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1015 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// it is an offset to the identified pixel, or column, of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1016 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1017 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> row, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// ease of reading to find the row, column and slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1018 column, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (all starting at 0) associated with the current element</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1019 slice; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// [(0,0,0) starts at the closest upper-left corner]</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1020 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kCenter = maskCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1021 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> width = srcImage.getExtents()[0]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1022 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> height = srcImage.getExtents()[1]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// height of slice in number of pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1023 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceWidth = width*valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// width of slice in number of </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1024 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // intensity values (as in colors per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1025 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel (1 for mono, 4 for color))</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1026 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> sliceSize = width * height; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in pixels (or elements</font></span>)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1027 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSliceLength = width * height * valuesPerPixel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in values-pixels</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1028 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSize = sliceSize * numberOfSlices; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in pixels (or elements)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1029 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageLength = imageSliceLength * numberOfSlices; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in (values-pixels)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1030 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> tempBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1031 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1032 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> average; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// arithmetic mean</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1033 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> sigma; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// standard deviation</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1034 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1035 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> maskedList[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// list of buffer-values that were showing inside the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1036 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mask</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1037 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// these bounds "frame" the interior of the slice which may be </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1038 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // filtered (&amp;adjusted); image outside the frame may not</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1039 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> leftBound, rightBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the column</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1040 upperBound, lowerBound, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the row</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1041 aheadBound, behindBound; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds on the slice</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1042 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (a note on orientation: object front is facing in the same direction as</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1043 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // viewer, thus ahead of viewer is into monitor, behind is out of monitor and</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1044 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // a more positive number of slices is farther forward.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1045 upperBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1046 lowerBound = height - halfK -1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1047 behindBound = halfK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1048 aheadBound = numberOfSlices - halfK - 1;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1049 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// we may say that each column is a pixel intensity: mono images have 1 per</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1050 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // pixel, 4 in color; these calculations are done separately for color &amp; </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1051 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // mono images in sliceFilter().</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1052 leftBound = halfK * valuesPerPixel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1053 rightBound = sliceWidth - valuesPerPixel*halfK - 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in color: (4*width - </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1054 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // 4*halfK - 1); mono: </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1055 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // (width - halfK - 1)</font></span><br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1056 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> mod = (imageSize)/100; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mod is 1 percent of length of slice * the number </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1057 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of slices.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1058 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1059 BitSet mask = srcImage.generateVOIMask();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1060 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1061 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy all alpha values in the image</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1062 setCopyColorText("alpha");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1063 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = 0; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1064 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy alpha;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1065 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1066 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1067 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// choose i so the proper colors go alongside the initial index</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1068 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // so we get the right output statements in the progress bar</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1069 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // copy only needed RGB values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1070 initialIndex = 0; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// start with alpha on each pass (routine moved so we don't</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1071 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">do it for each pass)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1072 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">while</font>'''</span> (initialIndex &lt; 3 &amp;&amp; !threadStopped) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// alpha:0, R:1, G:2, B:3. But</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1073 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // alpha must be copied</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1074 initialIndex; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// next initial index</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1075 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1076 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!rChannel &amp;&amp; initialIndex==1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1077 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image reds but we're not filtering the red</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1078 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // channel copy all red values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1079 setCopyColorText("red");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1080 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1081 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1082 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1083 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1084 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (!gChannel &amp;&amp; initialIndex==2) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image greens</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1085 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // but we're not filtering the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1086 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // greens channel copy all greens </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1087 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1088 setCopyColorText("green");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1089 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1090 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1091 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1092 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1093 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (!bChannel &amp;&amp; initialIndex==3) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1094 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// when looking at the image blues but we're not filtering the </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1095 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // blues channel copy all blue values</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1096 setCopyColorText("blue");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1097 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (i = initialIndex; i &lt; imageLength; i =4) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1098 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1099 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1100 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1101 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1102 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> (pass = 0; pass &lt; iterations &amp;&amp; !threadStopped; pass ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1103 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1104 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> if</font>'''</span> (initialIndex == 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1105 progressBar.setMessage("Filtering red channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1106 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1107 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1108 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> else if</font>'''</span> (initialIndex == 2) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1109 progressBar.setMessage("Filtering green channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1110 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1111 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1112 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1113 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (initialIndex == 3) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1114 progressBar.setMessage("Filtering blue channel (pass " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1115 String.valueOf(pass 1) " of " iterations ") ...");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1116 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1117 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1118 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if we needed to filter the image, we dropped through the </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1119 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // selection to filter the color given by ints initialIndex</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1120 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">for</font>'''</span> ( i = initialIndex; i &lt; imageLength &amp;&amp; !threadStopped; i =4){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1121 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (i%mod == 0 &amp;&amp; pBarVisible == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1122 progressBar.setValue(Math.round<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1123 ( ( (<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span>)(iterations*(initialIndex - 1)*imageSize imageSize*pass<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1124 i/4)/(3*iterations*(imageSize-1))*100)) );<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1125 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1126 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1127 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (entireImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span> || mask.get(i/valuesPerPixel) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1128 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Median stuff here</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1129 slice = i/imageSliceLength;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1130 row = (i%imageSliceLength)/sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1131 column = i%sliceWidth;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1132 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1133 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( (row &lt; upperBound) || (row &gt; lowerBound) ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1134 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// row too far up or down--out of</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1135 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1136 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1137 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((column &lt; leftBound) || (column &gt; rightBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1138 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// column too far left or right--</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1139 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // out of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1140 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1141 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> ((slice &lt; behindBound) || (slice &gt; aheadBound)) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1142 destBuffer[i] = srcBuffer[i]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice too far ahead or behind--</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1143 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // out of bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1144 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1145 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// in bounds</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1146 maskedList = getNeighborList(i, srcBuffer, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span>);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1147 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// verify that this element is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1148 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (stdDevLimit == 0.0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// anything is an outlier</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1149 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1150 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1151 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1152 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// look for outlierness</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1153 average = mean(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1154 sigma = standardDeviation(maskedList, average);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1155 if ((maskedList[kCenter] &gt; (average stdDevLimit*sigma)) ||<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1156 (maskedList[kCenter] &lt; (average - stdDevLimit*sigma))) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1157 shellSort(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1158 destBuffer[i] = median(maskedList);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1159 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1160 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if element was not an outlier, pixel is fine.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1161 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1162 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1163 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1164 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1165 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1166 <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1167 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// not part of the VOI so just copy this into the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1168 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // destination buffer.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1169 destBuffer[i] = srcBuffer[i];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1170 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1171 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1172 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// now set up for the repeat for multiple iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1173 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // But only bother with copying over if there are more iterations.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1174 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (pass &lt; iterations - 1) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1175 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1176 destBuffer = srcBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1177 srcBuffer = tempBuffer;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1178 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1179 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1180 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (iterations%2 == 0) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if even number of iterations, then</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1181 tempBuffer = destBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// swap src &amp; dest buffer is necessary</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1182 destBuffer = srcBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// to keep other colors not-yet-filtered</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1183 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // from</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1184 srcBuffer = tempBuffer; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filtering from the wrong buffer,</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1185 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // overwriting the real src</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1186 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1187 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1188 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1189 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1190 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1191 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1192 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * Forms kernel. Note that the &lt;bold&gt;kernel&lt;/bold&gt; uses the 0th place, unlike the</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1193 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> * kernelMask where counting starts at 1.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1194 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#00ef07"> 1195 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1196 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> makeKernel(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1197 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">try</font>'''</span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1198 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (sliceFiltering)<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1199 kernel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new byte</font>'''</span>[kernelSize*kernelSize];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> |}
 +
 +
 +
[[PlugIn Algorithm Median (con't, part 4)]]

Latest revision as of 14:55, 16 February 2012

804 if (numberOfSlices > 1) { //3D image update progressBar
</font></div>
805 // do a progress bar update
806 progressBar.setValue(Math.round
807 (( ( (float)(currentSlice*iterations pass)/
808 (iterations*numberOfSlices))* 100)));
809 }
810 }
811 for ( i = 0; i < imageSliceLength && !threadStopped; i ){
812 if (numberOfSlices == 1) { // 2D image update progressBar
813 if (i%mod == 0 && pBarVisible == true) {
814 progressBar.setValue(Math.round
815 ( ( (float)( (pass*imageSliceLength) i)
816 /(iterations*(imageSliceLength -1))*100)) );
817 }
818 }
819 if (entireImage == true || mask.get(a) ) {
820 // Median stuff here
821 row = i/width;
822 col = i%width;
823 if ( (row < upperBound) || (row > lowerBound) ) {
824 destBuffer[a] = srcBuffer[a]; // row too far up or down--out of
825 // bounds
826 }
827 else if ((col < leftBound) || (col > rightBound)) {
828 destBuffer[a] = srcBuffer[a]; // column too far left or right-
829 // -out of bounds
830 }
831
|- |
832 else { // in bounds
833 maskedList = getNeighborList(a, srcBuffer, true);
834 // verify that this element is an outlier
835 if (stdDevLimit == 0.0) { // anything is an outlier
836 shellSort(maskedList);
837 destBuffer[a] = median(maskedList);
838 }
839 else { // look for outlierness
840 average = mean(maskedList);
841 sigma = standardDeviation(maskedList, average);
842 if ((maskedList[kCenter] > (average stdDevLimit*sigma)) ||
843 (maskedList[kCenter] < (average - stdDevLimit*sigma))) {
844 shellSort(maskedList);
845 destBuffer[a] = median(maskedList);
846 }
847 else { // if element was not an outlier, pixel is fine.
848 destBuffer[a] = srcBuffer[a];
849 }
850 }
851 }
852 }
853 else { // not part of the VOI so just copy this into the destination
854 buffer.
855 destBuffer[a] = srcBuffer[a];
856 }
857 a ; // address the next data element from the bufferStartingPoint
858 }
859 }
860
861 // now set up for the repeat for multiple iterations.
862 // But only bother with copying over if there are more iterations.
863 if (pass < iterations - 1) {
864 tempBuffer = destBuffer; // swap dest & src buffers
865 destBuffer = srcBuffer;
866 srcBuffer = tempBuffer;
867 }
868 }
869 // destBuffer should now be copied over for the size of imageSliceLength.
870 // You may return.
871
872 }
873
874 /**
875 * Filter a 3D image with a 3D kernel. Allows median filtering to include the
876 * picture elements at greater depths than only the current slice.
877 * <p><em>Note that this volume filter will correctly filter color images on all
878 * bands (aRGB) because the neighbor list is correct (see getNeighborList()).
879 * This means, however, it will not selectivly filter any bands (one may not
880 * filter only the Red channel, for instance), and will also filter all alpha
881 * values as well. Of course, progress bar updates will not include any
882 * color information. For these reasons it a useable, but limited color
883 * filter.</em>
884 * @param srcBuffer Source image.
885 * @param destBuffer Destination image.
|- |
886 * @see volumeColorFilter
887 * @see getNeighborList
888 *
889 */
890 // some code has been left in to allow this method to properly filter
891 // color images, although the other method is included.
892
893 private void volumeFilter(float srcBuffer[], float destBuffer[]) {
894 int i, pass; // counting the current element
895 int row, // ease of reading to find the row, column and slice
896 column, // (all starting at 0) associated with the current element
897 slice; // [(0,0,0) starts at the closest upper-left corner]
898 int imageSliceLength = srcImage.getSliceSize() * valuesPerPixel;
899 int imageLength = imageSliceLength * numberOfSlices;
900 int kCenter = maskCenter;
901 int width = srcImage.getExtents()[0]; // width of slice in number of pixels
902 int height = srcImage.getExtents()[1]; // height of slice in number of pixels
903 int sliceWidth = width*valuesPerPixel; // width of slice in number of intensity
904 // values (as in colors per pixel (1 for
905 // mono, 4 for color))
906 float tempBuffer[];
907
908 float average; // arithmetic mean
909 float sigma; // standard deviation
910
911 float maskedList[]; // list of buffer-values that were showing inside the
912 // mask these bounds "frame" the interior of the slice which may be filtered
913 // (&adjusted); image outside the frame may not
914 int leftBound, rightBound, // bounds on the column
915 upperBound, lowerBound, // bounds on the row
916 aheadBound, behindBound; // bounds on the slice
917 // (a note on orientation: object front is facing in the same direction as
918 // viewer, thus ahead of viewer is into monitor, behind is out of monitor and
919 // a more positive number of slices is farther forward.)
920 upperBound = halfK;
921 lowerBound = height - halfK -1;
922 behindBound = halfK;
923 aheadBound = numberOfSlices - halfK - 1;
924 // we may say that each column is a pixel intensity: mono images have 1 per
925 // pixel, 4 in color;
926 // these calculations are done separately for color & mono images in
927 // sliceFilter().
928 leftBound = halfK * valuesPerPixel;
929 rightBound = sliceWidth - valuesPerPixel*halfK - 1; // in color: (4*width - 4*halfK
930 // - 1); mono: (width -
931 // halfK - 1)
932 int mod = (imageLength)/100; // mod is 1 percent of length of slice * the number
933 // of slices.
934
935 BitSet mask = srcImage.generateVOIMask();
936 for (pass = 0; pass < iterations && !threadStopped; pass ) {
937 if (pBarVisible == true) {
938 progressBar.setMessage("Filtering image (pass " String.valueOf(pass 1) " of "
939 iterations ") ...");
940 }
941
|- |
942 for ( i = 0; i < imageLength && !threadStopped; i ){
943 if (i%mod == 0 && pBarVisible == true) {
944 progressBar.setValue(Math.round
945 ( ( (float)( (pass*imageLength) i)/(iterations*(imageLength-1))*100)) );
946 }
947
948 if (entireImage == true || mask.get(i/valuesPerPixel) ) {
949 // Median stuff here
950 slice = i/imageSliceLength;
951 row = (i%imageSliceLength)/sliceWidth;
952 column = i%sliceWidth;
953
954 if ( (row < upperBound) || (row > lowerBound) ) {
955 destBuffer[i] = srcBuffer[i]; // row too far up or down--out of
956 // bounds
957 }
958 else if ((column < leftBound) || (column > rightBound)) {
959 destBuffer[i] = srcBuffer[i]; // column too far left or right--out
960 // of bounds
961 }
962 else if ((slice < behindBound) || (slice > aheadBound)) {
963 destBuffer[i] = srcBuffer[i]; // slice too far ahead or behind--out
964 // of bounds
965 }
966 else { // in bounds
967 maskedList = getNeighborList(i, srcBuffer, false);
968 // verify that this element is an outlier
969 if (stdDevLimit == 0.0) { // anything is an outlier
970 shellSort(maskedList);
971 destBuffer[i] = median(maskedList);
972 }
973 else { // look for outlierness
974 average = mean(maskedList);
975 sigma = standardDeviation(maskedList, average);
976 if ((maskedList[kCenter] > (average stdDevLimit*sigma)) ||
977 (maskedList[kCenter] < (average - stdDevLimit*sigma))) {
978 shellSort(maskedList);
979 destBuffer[i] = median(maskedList);
980 }
981 else { // if element was not an outlier, pixel is fine.
982 destBuffer[i] = srcBuffer[i];
983 }
984 }
985 }
986 }
987 else { // not part of the VOI so just copy this
988 // into the destination buffer.
989 destBuffer[i] = srcBuffer[i];
990 }
991 }
992 // now set up for the repeat for multiple iterations.
993 // But only bother with copying over if there are more iterations.
994 if (pass < iterations - 1) {
995 tempBuffer = destBuffer; // swap src & dest buffer
996 destBuffer = srcBuffer;
997 srcBuffer = tempBuffer;
998 }
|- |
999 }
1000 }
1001 /**
1002 * Filter a Color 3D image with a 3D kernel. Allows median filtering to
1003 * include the picture elements at greater depths than only the current
1004 * slice. This method allows selected band filtering, and does not filter
1005 * the alpha band.
1006 * @param srcBuffer Source image.
1007 * @param destBuffer Destination image.
1008 * @see volumeFilter
1009 *
1010 */
1011 private void volumeColorFilter(float srcBuffer[], float destBuffer[]) {
1012 int i, pass; // counting the current element
1013 int initialIndex; // reference to the color band being filtered/copied: aRBG:
1014 // 0, 1, 2, 3;
1015 // it is an offset to the identified pixel, or column, of
1016 // the slice
1017 int row, // ease of reading to find the row, column and slice
1018 column, // (all starting at 0) associated with the current element
1019 slice; // [(0,0,0) starts at the closest upper-left corner]
1020 int kCenter = maskCenter;
1021 int width = srcImage.getExtents()[0]; // width of slice in number of pixels
1022 int height = srcImage.getExtents()[1]; // height of slice in number of pixels
1023 int sliceWidth = width*valuesPerPixel; // width of slice in number of
1024 // intensity values (as in colors per
1025 // pixel (1 for mono, 4 for color))
1026 int sliceSize = width * height; // in pixels (or elements)
1027 int imageSliceLength = width * height * valuesPerPixel; // in values-pixels
1028 int imageSize = sliceSize * numberOfSlices; // in pixels (or elements)
1029 int imageLength = imageSliceLength * numberOfSlices; // in (values-pixels)
1030 float tempBuffer[];
1031
1032 float average; // arithmetic mean
1033 float sigma; // standard deviation
1034
1035 float maskedList[]; // list of buffer-values that were showing inside the
1036 // mask
1037 // these bounds "frame" the interior of the slice which may be
1038 // filtered (&adjusted); image outside the frame may not
1039 int leftBound, rightBound, // bounds on the column
1040 upperBound, lowerBound, // bounds on the row
1041 aheadBound, behindBound; // bounds on the slice
1042 // (a note on orientation: object front is facing in the same direction as
1043 // viewer, thus ahead of viewer is into monitor, behind is out of monitor and
1044 // a more positive number of slices is farther forward.)
1045 upperBound = halfK;
1046 lowerBound = height - halfK -1;
1047 behindBound = halfK;
1048 aheadBound = numberOfSlices - halfK - 1;
1049 // we may say that each column is a pixel intensity: mono images have 1 per
1050 // pixel, 4 in color; these calculations are done separately for color &
1051 // mono images in sliceFilter().
1052 leftBound = halfK * valuesPerPixel;
1053 rightBound = sliceWidth - valuesPerPixel*halfK - 1; // in color: (4*width -
1054 // 4*halfK - 1); mono:
1055 // (width - halfK - 1)
|- |
1056 int mod = (imageSize)/100; // mod is 1 percent of length of slice * the number
1057 // of slices.
1058
1059 BitSet mask = srcImage.generateVOIMask();
1060
1061 // copy all alpha values in the image
1062 setCopyColorText("alpha");
1063 for (i = 0; i < imageLength; i =4) {
1064 destBuffer[i] = srcBuffer[i]; // copy alpha;
1065 }
1066
1067 // choose i so the proper colors go alongside the initial index
1068 // so we get the right output statements in the progress bar
1069 // copy only needed RGB values
1070 initialIndex = 0; // start with alpha on each pass (routine moved so we don't
1071 // do it for each pass)
1072 while (initialIndex < 3 && !threadStopped) { // alpha:0, R:1, G:2, B:3. But
1073 // alpha must be copied
1074 initialIndex; // next initial index
1075
1076 if (!rChannel && initialIndex==1) {
1077 // when looking at the image reds but we're not filtering the red
1078 // channel copy all red values
1079 setCopyColorText("red");
1080 for (i = initialIndex; i < imageLength; i =4) {
1081 destBuffer[i] = srcBuffer[i];
1082 }
1083 }
1084 else if (!gChannel && initialIndex==2) { // when looking at the image greens
1085 // but we're not filtering the
1086 // greens channel copy all greens
1087 // values
1088 setCopyColorText("green");
1089 for (i = initialIndex; i < imageLength; i =4) {
1090 destBuffer[i] = srcBuffer[i];
1091 }
1092 }
1093 else if (!bChannel && initialIndex==3) {
1094 // when looking at the image blues but we're not filtering the
1095 // blues channel copy all blue values
1096 setCopyColorText("blue");
1097 for (i = initialIndex; i < imageLength; i =4) {
1098 destBuffer[i] = srcBuffer[i];
1099 }
1100 }
1101 else {
1102 for (pass = 0; pass < iterations && !threadStopped; pass ) {
1103 if (pBarVisible == true) {
1104 if (initialIndex == 1) {
1105 progressBar.setMessage("Filtering red channel (pass "
1106 String.valueOf(pass 1) " of " iterations ") ...");
1107 }
1108 else if (initialIndex == 2) {
1109 progressBar.setMessage("Filtering green channel (pass "
1110 String.valueOf(pass 1) " of " iterations ") ...");
1111 }
1112
|- |
1113 else if (initialIndex == 3) {
1114 progressBar.setMessage("Filtering blue channel (pass "
1115 String.valueOf(pass 1) " of " iterations ") ...");
1116 }
1117 }
1118 // if we needed to filter the image, we dropped through the
1119 // selection to filter the color given by ints initialIndex
1120 for ( i = initialIndex; i < imageLength && !threadStopped; i =4){
1121 if (i%mod == 0 && pBarVisible == true) {
1122 progressBar.setValue(Math.round
1123 ( ( (float)(iterations*(initialIndex - 1)*imageSize imageSize*pass
1124 i/4)/(3*iterations*(imageSize-1))*100)) );
1125 }
1126
1127 if (entireImage == true || mask.get(i/valuesPerPixel) ) {
1128 // Median stuff here
1129 slice = i/imageSliceLength;
1130 row = (i%imageSliceLength)/sliceWidth;
1131 column = i%sliceWidth;
1132
1133 if ( (row < upperBound) || (row > lowerBound) ) {
1134 destBuffer[i] = srcBuffer[i]; // row too far up or down--out of
1135 // bounds
1136 }
1137 else if ((column < leftBound) || (column > rightBound)) {
1138 destBuffer[i] = srcBuffer[i]; // column too far left or right--
1139 // out of bounds
1140 }
1141 else if ((slice < behindBound) || (slice > aheadBound)) {
1142 destBuffer[i] = srcBuffer[i]; // slice too far ahead or behind--
1143 // out of bounds
1144 }
1145 else { // in bounds
1146 maskedList = getNeighborList(i, srcBuffer, false);
1147 // verify that this element is an outlier
1148 if (stdDevLimit == 0.0) { // anything is an outlier
1149 shellSort(maskedList);
1150 destBuffer[i] = median(maskedList);
1151 }
1152 else { // look for outlierness
1153 average = mean(maskedList);
1154 sigma = standardDeviation(maskedList, average);
1155 if ((maskedList[kCenter] > (average stdDevLimit*sigma)) ||
1156 (maskedList[kCenter] < (average - stdDevLimit*sigma))) {
1157 shellSort(maskedList);
1158 destBuffer[i] = median(maskedList);
1159 }
1160 else { // if element was not an outlier, pixel is fine.
1161 destBuffer[i] = srcBuffer[i];
1162 }
1163 }
1164 }
1165 }
1166
|- |
1167 else { // not part of the VOI so just copy this into the
1168 // destination buffer.
1169 destBuffer[i] = srcBuffer[i];
1170 }
1171 }
1172 // now set up for the repeat for multiple iterations.
1173 // But only bother with copying over if there are more iterations.
1174 if (pass < iterations - 1) {
1175 tempBuffer = destBuffer; // swap src & dest buffer
1176 destBuffer = srcBuffer;
1177 srcBuffer = tempBuffer;
1178 }
1179 }
1180 if (iterations%2 == 0) { // if even number of iterations, then
1181 tempBuffer = destBuffer; // swap src & dest buffer is necessary
1182 destBuffer = srcBuffer; // to keep other colors not-yet-filtered
1183 // from
1184 srcBuffer = tempBuffer; // filtering from the wrong buffer,
1185 // overwriting the real src
1186 }
1187 }
1188 }
1189 }
1190
1191 /**
1192 * Forms kernel. Note that the <bold>kernel</bold> uses the 0th place, unlike the
1193 * kernelMask where counting starts at 1.
1194 *
1195 */
1196 private void makeKernel(){
1197 try {
1198 if (sliceFiltering)
1199 kernel = new byte[kernelSize*kernelSize];