<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hi ITK developers,</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I&#39;ve encounted an issue with the GPUDiscreteGaussianImageFilter in ITK 4.2, when used with a requested region that is not the same as the buffered region of the output image.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Here is the code, meant to smooth a region of the input image:</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><font face="courier new, monospace" style="color:rgb(34,34,34);font-size:13px;background-color:rgb(255,255,255)">#include &lt;itkImageFileWriter.h&gt;<br>

#include &lt;itkGPUImage.h&gt;<br>#include &lt;itkGPUDiscreteGaussianImageFilter.h&gt;<br>#include &lt;itkDiscreteGaussianImageFilter.h&gt;<br>#include &lt;itkRegionOfInterestImageFilter.h&gt;<br><br>int main(int argc, char *argv[])<br>

{<br>  itk::ObjectFactoryBase::RegisterFactory(itk::GPUImageFactory::New());<br><br>  typedef itk::GPUImage&lt;float, 3&gt; ImageType;<br>  typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br><br>  ReaderType::Pointer reader = ReaderType::New();<br>

  reader-&gt;SetFileName(argv[1]);<br>  reader-&gt;Update();<br><br>  typedef itk::GPUDiscreteGaussianImageFilter&lt;ImageType, ImageType&gt; FilterType;<br>  FilterType::Pointer filter = FilterType::New();<br>  filter-&gt;SetInput(reader-&gt;GetOutput());<br>

  filter-&gt;SetVariance(9.0);<br><br>  itk::ImageRegion&lt;3&gt; rr = reader-&gt;GetOutput()-&gt;GetBufferedRegion();<br>  rr.SetIndex(1, 64);<br>  rr.SetSize(1, 11);<br><br>  typedef itk::RegionOfInterestImageFilter&lt;ImageType, ImageType&gt; ROIType;<br>

  ROIType::Pointer roif = ROIType::New();<br>  roif-&gt;SetInput(filter-&gt;GetOutput());<br>  roif-&gt;SetRegionOfInterest(rr);<br><br>  typedef itk::ImageFileWriter&lt;ImageType&gt; WriterType;<br>  WriterType::Pointer writer = WriterType::New();<br>

  writer-&gt;SetInput(roif-&gt;GetOutput());<br>  writer-&gt;SetFileName(argv[2]);<br>  writer-&gt;Update();<br>}<br></font><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">When I execute the code above on a 3D image volume, I get garbled output (as if when copied from one buffer to another, the wrong stride was used). When I change &quot;</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">GPUDiscreteGaussianImageFilter</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">&quot; to &quot;</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">DiscreteGaussianImageFilter&quot;, I get the correctly smoothed output. All runs great when I don&#39;t use the ROI filter (perform processing on the whole volume).</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">The same problem happens if I use the GPUMeanImageFilter, so I suspect the problem is in the GPU neighborhood operator image filter.<br>

<div><br>Thanks!</div></div><div><br></div>-- <br>Paul A. Yushkevich, Ph.D. <br>Assistant Professor<br>Penn Image Computing and Science Laboratory<br>Department of Radiology<br>University of Pennsylvania<br><br>
<br><br>