Difference between revisions of "PlugIn Algorithm Median"

From MIPAV
Jump to: navigation, search
(PlugIn Algorithm median)
Line 2: Line 2:
  
 
<div style="font-style: normal; margin-bottom: 6pt; margin-left: 6pt; margin-right: 6pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#0023a9"> PlugInAlgorithmMedian<br /></font>'''</div><div style="font-style: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> The source code for the plugin program, PlugInAlgorithmMedian.java (Figure 1), is an example of an algorithm type of plugin. This plugin program runs a median filter on an image, using its own dialog box and implementation of the median filter.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 5pt; margin-left: 0pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Note:</font>'''</span> For ease of reading, comment lines in the source file appear in green type, and keywords appear in bold type.<br /></font></div><div style="font-style: normal; margin-bottom: 2pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000">  {| border="1" cellpadding="5" |+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 1. PlugInAlgorithmMedian.java <br /></font>'''</div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 1 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// By leaving out the package keyword in this class, it is therefore in the default java package</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 2 <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">for the application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 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"> 4 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.model.algorithms.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 5 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.model.structures.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 6 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.view.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 7 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 8 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.io.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 9 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.util.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 10 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.awt.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 11 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 12 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 13 <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"> 14 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Example of a plugin implementation of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 15 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This class creates the algorithm that runs on the image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 16 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This shows how to extend the AlgorithmBase class.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 17 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 18 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Note: The median algorithm is already implemented in</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 19 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the MIPAV/IASO software.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 20 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 21 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @version July 12, 2002</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 22 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @see Algorithms</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 23 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @see AlgorithmMedian</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 24 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 25 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Logfile: /mipav/src/plugins/PlugInAlgorithmMedian.java $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 26 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Revision: 7 $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 27 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Date: 3/16/05 3:36p $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 28 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 29 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 30 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public class</font>'''</span> PlugInAlgorithmMedian <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">extends</font>'''</span> AlgorithmBase {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 31 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 32 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> SQUARE_KERNEL = 0; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//square kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 33 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> CUBE_KERNEL = 0;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 34 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> CROSS_KERNEL = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// cross</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 35 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> AXIAL_KERNEL = 1; <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"> 36 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> X_KERNEL = 2; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// X-shaped kernel, from 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"> 37 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// corner to opposite 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"> 38 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> HORZ_KERNEL = 3; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// horizontal (2D only)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 39 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> VERT_KERNEL = 4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// vertical (2D only)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 40 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 41 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 42 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private</font>'''</span> BitSet mask = null;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 43 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 44 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> iterations; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// number of times to 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="#000000"> 45 <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">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"> 46 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 47 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (i.e., 5 = 5x5, 7 = 7x7,</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 48 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 9 = 9x9, etc.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 49 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// user-selectable shape 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"> 50 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the region for neighbor-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 51 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// selection</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 52 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> entireImage; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// true means apply to <br /> // entire</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 53 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image, false only region</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 54 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private byte</font>'''</span>[] kernel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mask to determine 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"> 55 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// region of pixels used in a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 56 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// median 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="#000000"> 57 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private float</font>'''</span> stdDevLimit; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// compute median value 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"> 58 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// pixel if pixel magnitude is</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 59 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// outside this fraction 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"> 60 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the 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"> 61 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> sliceFiltering; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// do all filtering slice-by-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 62 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice, rather than as a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 63 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// volume (applies only 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="#000000"> 64 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 3D/volume images)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 65 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> currentSlice = 0;//<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 66 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 67 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 68 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 69 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private float</font>'''</span>[] kernelMask;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 70 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 71 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 72 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 73 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 74 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// indicates the image being</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 75 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// messed with is a 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"> 76 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 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"> 77 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> valuesPerPixel=1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// number of elements in a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 78 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// pixel. Monochrome = 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"> 79 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Color = 4. (a, R, G, B)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 80 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> rChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if T, filter 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="#000000"> 81 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 82 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> gChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the green channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 83 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> bChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the blue channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 84 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 85 <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"> 86 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 3D images in which changes are placed in a predetermined</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 87 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* destination image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 88 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param destImg Image model where result image is to stored.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 89 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 90 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 91 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 92 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 7 = 7x7, 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 93 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 94 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 95 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 96 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* outside this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 97 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param sliceBySlice Each slice in a volume image is to be filtered separately</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 98 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* (when true), else the volume will use a kernel with 3</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 99 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* dimensions.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 100 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 101 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 102 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 103 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> public</font>'''</span> PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 104 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> sliceBySlice,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 105 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 106 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 107 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(destImg, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 108 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 109 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 110 valuesPerPixel = 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"> 111 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 112 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 113 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 114 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 115 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 116 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used 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="#000000"> 117 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 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="#000000"> 118 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 119 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 120 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 121 sliceFiltering = sliceBySlice;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 122 numberOfSlices = srcImage.getExtents()[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"> 123 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"> 124 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 125 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 126 <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"> 127 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 2D images in which changes are placed in a predetermined</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 128 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* destination image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 129 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param destImg Image model where result image is to stored.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 130 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 131 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 132 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 133 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 134 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 135 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 136 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDe Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 137 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 138 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 139 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 140 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 141 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 142 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 143 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 144 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(destImg, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 145 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 146 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 147 valuesPerPixel = 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"> 148 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 149 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 150 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 151 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 152 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 153 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used to 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="#000000"> 154 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 155 sliceFiltering = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// as a default--this doesn't make much sense in a 2D</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 156 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 157 numberOfSlices = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D images may only have 1 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"> 158 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"> 159 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 160 <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"> 161 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 3D images in which changes are returned to the source image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 162 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 163 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 164 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 165 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 166 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 167 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 168 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 169 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 170 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param sliceBySlice Each slice in a volume image is to be filtered separately</nowiki><br /><nowiki>* (when</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 171 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* true), else the volume will use a kernel with 3 dimensions.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 172 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 173 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 174 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 175 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 176 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> sliceBySlice, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 177 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 178 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 179 isColorImage = 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"> 180 valuesPerPixel = 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"> 181 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 182 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 183 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 184 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 185 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 186 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // set up the mask (kernel) used to 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="#000000"> 187 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 188 sliceFiltering = sliceBySlice;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 189 numberOfSlices = srcImage.getExtents()[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"> 190 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"> 191 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 192 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 193 <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"> 194 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 2D images in which changes are returned to the source image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 195 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 196 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 197 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 198 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 199 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki><br /><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 200 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 201 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 202 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 203 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 204 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 205 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 206 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 207 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 208 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 209 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 210 valuesPerPixel = 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"> 211 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 212 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 213 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 214 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 215 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 216 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used to 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="#000000"> 217 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 218 sliceFiltering = true; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// as a default--though a different value doesn'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"> 219 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// make much sense in a 2D application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 220 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (calculates makeKernel() )</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 221 numberOfSlices = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D images may only have 1 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"> 222 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"> 223 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 224 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 225 <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"> 226 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* RGB images are median filtered by "channel." That is, each color,</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 227 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* red, blue and green, is filtered independently of the other two colors.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 228 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This median filter permits selectively filtering any combination of the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 229 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* three channels instead of simply filtering all three. True for any of</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 230 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the arguments enforces filtering that channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 231 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param r Filter red channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 232 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param g Filter green channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 233 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param b Filter blue channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 234 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 235 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> setRGBChannelFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> r, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> g, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> b) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 236 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (isColorImage) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// just in case somebody called for a mono 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"> 237 rChannel = r;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 238 gChannel = g;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 239 bChannel = b;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 240 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 241 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 242 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 243 /**<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 244 * Prepares this class for destruction.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 245 */<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 246 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> finalize(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 247 destImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 248 srcImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 249 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>.finalize();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 250 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 251 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 252 <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"> 253 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructs a string of the construction parameters and outputs the string to the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 254 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* message frame if the logging procedure is turned on.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 255 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 256 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> constructLog() {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 257 historyString = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new</font>'''</span> String( "Median(" <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 258 String.valueOf(kernelShape) ", " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 259 String.valueOf(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"> 260 String.valueOf(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"> 261 String.valueOf(entireImage) ")\n");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 262 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 263 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 264 <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"> 265 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Starts the algorithm.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 266 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 267 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> runAlgorithm() {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 268 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 269 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (srcImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 270 displayError("Source Image is null");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 271 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 272 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 273 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 274 constructLog();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 275 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> if</font>'''</span> (destImage != <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>){ <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if there exists a 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="#000000"> 276 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (srcImage.getNDims() == 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"> 277 calcStoreInDest2D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 278 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 279 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (srcImage.getNDims() &gt; 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"> 280 calcStoreInDest3D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 281 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 282 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 283 <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">// there is no image but the original source.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 284 if (srcImage.getNDims() == 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"> 285 calcInPlace2D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 286 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 287 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (srcImage.getNDims() &gt; 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"> 288 calcInPlace3D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 289 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 290 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 291 } <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// end runAlgorithm()</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 292 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 293 <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"> 294 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Median filters the source image. Replaces the original image with the filtered</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 295 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 296 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 297 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> calcInPlace2D(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 298 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 299 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> length; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// total number of data-elements (pixels) in 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"> 300 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> buffer[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// data-buffer (for pixel data) which is the "heart"</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 301 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of 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"> 302 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> resultBuffer[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy-to buffer (for pixel data) for image-data</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 303 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // after filtering</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 304 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 305 <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"> 306 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!isColorImage) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 307 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 2 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 308 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 309 *srcImage.getExtents()[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"> 310 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 311 <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 (isColorImage)</font></span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 312 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 2 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 313 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// by 4 color elements per pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 314 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 315 *srcImage.getExtents()[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"> 316 *4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 1 each for ARGB</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 317 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 318 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 319 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 320 srcImage.exportData(0,length, buffer); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// locks and releases lock</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 321 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 322 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch </font>'''</span>(IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 323 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 324 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 325 errorCleanUp("Algorithm Median: source image locked", <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"> 326 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 327 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 328 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (OutOfMemoryError e){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 329 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 330 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 331 errorCleanUp("Algorithm Median reports: Out of memory when creating image<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 332 buffer", <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"> 333 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 334 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 335 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 336 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.buildProgressBar(); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// let user know what is going on</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 337 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.sliceFilter(buffer, resultBuffer, 0, "image"); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filter this 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"> 338 disposeProgressBar(); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filtering work should be done.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 339 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 340 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (threadStopped) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 341 finalize();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 342 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 343 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 344 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 345 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">try</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// place buffer data into 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"> 346 srcImage.importData(0, resultBuffer, <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"> 347 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 348 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 349 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 350 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 351 errorCleanUp("Algorithm Median: Source image locked", <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"> 352 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 353 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 354 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 355 setCompleted(<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"> 356 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 357 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 358 <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"> 359 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Median filters the source image and replaces the source image with the median</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 360 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* filtered image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 361 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 362 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> calcInPlace3D(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 363 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 364 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSliceLength = srcImage.getExtents()[0]*srcImage.getExtents()[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"> 365 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> length;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 366 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> buffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 367 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> resultBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 368 <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"> 369 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!isColorImage) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 370 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // image length is length in 3 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 371 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 372 *srcImage.getExtents()[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"> 373 *srcImage.getExtents()[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"> 374 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 375 <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 (isColorImage)</font></span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 376 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 3 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 377 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// by 4 color elements per pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 378 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 379 *srcImage.getExtents()[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"> 380 *srcImage.getExtents()[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"> 381 *4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 1 each for ARGB</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 382 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 383 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 384 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 385 srcImage.exportData(0,length, buffer); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// locks and releases lock</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 386 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.buildProgressBar();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 387 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 388 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 389 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 390 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 391 errorCleanUp("Algorithm Median: Source image locked", <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"> 392 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 393 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 394 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (OutOfMemoryError e){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 395 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 396 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 397 errorCleanUp("Algorithm Median: Out of memory", <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"> 398 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 399 }<br /></font></div>|}
 
<div style="font-style: normal; margin-bottom: 6pt; margin-left: 6pt; margin-right: 6pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#0023a9"> PlugInAlgorithmMedian<br /></font>'''</div><div style="font-style: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> The source code for the plugin program, PlugInAlgorithmMedian.java (Figure 1), is an example of an algorithm type of plugin. This plugin program runs a median filter on an image, using its own dialog box and implementation of the median filter.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 5pt; margin-left: 0pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Note:</font>'''</span> For ease of reading, comment lines in the source file appear in green type, and keywords appear in bold type.<br /></font></div><div style="font-style: normal; margin-bottom: 2pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000">  {| border="1" cellpadding="5" |+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 1. PlugInAlgorithmMedian.java <br /></font>'''</div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 1 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// By leaving out the package keyword in this class, it is therefore in the default java package</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 2 <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">for the application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 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"> 4 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.model.algorithms.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 5 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.model.structures.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 6 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> gov.nih.mipav.view.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 7 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 8 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.io.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 9 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.util.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 10 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">import</font>'''</span> java.awt.*;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 11 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 12 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 13 <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"> 14 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Example of a plugin implementation of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 15 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This class creates the algorithm that runs on the image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 16 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This shows how to extend the AlgorithmBase class.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 17 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 18 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Note: The median algorithm is already implemented in</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 19 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the MIPAV/IASO software.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 20 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 21 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @version July 12, 2002</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 22 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @see Algorithms</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 23 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @see AlgorithmMedian</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 24 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 25 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Logfile: /mipav/src/plugins/PlugInAlgorithmMedian.java $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 26 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Revision: 7 $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 27 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* $Date: 3/16/05 3:36p $</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 28 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 29 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 30 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public class</font>'''</span> PlugInAlgorithmMedian <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">extends</font>'''</span> AlgorithmBase {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 31 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 32 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> SQUARE_KERNEL = 0; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">//square kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 33 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> CUBE_KERNEL = 0;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 34 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> CROSS_KERNEL = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// cross</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 35 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> AXIAL_KERNEL = 1; <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"> 36 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> X_KERNEL = 2; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// X-shaped kernel, from 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"> 37 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// corner to opposite 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"> 38 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> HORZ_KERNEL = 3; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// horizontal (2D only)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 39 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private static final int</font>'''</span> VERT_KERNEL = 4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// vertical (2D only)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 40 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 41 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 42 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private</font>'''</span> BitSet mask = null;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 43 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 44 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> iterations; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// number of times to 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="#000000"> 45 <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">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"> 46 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 47 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (i.e., 5 = 5x5, 7 = 7x7,</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 48 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 9 = 9x9, etc.)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 49 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// user-selectable shape 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"> 50 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the region for neighbor-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 51 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// selection</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 52 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> entireImage; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// true means apply to <br /> // entire</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 53 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image, false only region</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 54 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private byte</font>'''</span>[] kernel; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// mask to determine 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"> 55 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// region of pixels used in a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 56 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// median 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="#000000"> 57 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private float</font>'''</span> stdDevLimit; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// compute median value 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"> 58 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// pixel if pixel magnitude is</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 59 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// outside this fraction 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"> 60 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the 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"> 61 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> sliceFiltering; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// do all filtering slice-by-</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 62 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// slice, rather than as a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 63 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// volume (applies only 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="#000000"> 64 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 3D/volume images)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 65 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> currentSlice = 0;//<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 66 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 67 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 68 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> kernelCenter;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 69 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private float</font>'''</span>[] kernelMask;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 70 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> 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"> 71 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 72 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 73 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 74 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">false</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// indicates the image being</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 75 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// messed with is a 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"> 76 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 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"> 77 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private int</font>'''</span> valuesPerPixel=1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// number of elements in a</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 78 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// pixel. Monochrome = 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"> 79 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// Color = 4. (a, R, G, B)</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 80 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> rChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if T, filter 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="#000000"> 81 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 82 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> gChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the green channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 83 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private boolean</font>'''</span> bChannel = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// the blue channel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 84 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 85 <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"> 86 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 3D images in which changes are placed in a predetermined</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 87 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* destination image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 88 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param destImg Image model where result image is to stored.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 89 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 90 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 91 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 92 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 7 = 7x7, 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 93 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 94 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 95 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 96 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* outside this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 97 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param sliceBySlice Each slice in a volume image is to be filtered separately</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 98 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* (when true), else the volume will use a kernel with 3</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 99 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* dimensions.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 100 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 101 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 102 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 103 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> public</font>'''</span> PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 104 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> sliceBySlice,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 105 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 106 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 107 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(destImg, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 108 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if </font>'''</span>( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 109 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 110 valuesPerPixel = 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"> 111 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 112 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 113 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 114 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 115 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 116 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used 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="#000000"> 117 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 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="#000000"> 118 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 119 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 120 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 121 sliceFiltering = sliceBySlice;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 122 numberOfSlices = srcImage.getExtents()[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"> 123 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"> 124 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 125 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 126 <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"> 127 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 2D images in which changes are placed in a predetermined</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 128 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* destination image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 129 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param destImg Image model where result image is to stored.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 130 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 131 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 132 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 133 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 134 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 135 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 136 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDe Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 137 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 138 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 139 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 140 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 141 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 142 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 143 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 144 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(destImg, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 145 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 146 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 147 valuesPerPixel = 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"> 148 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 149 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 150 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 151 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 152 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 153 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used to 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="#000000"> 154 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 155 sliceFiltering = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>; </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// as a default--this doesn't make much sense in a 2D</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 156 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 157 numberOfSlices = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D images may only have 1 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"> 158 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"> 159 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 160 <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"> 161 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 3D images in which changes are returned to the source image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 162 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 163 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 164 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 165 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 166 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 167 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 168 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 169 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 170 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param sliceBySlice Each slice in a volume image is to be filtered separately</nowiki><br /><nowiki>* (when</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 171 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* true), else the volume will use a kernel with 3 dimensions.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 172 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 173 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 174 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 175 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 176 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> sliceBySlice, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 177 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 178 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 179 isColorImage = 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"> 180 valuesPerPixel = 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"> 181 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 182 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 183 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 184 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 185 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 186 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // set up the mask (kernel) used to 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="#000000"> 187 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 188 sliceFiltering = sliceBySlice;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 189 numberOfSlices = srcImage.getExtents()[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"> 190 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"> 191 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 192 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 193 <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"> 194 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructor for 2D images in which changes are returned to the source image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 195 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param srcImg Source image model.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 196 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param iters Number of iterations of the median filter.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 197 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7, </nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 198 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* 9 = 9x9, etc.).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 199 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param kShape Kernel shape: element neighbors to include when finding the</nowiki><br /><nowiki>* median.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 200 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param stdDev Inner-bounds by which to process pixels (pixel values outside</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 201 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* this bound will be median filtered).</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 202 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param maskFlag Flag that indicates that the median filtering will be</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 203 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* performed for the whole image if equal to true.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 204 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 205 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public</font>'''</span> PlugInAlgorithmMedian(ModelImage srcImg, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> iters, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kSize, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> kShape,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 206 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> stdDev, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> maskFlag) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 207 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>, srcImg);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 208 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> ( srcImg.isColorImage() ) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 209 isColorImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">true</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 210 valuesPerPixel = 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"> 211 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 212 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// else, already 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"> 213 entireImage = maskFlag;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 214 iterations = iters;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 215 kernelSize = kSize; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// dimension of the kernel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 216 kernelShape = kShape; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// set up the mask (kernel) used to 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="#000000"> 217 stdDevLimit = stdDev; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// inside magnitude bounds of pixel value to adjust</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 218 sliceFiltering = true; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// as a default--though a different value doesn'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"> 219 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// make much sense in a 2D application.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 220 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// (calculates makeKernel() )</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 221 numberOfSlices = 1; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 2D images may only have 1 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"> 222 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"> 223 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 224 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 225 <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"> 226 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* RGB images are median filtered by "channel." That is, each color,</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 227 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* red, blue and green, is filtered independently of the other two colors.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 228 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* This median filter permits selectively filtering any combination of the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 229 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* three channels instead of simply filtering all three. True for any of</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 230 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* the arguments enforces filtering that channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 231 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param r Filter red channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 232 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param g Filter green channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 233 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* @param b Filter blue channel.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 234 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 235 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> setRGBChannelFilter(<span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> r, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> g, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">boolean</font>'''</span> b) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 236 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (isColorImage) { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// just in case somebody called for a mono 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"> 237 rChannel = r;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 238 gChannel = g;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 239 bChannel = b;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 240 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 241 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 242 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 243 /**<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 244 * Prepares this class for destruction.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 245 */<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 246 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> finalize(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 247 destImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 248 srcImage = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 249 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">super</font>'''</span>.finalize();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 250 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 251 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 252 <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"> 253 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Constructs a string of the construction parameters and outputs the string to the</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 254 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* message frame if the logging procedure is turned on.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 255 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 256 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> constructLog() {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 257 historyString = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new</font>'''</span> String( "Median(" <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 258 String.valueOf(kernelShape) ", " <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 259 String.valueOf(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"> 260 String.valueOf(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"> 261 String.valueOf(entireImage) ")\n");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 262 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 263 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 264 <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"> 265 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Starts the algorithm.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 266 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 267 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">public void</font>'''</span> runAlgorithm() {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 268 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 269 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (srcImage == <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 270 displayError("Source Image is null");<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 271 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 272 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 273 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 274 constructLog();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 275 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000"> if</font>'''</span> (destImage != <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span>){ <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// if there exists a 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="#000000"> 276 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (srcImage.getNDims() == 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"> 277 calcStoreInDest2D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 278 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 279 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (srcImage.getNDims() &gt; 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"> 280 calcStoreInDest3D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 281 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 282 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 283 <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">// there is no image but the original source.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 284 if (srcImage.getNDims() == 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"> 285 calcInPlace2D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 286 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 287 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">else if</font>'''</span> (srcImage.getNDims() &gt; 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"> 288 calcInPlace3D();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 289 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 290 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 291 } <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// end runAlgorithm()</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 292 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 293 <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"> 294 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Median filters the source image. Replaces the original image with the filtered</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 295 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 296 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 297 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> calcInPlace2D(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 298 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 299 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> length; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// total number of data-elements (pixels) in 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"> 300 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> buffer[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// data-buffer (for pixel data) which is the "heart"</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 301 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // of 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"> 302 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> resultBuffer[]; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// copy-to buffer (for pixel data) for image-data</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 303 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // after filtering</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 304 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 305 <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"> 306 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!isColorImage) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 307 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 2 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 308 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 309 *srcImage.getExtents()[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"> 310 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 311 <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 (isColorImage)</font></span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 312 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 2 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 313 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// by 4 color elements per pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 314 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 315 *srcImage.getExtents()[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"> 316 *4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 1 each for ARGB</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 317 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 318 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 319 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 320 srcImage.exportData(0,length, buffer); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// locks and releases lock</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 321 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 322 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch </font>'''</span>(IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 323 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 324 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 325 errorCleanUp("Algorithm Median: source image locked", <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"> 326 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 327 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 328 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (OutOfMemoryError e){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 329 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 330 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 331 errorCleanUp("Algorithm Median reports: Out of memory when creating image<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 332 buffer", <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"> 333 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 334 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 335 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 336 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.buildProgressBar(); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// let user know what is going on</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 337 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.sliceFilter(buffer, resultBuffer, 0, "image"); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filter this 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"> 338 disposeProgressBar(); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// filtering work should be done.</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 339 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 340 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (threadStopped) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 341 finalize();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 342 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 343 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 344 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 345 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">try</font>'''</span> { <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// place buffer data into 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"> 346 srcImage.importData(0, resultBuffer, <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"> 347 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 348 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 349 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 350 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 351 errorCleanUp("Algorithm Median: Source image locked", <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"> 352 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 353 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 354 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 355 setCompleted(<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"> 356 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 357 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 358 <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"> 359 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* Median filters the source image and replaces the source image with the median</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 360 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>* filtered image.</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 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"> 361 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 362 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">private void</font>'''</span> calcInPlace3D(){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 363 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 364 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> imageSliceLength = srcImage.getExtents()[0]*srcImage.getExtents()[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"> 365 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">int</font>'''</span> length;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 366 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> buffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 367 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">float</font>'''</span> resultBuffer[];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 368 <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"> 369 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">if</font>'''</span> (!isColorImage) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 370 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07"> // image length is length in 3 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 371 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 372 *srcImage.getExtents()[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"> 373 *srcImage.getExtents()[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"> 374 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 375 <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 (isColorImage)</font></span> {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 376 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// image length is length in 3 dims</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 377 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// by 4 color elements per pixel</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 378 length = srcImage.getExtents()[0]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 379 *srcImage.getExtents()[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"> 380 *srcImage.getExtents()[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"> 381 *4; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// 1 each for ARGB</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 382 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 383 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 384 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">new float</font>'''</span>[length];<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 385 srcImage.exportData(0,length, buffer); <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00ef07">// locks and releases lock</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 386 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">this</font>'''</span>.buildProgressBar();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 387 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 1pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <br /></font></div> |- | <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 388 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (IOException error) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 389 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 390 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 391 errorCleanUp("Algorithm Median: Source image locked", <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"> 392 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 393 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 394 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">catch</font>'''</span> (OutOfMemoryError e){<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 395 buffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 396 resultBuffer = <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">null</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 397 errorCleanUp("Algorithm Median: Out of memory", <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"> 398 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">return</font>'''</span><nowiki>;</nowiki><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 399 }<br /></font></div>|}
 +
 +
 +
[[PlugIn Algorithm Median (con't)]]

Revision as of 14:50, 16 February 2012

PlugIn Algorithm median

PlugInAlgorithmMedian
The source code for the plugin program, PlugInAlgorithmMedian.java (Figure 1), is an example of an algorithm type of plugin. This plugin program runs a median filter on an image, using its own dialog box and implementation of the median filter.
Note: For ease of reading, comment lines in the source file appear in green type, and keywords appear in bold type.
{| border="1" cellpadding="5" |+
Figure 1. PlugInAlgorithmMedian.javaÂ
|- |
1 // By leaving out the package keyword in this class, it is therefore in the default java package
2 // for the application.
3
4 import gov.nih.mipav.model.algorithms.*;
5 import gov.nih.mipav.model.structures.*;
6 import gov.nih.mipav.view.*;
7
8 import java.io.*;
9 import java.util.*;
10 import java.awt.*;
11
12
13 /**
14 * Example of a plugin implementation of the median filter.
15 * This class creates the algorithm that runs on the image.
16 * This shows how to extend the AlgorithmBase class.
17 *
18 * Note: The median algorithm is already implemented in
19 * the MIPAV/IASO software.
20 *
21 * @version July 12, 2002
22 * @see Algorithms
23 * @see AlgorithmMedian
24 *
25 * $Logfile: /mipav/src/plugins/PlugInAlgorithmMedian.java $
26 * $Revision: 7 $
27 * $Date: 3/16/05 3:36p $
28 *
29 */
30 public class PlugInAlgorithmMedian extends AlgorithmBase {
31
32 private static final int SQUARE_KERNEL = 0; //square kernel
33 private static final int CUBE_KERNEL = 0;
34 private static final int CROSS_KERNEL = 1; // cross
35 private static final int AXIAL_KERNEL = 1; //
36 private static final int X_KERNEL = 2; // X-shaped kernel, from 1
37 // corner to opposite corner
38 private static final int HORZ_KERNEL = 3; // horizontal (2D only)
39 private static final int VERT_KERNEL = 4; // vertical (2D only)
40
41
42 private BitSet mask = null;
43
44 private int iterations; // number of times to filter
45 // the image.
46 private int kernelSize; // dimension of the kernel
47 // (i.e., 5 = 5x5, 7 = 7x7,
48 // 9 = 9x9, etc.)
49 private int kernelShape; // user-selectable shape of
50 // the region for neighbor-
51 // selection
52 private boolean entireImage; // true means apply to
// entire

53 // image, false only region
54 private byte[] kernel; // mask to determine the
|- |
55 // region of pixels used in a
56 // median filter
57 private float stdDevLimit; // compute median value of
58 // pixel if pixel magnitude is
59 // outside this fraction of
60 // the standard deviation
61 private boolean sliceFiltering; // do all filtering slice-by-
62 // slice, rather than as a
63 // volume (applies only to
64 // 3D/volume images)
65 private int currentSlice = 0;//
66 private int numberOfSlices;
67 private int halfK;
68 private int kernelCenter;
69 private float[] kernelMask;
70 private int maskCenter;
71
72
73
74 private boolean isColorImage = false; // indicates the image being
75 // messed with is a color
76 // image
77 private int valuesPerPixel=1; // number of elements in a
78 // pixel. Monochrome = 1,
79 // Color = 4. (a, R, G, B)
80 private boolean rChannel = true; // if T, filter the red
81 // channel
82 private boolean gChannel = true; // the green channel
83 private boolean bChannel = true; // the blue channel
84
85 /**
86 * Constructor for 3D images in which changes are placed in a predetermined
87 * destination image.
88 * @param destImg Image model where result image is to stored.
89 * @param srcImg Source image model.
90 * @param iters Number of iterations of the median filter.
91 * @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5,
92 * 7 = 7x7, 9 = 9x9, etc.).
93 * @param kShape Kernel shape: element neighbors to include when finding
94 * the median.
95 * @param stdDev Inner-bounds by which to process pixels (pixel values
96 * outside this bound will be median filtered).
97 * @param sliceBySlice Each slice in a volume image is to be filtered separately
98 * (when true), else the volume will use a kernel with 3
99 * dimensions.
100 * @param maskFlag Flag that indicates that the median filtering will be
101 * performed for the whole image if equal to true.
102 */
103 public PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, int iters,
104 int kSize, int kShape, float stdDev, boolean sliceBySlice,
105 boolean maskFlag) {
106
107 super(destImg, srcImg);
Â
|- |
108 if ( srcImg.isColorImage() ) {
109 isColorImage = true;
110 valuesPerPixel = 4;
111 }
112 // else, already false
113 entireImage = maskFlag;
114 iterations = iters;
115 kernelSize = kSize; // dimension of the kernel
116 kernelShape = kShape; // set up the mask (kernel) used to
117 // filter
118
119 stdDevLimit = stdDev; // inside magnitude bounds of pixel
120 // value to adjust
121 sliceFiltering = sliceBySlice;
122 numberOfSlices = srcImage.getExtents()[2];
123 makeKernel();
124 }
125
126 /**
127 * Constructor for 2D images in which changes are placed in a predetermined
128 * destination image.
129 * @param destImg Image model where result image is to stored.
130 * @param srcImg Source image model.
131 * @param iters Number of iterations of the median filter.
132 * @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7,
133 * 9 = 9x9, etc.).
134 * @param kShape Kernel shape: element neighbors to include when finding the
135 * median.
136 * @param stdDe Inner-bounds by which to process pixels (pixel values outside
137 * this bound will be median filtered).
138 * @param maskFlag Flag that indicates that the median filtering will be
139 * performed for the whole image if equal to true.
140 */
141 public PlugInAlgorithmMedian(ModelImage destImg, ModelImage srcImg, int iters,
142 int kSize, int kShape, float stdDev, boolean maskFlag) {
143
144 super(destImg, srcImg);
145 if ( srcImg.isColorImage() ) {
146 isColorImage = true;
147 valuesPerPixel = 4;
148 }
149 // else, already false
150 entireImage = maskFlag;
151 iterations = iters;
152 kernelSize = kSize; // dimension of the kernel
153 kernelShape = kShape; // set up the mask (kernel) used to filter
154 stdDevLimit = stdDev; // inside magnitude bounds of pixel value to adjust
155 sliceFiltering = true; // as a default--this doesn't make much sense in a 2D
156 // application.
157 numberOfSlices = 1; // 2D images may only have 1 slice.
158 makeKernel();
159 }
160 /**
161 * Constructor for 3D images in which changes are returned to the source image.
162 * @param srcImg Source image model.
163 * @param iters Number of iterations of the median filter.
Â
|- |
164 * @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7,
165 * 9 = 9x9, etc.).
166 * @param kShape Kernel shape: element neighbors to include when finding the
167 * median.
168 * @param stdDev Inner-bounds by which to process pixels (pixel values outside
169 * this bound will be median filtered).
170 * @param sliceBySlice Each slice in a volume image is to be filtered separately
* (when

171 * true), else the volume will use a kernel with 3 dimensions.
172 * @param maskFlag Flag that indicates that the median filtering will be
173 * performed for the whole image if equal to true.
174 */
175 public PlugInAlgorithmMedian(ModelImage srcImg, int iters, int kSize, int kShape,
176 float stdDev, boolean sliceBySlice, boolean maskFlag) {
177 super(null, srcImg);
178 if ( srcImg.isColorImage() ) {
179 isColorImage = true;
180 valuesPerPixel = 4;
181 }
182 // else, already false
183 entireImage = maskFlag;
184 iterations = iters;
185 kernelSize = kSize; // dimension of the kernel
186 kernelShape = kShape; // set up the mask (kernel) used to filter
187 stdDevLimit = stdDev; // inside magnitude bounds of pixel value to adjust
188 sliceFiltering = sliceBySlice;
189 numberOfSlices = srcImage.getExtents()[2];
190 makeKernel();
191 }
192
193 /**
194 * Constructor for 2D images in which changes are returned to the source image.
195 * @param srcImg Source image model.
196 * @param iters Number of iterations of the median filter.
197 * @param kSize Kernel size: dimension of the kernel (i.e., 5 = 5x5, 7 = 7x7,
198 * 9 = 9x9, etc.).
199 * @param kShape Kernel shape: element neighbors to include when finding the
* median.

200 * @param stdDev Inner-bounds by which to process pixels (pixel values outside
201 * this bound will be median filtered).
202 * @param maskFlag Flag that indicates that the median filtering will be
203 * performed for the whole image if equal to true.
204 */
205 public PlugInAlgorithmMedian(ModelImage srcImg, int iters, int kSize, int kShape,
206 float stdDev, boolean maskFlag) {
207 super(null, srcImg);
208 if ( srcImg.isColorImage() ) {
209 isColorImage = true;
210 valuesPerPixel = 4;
211 }
212 // else, already false
213 entireImage = maskFlag;
214 iterations = iters;
215 kernelSize = kSize; // dimension of the kernel
216 kernelShape = kShape; // set up the mask (kernel) used to filter
217 stdDevLimit = stdDev; // inside magnitude bounds of pixel value to adjust
Â
|- |
218 sliceFiltering = true; // as a default--though a different value doesn't
219 // make much sense in a 2D application.
220 // (calculates makeKernel() )
221 numberOfSlices = 1; // 2D images may only have 1 slice.
222 makeKernel();
223 }
224
225 /**
226 * RGB images are median filtered by "channel." That is, each color,
227 * red, blue and green, is filtered independently of the other two colors.
228 * This median filter permits selectively filtering any combination of the
229 * three channels instead of simply filtering all three. True for any of
230 * the arguments enforces filtering that channel.
231 * @param r Filter red channel.
232 * @param g Filter green channel.
233 * @param b Filter blue channel.
234 */
235 public void setRGBChannelFilter(boolean r, boolean g, boolean b) {
236 if (isColorImage) { // just in case somebody called for a mono image
237 rChannel = r;
238 gChannel = g;
239 bChannel = b;
240 }
241 }
242
243 /**
244 * Prepares this class for destruction.
245 */
246 public void finalize(){
247 destImage = null;
248 srcImage = null;
249 super.finalize();
250 }
251
252 /**
253 * Constructs a string of the construction parameters and outputs the string to the
254 * message frame if the logging procedure is turned on.
255 */
256 private void constructLog() {
257 historyString = new String( "Median("
258 String.valueOf(kernelShape) ", "
259 String.valueOf(kernelSize) ", "
260 String.valueOf(iterations) ", "
261 String.valueOf(entireImage) ")\n");
262 }
263
264 /**
265 * Starts the algorithm.
266 */
267 public void runAlgorithm() {
268
269 if (srcImage == null) {
270 displayError("Source Image is null");
271 return;
272 }
273
Â
|- |
274 constructLog();
275 if (destImage != null){ // if there exists a destination image
276 if (srcImage.getNDims() == 2){
277 calcStoreInDest2D();
278 }
279 else if (srcImage.getNDims() > 2) {
280 calcStoreInDest3D();
281 }
282 }
283 else { // there is no image but the original source.
284 if (srcImage.getNDims() == 2){
285 calcInPlace2D();
286 }
287 else if (srcImage.getNDims() > 2) {
288 calcInPlace3D();
289 }
290 }
291 } // end runAlgorithm()
292
293 /**
294 * Median filters the source image. Replaces the original image with the filtered
295 * image.
296 */
297 private void calcInPlace2D(){
298
299 int length; // total number of data-elements (pixels) in image
300 float buffer[]; // data-buffer (for pixel data) which is the "heart"
301 // of the image
302 float resultBuffer[]; // copy-to buffer (for pixel data) for image-data
303 // after filtering
304
305 try {
306 if (!isColorImage) {
307 // image length is length in 2 dims
308 length = srcImage.getExtents()[0]
309 *srcImage.getExtents()[1];
310 }
311 else { // if (isColorImage) {
312 // image length is length in 2 dims
313 // by 4 color elements per pixel
314 length = srcImage.getExtents()[0]
315 *srcImage.getExtents()[1]
316 *4; // 1 each for ARGB
317 }
318 buffer = new float[length];
319 resultBuffer = new float[length];
320 srcImage.exportData(0,length, buffer); // locks and releases lock
321 }
322 catch (IOException error) {
323 buffer = null;
324 resultBuffer = null;
325 errorCleanUp("Algorithm Median: source image locked", true);
326 return;
327 }
328 catch (OutOfMemoryError e){
329 buffer = null;
Â
|- |
330 resultBuffer = null;
331 errorCleanUp("Algorithm Median reports: Out of memory when creating image
332 buffer", true);
333 return;
334 }
335
336 this.buildProgressBar(); // let user know what is going on
337 this.sliceFilter(buffer, resultBuffer, 0, "image"); // filter this slice
338 disposeProgressBar(); // filtering work should be done.
339
340 if (threadStopped) {
341 finalize();
342 return;
343 }
344
345 try { // place buffer data into the image
346 srcImage.importData(0, resultBuffer, true);
347 }
348 catch (IOException error) {
349 buffer = null;
350 resultBuffer = null;
351 errorCleanUp("Algorithm Median: Source image locked", true);
352 return;
353 }
354
355 setCompleted(true);
356 }
357
358 /**
359 * Median filters the source image and replaces the source image with the median
360 * filtered image.
361 */
362 private void calcInPlace3D(){
363
364 int imageSliceLength = srcImage.getExtents()[0]*srcImage.getExtents()[1];
365 int length;
366 float buffer[];
367 float resultBuffer[];
368 try {
369 if (!isColorImage) {
370 // image length is length in 3 dims
371 length = srcImage.getExtents()[0]
372 *srcImage.getExtents()[1]
373 *srcImage.getExtents()[2];
374 }
375 else { // if (isColorImage) {
376 // image length is length in 3 dims
377 // by 4 color elements per pixel
378 length = srcImage.getExtents()[0]
379 *srcImage.getExtents()[1]
380 *srcImage.getExtents()[2]
381 *4; // 1 each for ARGB
382 }
383 buffer = new float[length];
384 resultBuffer = new float[length];
385 srcImage.exportData(0,length, buffer); // locks and releases lock
386 this.buildProgressBar();
387 }
Â
|- |
388 catch (IOException error) {
389 buffer = null;
390 resultBuffer = null;
391 errorCleanUp("Algorithm Median: Source image locked", true);
392 return;
393 }
394 catch (OutOfMemoryError e){
395 buffer = null;
396 resultBuffer = null;
397 errorCleanUp("Algorithm Median: Out of memory", true);
398 return;
399 }
|}


PlugIn Algorithm Median (con't)