<div dir="ltr">

<p class="MsoNormal">Hi Jose,</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">The synchronization from CPU to GPU image and back, may or
may not be triggered by the default in the current ITK implementation.</p>

<p class="MsoNormal">You have to make an extra effort to control it. Basically,
you have to make sure that GPU input image is allocated and copied from CPU to
GPU,</p>

<p class="MsoNormal">execute the filter which only use input and output images,
copy GPU output image back to CPU.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Ideally, you should not control it and that has to be
managed by the ITK GPU pipeline itself (hided from the user), but this is not a
case right now.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">There are few problems. First, what you get after calling
reader->GetOutput() is normal ITK image that you passing to the GPU filter,</p>

<p class="MsoNormal">while expecting GPU image at this moment. What you want is
that GPU image is ready when you call reader->GetOutput() (created,
allocated and copied to GPU).</p>

<p class="MsoNormal">The second problem may happen right after calling the GPU
filter, the memory for output are not copied back to CPU output image.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">What you should do is following:</p>

<p class="MsoNormal">1 Create GPU input image.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">1.1 Register the GPUImageFactory before calling GPUReader =
ReaderType::New();</p>

<p class="MsoNormal"><span style> 
</span>itk::ObjectFactoryBase::RegisterFactory( itk::GPUImageFactory::New() );</p>

<p class="MsoNormal"><span style>  </span></p>

<p class="MsoNormal"><span style>  </span>At this moment ALL
ITK images which are created will be itk::GPUImage's with memory allocated on
GPU.</p>

<p class="MsoNormal"><span style>  </span>Use it with care,
you may end up with not intended copying to GPU when you modify this images.</p>

<p class="MsoNormal"><span style>  </span>The reader once
created will also have GPU image inside and that what you need.</p>

<p class="MsoNormal"><span style>  </span>You may unregister
factory right after you have used it.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">1.2 Alternative way if registering factory is not possible
for you application.</p>

<p class="MsoNormal"><span style>  </span>But you still want
to use GPU filter in the middle of your application you may consider following:</p>

<p class="MsoNormal"><span style>      </span>gpuInputImage =
GPUInputImageType::New();</p>

<p class="MsoNormal"><span style>     
</span>gpuInputImage->GraftITKImage( itkimage );<span style>  </span>// normal itk image here</p>

<p class="MsoNormal"><span style>     
</span>gpuInputImage->AllocateGPU(); // allocate only on GPU</p>

<p class="MsoNormal"><span style>     
</span>gpuInputImage->GetGPUDataManager()->SetCPUBufferLock( true ); //
we don't want to change it CPU input</p>

<p class="MsoNormal"><span style>     
</span>gpuInputImage->GetGPUDataManager()->SetGPUDirtyFlag( true );<span style>  </span>// set gpu dirty flag</p>

<p class="MsoNormal"><span style>     
</span>gpuInputImage->GetGPUDataManager()->UpdateGPUBuffer(); <span style> </span>// copy cpu -> gpu</p>

<p class="MsoNormal"><span style> </span><span style>     </span></p>

<p class="MsoNormal">2. Construct you filter, set input from the reader (or
gpuInput image), call your filter.</p>

<p class="MsoNormal"><span style>  </span>At the moment of
construction GPU filter will create GPU output image for you.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">3. Call extra synchronization step after
GPUFilter->Update(); (listed below)</p>

<p class="MsoNormal">itk::GPUExplicitSync< FilterType, OutputImageType >(
GPUFilter, false );</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">4. Write results</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I hope that helps a bit. Making or using GPU filters with
ITK is a bit of the challenge right now. </p>

<p class="MsoNormal">Specially to get it working across all GPU cards available.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">You could check the correct execution for
itkGPUShrinkImageFilter as example in The Insight Journal paper:</p>

<p class="MsoNormal"><a href="http://www.insight-journal.org/browse/publication/884">http://www.insight-journal.org/browse/publication/884</a></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Regards,</p>

<p class="MsoNormal">-Denis Shamonin</p>

<p class="MsoNormal">Division of Image Processing (LKEB)</p>

<p class="MsoNormal">Department of Radiology</p>

<p class="MsoNormal">Leiden University Medical Center</p>

<p class="MsoNormal">PO Box 9600, 2300 RC Leiden, The Netherlands</p>

<div class="gmail_extra"><br><br>//------------------------------------------------------------------------------<br>// GPU explicit synchronization helper function<br>template< class ImageToImageFilterType, class OutputImageType ><br>
void<br>GPUExplicitSync( typename ImageToImageFilterType::Pointer & filter,<br>  const bool filterUpdate = true,<br>  const bool releaseGPUMemory = false )<br>{<br>  if( filter.IsNotNull() )<br>  {<br>    if( filterUpdate )<br>
    {<br>      filter->Update();<br>    }<br><br>    typedef typename OutputImageType::PixelType                               OutputImagePixelType;<br>    typedef GPUImage< OutputImagePixelType, OutputImageType::ImageDimension > GPUOutputImageType;<br>
    GPUOutputImageType * GPUOutput = dynamic_cast< GPUOutputImageType * >( filter->GetOutput() );<br>    if( GPUOutput )<br>    {<br>      GPUOutput->UpdateBuffers();<br>    }<br><br>    if( releaseGPUMemory )<br>
    {<br>      GPUOutput->GetGPUDataManager()->Initialize();<br>    }<br>  }<br>  else<br>  {<br>    itkGenericExceptionMacro( << "The filter pointer is null." );<br>  }<br>}<br><br><br><br><div class="gmail_quote">
On Wed, Apr 16, 2014 at 3:24 PM, Jose Ignacio Prieto <span dir="ltr"><<a href="mailto:joseignacio.prieto@gmail.com" target="_blank">joseignacio.prieto@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi Jim,<div><br><div>It had a different problem when using float. It would show a NAN on the results. That's why I changed to short. <div>The card has 4GB ram. </div></div></div></div><div class=""><div class="h5">
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 7:40 PM, Jim Miller <span dir="ltr"><<a href="mailto:millerjv@gmail.com" target="_blank">millerjv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="auto"><div>Does the test for GPUDiscreteGaussian run on your platform?</div><div><br></div><div>The test uses a pixel type of float. Your code does not. You might try float. </div><div><br></div><div>The Gaussian filter will require much more GPU memory than the mean filter. How much memory does your GPU have?<br>

<br>Jim</div><div><div><div><br>On Apr 15, 2014, at 11:18 AM, Jose Ignacio Prieto <<a href="mailto:joseignacio.prieto@gmail.com" target="_blank">joseignacio.prieto@gmail.com</a>> wrote:<br><br></div><blockquote type="cite">

<div><div dir="ltr">Hi all, I am having trouble using GPUdiscretegaussian. It works for me on CPU but GPU version gives output 0. I tried running the test code but no help. I do run GPUMean filter. My card is AMDw7000 and using opencl 1.2, itk 4.6<div>


<br></div><div>Here is the code and the output. The images are vtk files of 320x320x231, ushort.</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">/*=========================================================================</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">Copyright</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Insight</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Software</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Consortium</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">Licensed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">under</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Apache</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Version</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">2.0</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"License");</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">you</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">may</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">use</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">this</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">file</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">except</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">compliance</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">with</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License.</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">You</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">may</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">obtain</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">copy</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">at</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(0,128,0)"><a href="http://www.apache.org/licenses/LICENSE-2.0.txt" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.txt</a></span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">Unless</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">required</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">by</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">applicable</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">law</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">or</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">agreed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">writing,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">software</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">distributed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">under</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">distributed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">an</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"AS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">IS"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">BASIS,</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">WITHOUT</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">WARRANTIES</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">OR</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CONDITIONS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">OF</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">ANY</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">KIND,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">either</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">express</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">or</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">implied.</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">See</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">specific</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">language</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">governing</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">permissions</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">and</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">limitations</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">under</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">License.</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">*=========================================================================*/</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkImageFileReader.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkImageFileWriter.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUImage.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUKernelManager.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUContextManager.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUImageToImageFilter.h"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUNeighborhoodOperatorImageFilter.h"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkTimeProbe.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGaussianOperator.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkDiscreteGaussianImageFilter.h"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUDiscreteGaussianImageFilter.h"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkMeanImageFilter.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"itkGPUMeanImageFilter.h"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">float</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">InputPixelType;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">float</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">OutputPixelType;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,128,0)">short</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">InputPixelType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,128,0)">short</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OutputPixelType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">GPUImage</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">InputPixelType</span><span>,</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">3</span><span style="color:rgb(192,192,192)"> </span><span>></span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,0,128)">InputImageType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">GPUImage</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OutputPixelType</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span><span style="color:rgb(192,192,192)"> </span><span>></span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,0,128)">OutputImageType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">ImageFileReader</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">InputImageType</span><span style="color:rgb(192,192,192)">  </span><span>></span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,0,128)">ReaderType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">ImageFileWriter</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OutputImageType</span><span style="color:rgb(192,192,192)"> </span><span>></span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,0,128)">WriterType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span>main</span><span>(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span>argc</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span><span>*</span><span>argv</span><span>[])</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">if</span><span>(!</span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span>IsGPUAvailable</span><span>())</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cerr<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"OpenCL-enabled</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">present."</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">EXIT_FAILURE</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">if</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>argc</span><span style="color:rgb(192,192,192)"> </span><span><</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">3</span><span style="color:rgb(192,192,192)"> </span><span>)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cerr<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Error:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">missing</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">arguments"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cerr<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"inputfile</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">outputfile</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">[num_dimensions]"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">EXIT_FAILURE</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">std</span><span>::</span><span style="color:rgb(128,0,128)">string</span><span style="color:rgb(192,192,192)"> </span><span>inFile</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>argv</span><span>[</span><span style="color:rgb(0,0,128)">1</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">std</span><span>::</span><span style="color:rgb(128,0,128)">string</span><span style="color:rgb(192,192,192)"> </span><span>outFile</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>argv</span><span>[</span><span style="color:rgb(0,0,128)">2</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">unsigned</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span>dim</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">ReaderType</span><span>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>reader</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">WriterType</span><span>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>writer</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>reader</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ReaderType</span><span>::</span><span>New</span><span>();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>writer</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span>::</span><span>New</span><span>();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>reader</span><span>-></span><span style="font-style:italic">SetFileName</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>inFile</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>writer</span><span>-></span><span style="font-style:italic">SetFileName</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>outFile</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">float</span><span style="color:rgb(192,192,192)"> </span><span>variance</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">4.0</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">test</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">1~8</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">threads</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPU</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span>nThreads</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">8</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">DiscreteGaussianImageFilter</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">InputImageType</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OutputImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">CPUFilterType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">CPUFilterType</span><span>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>CPUFilter</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">CPUFilterType</span><span>::</span><span style="color:rgb(128,0,0)">New</span><span>();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">TimeProbe</span><span style="color:rgb(192,192,192)"> </span><span>cputimer</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>cputimer</span><span>.</span><span>Start</span><span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>SetNumberOfThreads<span>(</span><span style="color:rgb(192,192,192)"> </span><span>nThreads</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>SetInput<span>(</span><span style="color:rgb(192,192,192)"> </span><span>reader</span><span>-></span><span>GetOutput</span><span>()</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>SetMaximumKernelWidth<span>(</span><span style="color:rgb(0,0,128)">10</span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>SetUseImageSpacingOff<span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>SetVariance<span>(</span><span style="color:rgb(192,192,192)"> </span><span>variance</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>CPUFilter</span><span>-></span>Update<span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>cputimer</span><span>.</span><span>Stop</span><span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">itk::MeanImageFilter<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">InputImageType,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">OutputImageType></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPUFilterType;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">CPUFilterType::Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPUFilter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPUFilterType::New();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">itk::TimeProbe</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">cputimer;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">cputimer.Start();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">CPUFilter->SetNumberOfThreads(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">nThreads</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">CPUFilter->SetInput(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">reader->GetOutput()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">CPUFilter->SetMaximumKernelWidth(10);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">CPUFilter->SetUseImageSpacingOff();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">CPUFilter->SetRadius(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">variance</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">CPUFilter->Update();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">cputimer.Stop();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"CPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Gaussian</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">took</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>cputimer</span><span>.</span><span>GetMean</span><span>()</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">seconds</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">with</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">              </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>CPUFilter</span><span>-></span>GetNumberOfThreads<span>()</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">threads.\n"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-------</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">GPUDiscreteGaussianImageFilter</span><span><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">InputImageType</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OutputImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">GPUFilterType</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">GPUFilterType</span><span>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>GPUFilter</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">GPUFilterType</span><span>::</span><span style="color:rgb(128,0,0)">New</span><span>();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">TimeProbe</span><span style="color:rgb(192,192,192)"> </span><span>gputimer</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>gputimer</span><span>.</span><span>Start</span><span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>SetInput<span>(</span><span style="color:rgb(192,192,192)"> </span><span>reader</span><span>-></span><span>GetOutput</span><span>()</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>SetVariance<span>(</span><span style="color:rgb(192,192,192)"> </span><span>variance</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>SetMaximumKernelWidth<span>(</span><span style="color:rgb(0,0,128)">10</span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>SetUseImageSpacingOff<span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->DebugOn();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->GPUEnabledOff();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>Print<span>(</span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>Update<span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>GPUFilter</span><span>-></span>GetOutput<span>()-></span>UpdateBuffers<span>();</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">synchronization</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">point</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(GPU->CPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">memcpy)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>gputimer</span><span>.</span><span>Stop</span><span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"GPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Gaussian</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">took</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>gputimer</span><span>.</span><span>GetMean</span><span>()</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">seconds.\n"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">itk::GPUMeanImageFilter<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">InputImageType,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">OutputImageType></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPUFilterType;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilterType::Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPUFilter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPUFilterType::New();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">itk::TimeProbe</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">gputimer;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">gputimer.Start();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->SetInput(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">reader->GetOutput()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">GPUFilter->SetVariance(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">variance</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">GPUFilter->SetMaximumKernelWidth(10);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">GPUFilter->SetUseImageSpacingOff();</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">GPUFilter->DebugOn();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">////</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">GPUFilter->Print(std::cout);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->SetRadius(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">variance</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->Update();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">GPUFilter->GetOutput()->UpdateBuffers();</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">synchronization</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">point</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(GPU->CPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">memcpy)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">gputimer.Stop();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">std::cout</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"GPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Gaussian</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">took</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">gputimer.GetMean()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">seconds.\n"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">std::endl;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">---------------</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">RMS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">check</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">---------------</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span>diff</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">unsigned</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span>nPix</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">ImageRegionIterator</span><span><</span><span style="color:rgb(128,0,128)">OutputImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span>cit</span><span>(</span><span>CPUFilter</span><span>-></span>GetOutput<span>(),</span><span style="color:rgb(192,192,192)"> </span><span>CPUFilter</span><span>-></span>GetOutput<span>()-></span>GetLargestPossibleRegion<span>());</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">ImageRegionIterator</span><span><</span><span style="color:rgb(128,0,128)">OutputImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span>git</span><span>(</span><span>GPUFilter</span><span>-></span>GetOutput<span>(),</span><span style="color:rgb(192,192,192)"> </span><span>GPUFilter</span><span>-></span>GetOutput<span>()-></span>GetLargestPossibleRegion<span>());</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">for</span><span>(</span><span>cit</span><span>.</span><span>GoToBegin</span><span>(),</span><span style="color:rgb(192,192,192)"> </span><span>git</span><span>.</span><span>GoToBegin</span><span>();</span><span style="color:rgb(192,192,192)"> </span><span>!</span><span>cit</span><span>.</span><span>IsAtEnd</span><span>();</span><span style="color:rgb(192,192,192)"> </span><span>++</span><span>cit</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span>++</span><span>git</span><span>)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span>err</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span style="color:rgb(128,128,0)">double</span><span>)(</span><span>cit</span><span>.</span><span>Get</span><span>())</span><span style="color:rgb(192,192,192)"> </span><span>-</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span style="color:rgb(128,128,0)">double</span><span>)(</span><span>git</span><span>.</span><span>Get</span><span>());</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(0,128,0)">if(err</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">0.1</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">||</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(double)cit.Get()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">0.1)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">std::cout</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"CPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(double)(cit.Get())</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">",</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(double)(git.Get())</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">std::endl;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>diff</span><span style="color:rgb(192,192,192)"> </span><span>+=</span><span style="color:rgb(192,192,192)"> </span><span>err</span><span>*</span><span>err</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>nPix</span><span>++;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>writer</span><span>-></span><span>SetInput</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>GPUFilter</span><span>-></span>GetOutput<span>()</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">writer->SetInput(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPUFilter->GetOutput()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>writer</span><span>-></span><span style="font-style:italic">Update</span><span>();</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span>nPix</span><span style="color:rgb(192,192,192)"> </span><span>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span>RMSError</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>sqrt</span><span>(</span><span style="color:rgb(192,192,192)"> </span><span>diff</span><span style="color:rgb(192,192,192)"> </span><span>/</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span style="color:rgb(128,128,0)">double</span><span>)</span><span>nPix</span><span style="color:rgb(192,192,192)"> </span><span>);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"RMS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>RMSError</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">operator</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">has</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">type</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">double</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">but</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">precision</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">well-supported</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">most</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPUs</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">and</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">by</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">most</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">drivers</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">at</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">this</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">time.</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">Therefore,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GPU</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">filter</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">operator</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">has</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">type</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">float</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">relax</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">RMS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">threshold</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">here</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">allow</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">errors</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">due</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">differences</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">precision</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">NOTE:</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">threshold</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">1.2e-5</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">worked</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">linux</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">and</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Mac,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">but</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Windows</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(0,128,0)">why?</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span>RMSThreshold</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1.7e-5</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span>vnl_math_isnan</span><span>(</span><span>RMSError</span><span>))</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"RMS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">NaN!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">nPix:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>nPix</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">EXIT_FAILURE</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(192,192,192)"> </span><span>(</span><span>RMSError</span><span style="color:rgb(192,192,192)"> </span><span>></span><span style="color:rgb(192,192,192)"> </span><span>RMSThreshold</span><span>)</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"RMS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">exceeds</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">threshold</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">("</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>RMSThreshold</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">")"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">EXIT_FAILURE</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">else</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">std</span><span>::</span>cout<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"No</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">pixels</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">output!"</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">EXIT_FAILURE</span><span>;</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div><br></div><div>OUTPUT</div><div><br></div><div><p style="margin:0px"><br></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;font-weight:600;color:rgb(0,0,170)">Starting C:\DocsMaracuya\Build\Ejemplos\Gpu\GPUTest.exe...</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Platform  : AMD Accelerated Parallel Processing</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Platform  : AMD Accelerated Parallel Processing</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Pitcairn</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Maximum Work Item Sizes : { 256, 256, 256 }</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Maximum Work Group Size : 256</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Alignment in bits of the base address : 2048</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Smallest alignment in bytes for any data type : 128</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_atomic_counters_32 cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_d3d10_sharing cl_amd_bus_addressable_memory cl_amd_c1x_atomics </span></p>



<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">CPU Gaussian Filter took 1.70355 seconds with 8 threads.</span></p>
<p style="font-size:10pt;font-family:Courier;margin:0px"><br></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Defines: #define DIM_3</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define INTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OUTTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OPTYPE short</span></p>
<p style="font-size:10pt;font-family:Courier;margin:0px"><br></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Defines: #define DIM_3</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define INTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OUTTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OPTYPE short</span></p>
<p style="font-size:10pt;font-family:Courier;margin:0px"><br></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">Defines: #define DIM_3</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define INTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OUTTYPE short</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">#define OPTYPE short</span></p>
<p style="font-size:10pt;font-family:Courier;margin:0px"><br></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">GPUDiscreteGaussianImageFilter (0000000002205DF0)</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  RTTI typeinfo:   class itk::GPUDiscreteGaussianImageFilter<class itk::GPUImage<short,3>,class itk::GPUImage<short,3> ></span></p>



<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Reference Count: 1</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Modified Time: 560</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Debug: Off</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Object Name: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Observers: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    none</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Inputs: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Primary: (000000000216E560) *</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Indexed Inputs: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    0: Primary (000000000216E560)</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Required Input Names: Primary</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  NumberOfRequiredInputs: 1</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Outputs: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Primary: (000000000218A070)</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Indexed Outputs: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    0: Primary (000000000218A070)</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  NumberOfRequiredOutputs: 1</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Number Of Threads: 8</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  ReleaseDataFlag: Off</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  ReleaseDataBeforeUpdateFlag: Off</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  AbortGenerateData: Off</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Progress: 0</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Multithreader: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    RTTI typeinfo:   class itk::MultiThreader</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Reference Count: 1</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Modified Time: 499</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Debug: Off</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Object Name: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Observers: </span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">      none</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Thread Count: 8</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Global Maximum Number Of Threads: 128</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">    Global Default Number Of Threads: 8</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  CoordinateTolerance: 1e-006</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  DirectionTolerance: 1e-006</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  Variance: [4, 4, 4]</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  MaximumError: [0.01, 0.01, 0.01]</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  MaximumKernelWidth: 10</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  FilterDimensionality: 3</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  UseImageSpacing: 0</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  InternalNumberOfStreamDivisions: 9</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">  GPU: Enabled</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">GPU Gaussian Filter took 0.111351 seconds.</span></p>
<p style="font-size:10pt;font-family:Courier;margin:0px"><br></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">RMS Error : 26.4279</span></p>
<p style="margin:0px"><span style="font-size:10pt;font-family:Courier">RMS Error exceeds threshold (1.7e-005)</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;font-weight:600;color:rgb(0,0,170)">C:\DocsMaracuya\Build\Ejemplos\Gpu\GPUTest.exe exited with code 1</span></p></div><div><br></div><div><br>-- <br>José Ignacio Prieto<br>


celular(nuevo): 94348182
</div></div>
</div></blockquote></div></div><blockquote type="cite"><div><span>_____________________________________</span><br><span>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a></span><br><span></span><br>

<span>Visit other Kitware open-source projects at</span><br><span><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a></span><br><span></span><br>

<span>Kitware offers ITK Training Courses, for more information visit:</span><br><span><a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a></span><br>

<span></span><br><span>Please keep messages on-topic and check the ITK FAQ at:</span><br><span><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a></span><br><span></span><br><span>Follow this link to subscribe/unsubscribe:</span><br>

<span><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></span><br></div></blockquote></div></blockquote></div><br><br clear="all"><div><br></div>

-- <br>José Ignacio Prieto<br>celular(nuevo): 94348182
</div>
</div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div>