<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'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 <itkImageFileWriter.h><br>
#include <itkGPUImage.h><br>#include <itkGPUDiscreteGaussianImageFilter.h><br>#include <itkDiscreteGaussianImageFilter.h><br>#include <itkRegionOfInterestImageFilter.h><br><br>int main(int argc, char *argv[])<br>
{<br> itk::ObjectFactoryBase::RegisterFactory(itk::GPUImageFactory::New());<br><br> typedef itk::GPUImage<float, 3> ImageType;<br> typedef itk::ImageFileReader<ImageType> ReaderType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName(argv[1]);<br> reader->Update();<br><br> typedef itk::GPUDiscreteGaussianImageFilter<ImageType, ImageType> FilterType;<br> FilterType::Pointer filter = FilterType::New();<br> filter->SetInput(reader->GetOutput());<br>
filter->SetVariance(9.0);<br><br> itk::ImageRegion<3> rr = reader->GetOutput()->GetBufferedRegion();<br> rr.SetIndex(1, 64);<br> rr.SetSize(1, 11);<br><br> typedef itk::RegionOfInterestImageFilter<ImageType, ImageType> ROIType;<br>
ROIType::Pointer roif = ROIType::New();<br> roif->SetInput(filter->GetOutput());<br> roif->SetRegionOfInterest(rr);<br><br> typedef itk::ImageFileWriter<ImageType> WriterType;<br> WriterType::Pointer writer = WriterType::New();<br>
writer->SetInput(roif->GetOutput());<br> writer->SetFileName(argv[2]);<br> writer->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 "</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)">" to "</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">DiscreteGaussianImageFilter", I get the correctly smoothed output. All runs great when I don'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>