<div dir="ltr">Hi all,<div><br></div><div>There seems to be a CPU-GPU synchronization issue if an itk::ChangeInformationImageFilter<itk::CudaImage<...>> is inserted before a Cuda filter. It works if the <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ChangeInformationImageFilter is inserted before a CPU filter.</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>The issue can be reproduced with the rtkSartCudaTest and the following patch:</div><div><br></div><div>========================================================================</div><b><font face="monospace, monospace">File: include/rtkSARTConeBeamReconstructionFilter.hxx</font></b><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote><font face="monospace, monospace"><br></font><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote><div><font face="monospace, monospace">@@ -18,10 +18,11 @@</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> #ifndef rtkSARTConeBeamReconstructionFilter_hxx</font></div><div><font face="monospace, monospace"> #define rtkSARTConeBeamReconstructionFilter_hxx</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> #include "rtkSARTConeBeamReconstructionFilter.h"</font></div><div><font face="monospace, monospace" color="#38761d">+#include <itkChangeInformationImageFilter.h></font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> #include <algorithm></font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> namespace rtk</font></div><div><font face="monospace, monospace"> {</font></div><div><font face="monospace, monospace">@@ -282,10 +283,15 @@ SARTConeBeamReconstructionFilter<TVolumeImage, TProjectionImage></font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> // Declare the image used in the main loop</font></div><div><font face="monospace, monospace"> typename TVolumeImage::Pointer pimg;</font></div><div><font face="monospace, monospace"> typename TVolumeImage::Pointer norm;</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace" color="#38761d">+ // test: insert itkChangeInformationImageFilter</font></div><div><font face="monospace, monospace" color="#38761d">+ itk::ChangeInformationImageFilter<VolumeType>::Pointer change = itk::ChangeInformationImageFilter<VolumeType>::New();</font></div><div><font face="monospace, monospace" color="#38761d">+ change->SetInput(this->GetInput(0));</font></div><div><font face="monospace, monospace" color="#38761d">+ m_ForwardProjectionFilter->SetInput(1, change->GetOutput());</font></div><div><font face="monospace, monospace" color="#38761d">+</font></div><div><font face="monospace, monospace"> // For each iteration, go over each projection</font></div><div><font face="monospace, monospace"> for(unsigned int iter = 0; iter < m_NumberOfIterations; iter++)</font></div><div><font face="monospace, monospace"> {</font></div><div><font face="monospace, monospace"> unsigned int projectionsProcessedInSubset = 0;</font></div><div><font face="monospace, monospace"> for(unsigned int i = 0; i < nProj; i++)</font></div><div><font face="monospace, monospace">@@ -326,11 +332,11 @@ SARTConeBeamReconstructionFilter<TVolumeImage, TProjectionImage></font></div><div><font face="monospace, monospace"> else</font></div><div><font face="monospace, monospace"> pimg = m_AddFilter->GetOutput();</font></div><div><font face="monospace, monospace"> pimg->Update();</font></div><div><font face="monospace, monospace"> pimg->DisconnectPipeline();</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace" color="#ff0000">- m_ForwardProjectionFilter->SetInput(1, pimg );</font></div><div><font face="monospace, monospace" color="#38761d">+ change->SetInput(pimg);</font></div><div><font face="monospace, monospace"> m_AddFilter->SetInput2(pimg);</font></div><div><font face="monospace, monospace"> m_BackProjectionFilter->SetInput(0, m_ConstantVolumeSource->GetOutput());</font></div><div><font face="monospace, monospace"> m_BackProjectionNormalizationFilter->SetInput(0, m_ConstantVolumeSource->GetOutput());</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> projectionsProcessedInSubset = 0;</font></div><div>======================================================================== <br></div><div><br></div><div>Results from the
<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">rtkSartCudaTest</span>:</div><div><br></div><div><div><font face="monospace, monospace">****** Case 1: Voxel-Based Backprojector ******</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Error per Pixel = 0.0206672</font></div><div><font face="monospace, monospace">MSE = 0.00282352</font></div><div><font face="monospace, monospace">PSNR = 31.5127dB</font></div><div><font face="monospace, monospace">QI = 0.989666</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Test PASSED!</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">****** Case 2: Voxel-Based Backprojector, OS-SART with 2 projections per subset ******</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Error per Pixel = 0.0225105</font></div><div><font face="monospace, monospace">MSE = 0.00346037</font></div><div><font face="monospace, monospace">PSNR = 30.6294dB</font></div><div><font face="monospace, monospace">QI = 0.988745</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Test PASSED!</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">****** Case 3: Joseph Backprojector ******</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Error per Pixel = 0.0189275</font></div><div><font face="monospace, monospace">MSE = 0.00259909</font></div><div><font face="monospace, monospace">PSNR = 31.8724dB</font></div><div><font face="monospace, monospace">QI = 0.990536</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Test PASSED!</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">****** Case 4: CUDA Voxel-Based Backprojector ******</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Error per Pixel = 16.5716</font></div><div><font face="monospace, monospace">MSE = 525.278</font></div><div><font face="monospace, monospace">PSNR = -21.1833dB</font></div><div><font face="monospace, monospace">QI = -7.28582</font></div><div><font face="monospace, monospace">Test Failed, Error per pixel not valid! 16.5716 instead of 0.032</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Best regards,</font></div><div><font face="arial, helvetica, sans-serif">Chao</font></div></div>