<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>VTK: dox/Imaging/vtkFastSplatter.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>dox/Imaging/vtkFastSplatter.h</h1><a href="a02871.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: Visualization Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: vtkFastSplatter.h,v $</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</span> <a name="l00007"></a>00007 <span class="comment"> All rights reserved.</span> <a name="l00008"></a>00008 <span class="comment"> See Copyright.txt or http://www.kitware.com/Copyright.htm for details.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even</span> <a name="l00011"></a>00011 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</span> <a name="l00012"></a>00012 <span class="comment"> PURPOSE. See the above copyright notice for more information.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment">=========================================================================*/</span> <a name="l00015"></a>00015 <span class="comment">/*----------------------------------------------------------------------------</span> <a name="l00016"></a>00016 <span class="comment"> Copyright (c) Sandia Corporation</span> <a name="l00017"></a>00017 <span class="comment"> See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.</span> <a name="l00018"></a>00018 <span class="comment">----------------------------------------------------------------------------*/</span> <a name="l00047"></a>00047 <span class="preprocessor">#ifndef __vtkFastSplatter_h</span> <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define __vtkFastSplatter_h</span> <a name="l00049"></a>00049 <span class="preprocessor"></span> <a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="a02276.html">vtkImageAlgorithm.h</a>"</span> <a name="l00051"></a>00051 <a name="l00052"></a><a class="code" href="a00535.html">00052</a> <span class="keyword">class </span><a class="code" href="a02170.html#3e7fe2912c56d9dbe95c57272a61f15f">VTK_IMAGING_EXPORT</a> <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a> : <span class="keyword">public</span> <a class="code" href="a00727.html" title="Generic algorithm superclass for image algs.">vtkImageAlgorithm</a> <a name="l00053"></a>00053 { <a name="l00054"></a>00054 <span class="keyword">public</span>: <a name="l00055"></a><a class="code" href="a00535.html#280c73653787a8e334a3c852a930143f">00055</a> vtkTypeRevisionMacro(<a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a>, <a class="code" href="a00727.html" title="Generic algorithm superclass for image algs.">vtkImageAlgorithm</a>); <a name="l00056"></a>00056 <span class="keyword">static</span> <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a> *<a class="code" href="a00101.html#06d80d8d4aa1a4856135fa003845be82">New</a>(); <a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00727.html#24f67bbfad1ac731eb64f5172cf30af3">PrintSelf</a>(ostream &os, <a class="code" href="a00869.html" title="a simple class to control print indentation">vtkIndent</a> indent); <a name="l00058"></a>00058 <a name="l00060"></a>00060 <a name="l00064"></a>00064 vtkSetVector6Macro(ModelBounds,<span class="keywordtype">double</span>); <a name="l00065"></a>00065 vtkGetVectorMacro(ModelBounds,<span class="keywordtype">double</span>,6); <a name="l00067"></a>00067 <a name="l00069"></a>00069 <a name="l00070"></a>00070 vtkSetVector3Macro( OutputDimensions, <span class="keywordtype">int</span> ); <a name="l00071"></a>00071 vtkGetVector3Macro( OutputDimensions, <span class="keywordtype">int</span> ); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">//BTX</span> <a name="l00075"></a><a class="code" href="a00535.html#0487fecd0b74f908e3fcb2069eec975c2f52280455f7ae27afd23ff31ac20bfb">00075</a> <span class="keyword">enum</span> { NoneLimit, ClampLimit, ScaleLimit, FreezeScaleLimit }; <a name="l00076"></a>00076 <span class="comment">//ETX</span> <a name="l00077"></a>00077 <a name="l00079"></a>00079 <a name="l00084"></a>00084 vtkSetMacro(LimitMode, <span class="keywordtype">int</span>); <a name="l00085"></a>00085 vtkGetMacro(LimitMode, <span class="keywordtype">int</span>); <a name="l00086"></a><a class="code" href="a00535.html#4c6839c124d790634e3324efe4c6dfe6">00086</a> <span class="keywordtype">void</span> SetLimitModeToNone() { this->SetLimitMode(NoneLimit); } <a name="l00087"></a><a class="code" href="a00535.html#55af29dab84f4aeac0b36de2f8f83998">00087</a> <span class="keywordtype">void</span> SetLimitModeToClamp() { this->SetLimitMode(ClampLimit); } <a name="l00088"></a><a class="code" href="a00535.html#9f11136edafad84a2f0be78a774399a0">00088</a> <span class="keywordtype">void</span> SetLimitModeToScale() { this->SetLimitMode(ScaleLimit); } <a name="l00089"></a><a class="code" href="a00535.html#39d9fc77050752f264ab9dcce53fe63e">00089</a> <span class="keywordtype">void</span> SetLimitModeToFreezeScale() { this->SetLimitMode(FreezeScaleLimit); } <a name="l00091"></a>00091 <a name="l00093"></a>00093 <a name="l00094"></a>00094 vtkSetMacro(MinValue, <span class="keywordtype">double</span>); <a name="l00095"></a>00095 vtkGetMacro(MinValue, <span class="keywordtype">double</span>); <a name="l00096"></a>00096 vtkSetMacro(MaxValue, <span class="keywordtype">double</span>); <a name="l00097"></a>00097 vtkGetMacro(MaxValue, <span class="keywordtype">double</span>); <a name="l00099"></a>00099 <a name="l00101"></a>00101 <a name="l00103"></a>00103 vtkGetMacro(NumberOfPointsSplatted, <span class="keywordtype">int</span>); <a name="l00105"></a>00105 <a name="l00109"></a>00109 <span class="keywordtype">void</span> SetSplatConnection(<a class="code" href="a00102.html" title="Proxy object to connect input/output ports.">vtkAlgorithmOutput</a>*); <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="keyword">protected</span>: <a name="l00112"></a>00112 <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a>(); <a name="l00113"></a>00113 <span class="keyword">virtual</span> ~<a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a>(); <a name="l00114"></a>00114 <a name="l00115"></a><a class="code" href="a00535.html#10765b06077c2548ba4646d020946407">00115</a> <span class="keywordtype">double</span> ModelBounds[6]; <a name="l00116"></a><a class="code" href="a00535.html#12155b80f0aac550d775292686063168">00116</a> <span class="keywordtype">int</span> OutputDimensions[3]; <a name="l00117"></a>00117 <a name="l00118"></a><a class="code" href="a00535.html#929980875dd46935ae3e0054adfea840">00118</a> <span class="keywordtype">int</span> LimitMode; <a name="l00119"></a><a class="code" href="a00535.html#7aea363f821aa3fd3a0ac20fb4ef394d">00119</a> <span class="keywordtype">double</span> MinValue; <a name="l00120"></a><a class="code" href="a00535.html#ce40e941d6be4721f98d52d546b26592">00120</a> <span class="keywordtype">double</span> MaxValue; <a name="l00121"></a><a class="code" href="a00535.html#56c1efb3c77286f5827415383f4a204c">00121</a> <span class="keywordtype">double</span> FrozenScale; <a name="l00122"></a>00122 <a name="l00123"></a><a class="code" href="a00535.html#26af1887482862f8575fdf05c2c99ffc">00123</a> <a class="code" href="a00751.html" title="topologically and geometrically regular array of data">vtkImageData</a> *Buckets; <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00727.html#7abefdbb585c2e27ebc314c894c87f74">FillInputPortInformation</a>(<span class="keywordtype">int</span> <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210710cb6d12e418b21e8fb3d79ac32f51c">port</a>, <a class="code" href="a00872.html" title="Store vtkAlgorithm input/output information.">vtkInformation</a> *<a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d21023da246d4a744e861548382bb79fad81">info</a>); <a name="l00126"></a>00126 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00727.html#b739abd84881f7e31a8a382bf5a06a91">RequestInformation</a>(<a class="code" href="a00872.html" title="Store vtkAlgorithm input/output information.">vtkInformation</a> *, <a name="l00127"></a>00127 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a> **, <a name="l00128"></a>00128 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a> *); <a name="l00129"></a>00129 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00727.html#442e91c5e549f40acffb0941846cb047">RequestUpdateExtent</a>(<a class="code" href="a00872.html" title="Store vtkAlgorithm input/output information.">vtkInformation</a>*, <a name="l00130"></a>00130 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a>**, <a name="l00131"></a>00131 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a>*); <a name="l00132"></a>00132 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00727.html#ddc9f91ebe9386c31617c3e12166e10e">RequestData</a>(<a class="code" href="a00872.html" title="Store vtkAlgorithm input/output information.">vtkInformation</a> *, <a name="l00133"></a>00133 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a> **, <a name="l00134"></a>00134 <a class="code" href="a00895.html" title="Store zero or more vtkInformation instances.">vtkInformationVector</a> *); <a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="comment">// Used internally for converting points in world space to indices in</span> <a name="l00137"></a>00137 <span class="comment">// the output image.</span> <a name="l00138"></a><a class="code" href="a00535.html#54c742aaa91fa35657fd419288a90f63">00138</a> <span class="keywordtype">double</span> Origin[3]; <a name="l00139"></a><a class="code" href="a00535.html#e2a369936d6932cf3e27055c8cd0f508">00139</a> <span class="keywordtype">double</span> Spacing[3]; <a name="l00140"></a>00140 <a name="l00141"></a>00141 <span class="comment">// This is updated every time the filter executes</span> <a name="l00142"></a><a class="code" href="a00535.html#0e7fbbafc285cd23d50c1dc0127b5802">00142</a> <span class="keywordtype">int</span> NumberOfPointsSplatted; <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">// Used internally to track the data range. When the limit mode is</span> <a name="l00145"></a>00145 <span class="comment">// set to FreezeScale, the data will be scaled as if this were the</span> <a name="l00146"></a>00146 <span class="comment">// range regardless of what it actually is.</span> <a name="l00147"></a><a class="code" href="a00535.html#3dfe083e4b8f14434714b7001b328e47">00147</a> <span class="keywordtype">double</span> LastDataMinValue; <a name="l00148"></a><a class="code" href="a00535.html#06ee1cf19a56882f69def95d322c3708">00148</a> <span class="keywordtype">double</span> LastDataMaxValue; <a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="keyword">private</span>: <a name="l00151"></a>00151 <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a>(<span class="keyword">const</span> <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a> &); <span class="comment">// Not implemented</span> <a name="l00152"></a>00152 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="a00535.html" title="A splatter optimized for splatting single kernels.">vtkFastSplatter</a> &); <span class="comment">// Not implemented</span> <a name="l00153"></a>00153 }; <a name="l00154"></a>00154 <a name="l00155"></a>00155 <span class="comment">//BTX</span> <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">//-----------------------------------------------------------------------------</span> <a name="l00158"></a>00158 <a name="l00159"></a>00159 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00160"></a><a class="code" href="a02871.html#d1678003fbb1c8028c72f287c663ebe1">00160</a> <span class="keywordtype">void</span> <a class="code" href="a02871.html#d1678003fbb1c8028c72f287c663ebe1">vtkFastSplatterClamp</a>(T *array, <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> arraySize, <a name="l00161"></a>00161 T minValue, T maxValue) <a name="l00162"></a>00162 { <a name="l00163"></a>00163 <span class="keywordflow">for</span> (<a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> i = 0; i < arraySize; i++) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 <span class="keywordflow">if</span> (array[i] < minValue) array[i] = minValue; <a name="l00166"></a>00166 <span class="keywordflow">if</span> (array[i] > maxValue) array[i] = maxValue; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="comment">//-----------------------------------------------------------------------------</span> <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00173"></a><a class="code" href="a02871.html#cabd9ca60dd3edbb0a4cb26c1ec314d3">00173</a> <span class="keywordtype">void</span> <a class="code" href="a02871.html#cabd9ca60dd3edbb0a4cb26c1ec314d3">vtkFastSplatterScale</a>(T *array, <span class="keywordtype">int</span> numComponents, <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> numTuples, <a name="l00174"></a>00174 T minValue, T maxValue, <a name="l00175"></a>00175 <span class="keywordtype">double</span> *dataMinValue, <span class="keywordtype">double</span> *dataMaxValue) <a name="l00176"></a>00176 { <a name="l00177"></a>00177 T *a; <a name="l00178"></a>00178 T min, <a class="code" href="a02864.html#ffe776513b24d84b39af8ab0930fef7f">max</a>; <a name="l00179"></a>00179 *dataMinValue = 0; <a name="l00180"></a>00180 *dataMaxValue = 0; <a name="l00181"></a>00181 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> t; <a name="l00182"></a>00182 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> c = 0; c < numComponents; c++) <a name="l00183"></a>00183 { <a name="l00184"></a>00184 <span class="comment">// Find the min and max values in the array.</span> <a name="l00185"></a>00185 a = array+c; <a name="l00186"></a>00186 min = max = *a; <a name="l00187"></a>00187 a += numComponents; <a name="l00188"></a>00188 <span class="keywordflow">for</span> (t = 1; t < numTuples; t++, a += numComponents) <a name="l00189"></a>00189 { <a name="l00190"></a>00190 <span class="keywordflow">if</span> (min > *a) min = *a; <a name="l00191"></a>00191 <span class="keywordflow">if</span> (max < *a) max = *a; <a name="l00192"></a>00192 } <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">// Bias everything so that 0 is really the minimum.</span> <a name="l00195"></a>00195 <span class="keywordflow">if</span> (min != 0) <a name="l00196"></a>00196 { <a name="l00197"></a>00197 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00198"></a>00198 { <a name="l00199"></a>00199 *a -= min; <a name="l00200"></a>00200 } <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="comment">// Scale the values.</span> <a name="l00204"></a>00204 <span class="keywordflow">if</span> (max != min) <a name="l00205"></a>00205 { <a name="l00206"></a>00206 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00207"></a>00207 { <a name="l00208"></a>00208 *a = ((maxValue-minValue)*(*a))/(max-min); <a name="l00209"></a>00209 } <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="comment">// Bias everything again so that it lies in the correct range.</span> <a name="l00213"></a>00213 <span class="keywordflow">if</span> (minValue != 0) <a name="l00214"></a>00214 { <a name="l00215"></a>00215 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00216"></a>00216 { <a name="l00217"></a>00217 *a += minValue; <a name="l00218"></a>00218 } <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <span class="keywordflow">if</span> (c == 0) <a name="l00221"></a>00221 { <a name="l00222"></a>00222 *dataMinValue = min; <a name="l00223"></a>00223 *dataMaxValue = max; <a name="l00224"></a>00224 } <a name="l00225"></a>00225 } <a name="l00226"></a>00226 } <a name="l00227"></a>00227 <a name="l00228"></a>00228 <a name="l00229"></a>00229 <span class="comment">//-----------------------------------------------------------------------------</span> <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00232"></a><a class="code" href="a02871.html#a687ef5ff2443629dff7fa6e8f2e8035">00232</a> <span class="keywordtype">void</span> <a class="code" href="a02871.html#a687ef5ff2443629dff7fa6e8f2e8035">vtkFastSplatterFrozenScale</a>(T *array, <a name="l00233"></a>00233 <span class="keywordtype">int</span> numComponents, <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> numTuples, <a name="l00234"></a>00234 T minValue, T maxValue, <a name="l00235"></a>00235 <span class="keywordtype">double</span> min, <span class="keywordtype">double</span> <a class="code" href="a02864.html#ffe776513b24d84b39af8ab0930fef7f">max</a>) <a name="l00236"></a>00236 { <a name="l00237"></a>00237 T *a; <a name="l00238"></a>00238 <a name="l00239"></a>00239 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> t; <a name="l00240"></a>00240 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> c = 0; c < numComponents; c++) <a name="l00241"></a>00241 { <a name="l00242"></a>00242 <span class="comment">// Bias everything so that 0 is really the minimum.</span> <a name="l00243"></a>00243 <span class="keywordflow">if</span> (min != 0) <a name="l00244"></a>00244 { <a name="l00245"></a>00245 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00246"></a>00246 { <a name="l00247"></a>00247 *a -= <span class="keyword">static_cast<</span>T<span class="keyword">></span>(min); <a name="l00248"></a>00248 } <a name="l00249"></a>00249 } <a name="l00250"></a>00250 <a name="l00251"></a>00251 <span class="comment">// Scale the values.</span> <a name="l00252"></a>00252 <span class="keywordflow">if</span> (max != min) <a name="l00253"></a>00253 { <a name="l00254"></a>00254 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00255"></a>00255 { <a name="l00256"></a>00256 *a = <span class="keyword">static_cast<</span>T<span class="keyword">></span>(((maxValue-minValue)*(*a))/(max-min)); <a name="l00257"></a>00257 } <a name="l00258"></a>00258 } <a name="l00259"></a>00259 <a name="l00260"></a>00260 <span class="comment">// Bias everything again so that it lies in the correct range.</span> <a name="l00261"></a>00261 <span class="keywordflow">if</span> (minValue != 0) <a name="l00262"></a>00262 { <a name="l00263"></a>00263 <span class="keywordflow">for</span> (t = 0, a = array+c; t < numTuples; t++, a += numComponents) <a name="l00264"></a>00264 { <a name="l00265"></a>00265 *a += minValue; <a name="l00266"></a>00266 } <a name="l00267"></a>00267 } <a name="l00268"></a>00268 } <a name="l00269"></a>00269 } <a name="l00270"></a>00270 <a name="l00271"></a>00271 <span class="comment">//ETX</span> <a name="l00272"></a>00272 <a name="l00273"></a>00273 <span class="preprocessor">#endif //__vtkFastSplatter_h</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 3 18:35:33 2009 for VTK by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>