Hi Chao, Thanks for the report. I agree this is bug, do you mind opening an issue on github? I think the reason is the following: - In GenerageData <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageGrid/include/itkChangeInformationImageFilter.hxx#L185> of ChangeImageInformationImageFilter, SetPixelContainer is called, - itk::CudaImage::SetPixelContainer <https://github.com/SimonRit/RTK/blob/master/utilities/ITKCudaCommon/include/itkCudaImage.hxx#L163> will not work if the GPUBuffer is clean and not the CPU buffer: the data is in the GPUBuffer, which is dropped, and the CPU buffer is as clean as what the input gave. I can't find a solution at this time so opening an issue makes sense. Thanks in advance! Simon
On Fri, Jul 20, 2018 at 1:26 PM, Chao Wu <[email protected]> wrote: > Hi all, > > 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 ChangeInformationImageFilter is inserted > before a CPU filter. > > The issue can be reproduced with the rtkSartCudaTest and the following > patch: > > ======================================================================== > *File: include/rtkSARTConeBeamReconstructionFilter.hxx* >> >> > @@ -18,10 +18,11 @@ > > #ifndef rtkSARTConeBeamReconstructionFilter_hxx > #define rtkSARTConeBeamReconstructionFilter_hxx > > #include "rtkSARTConeBeamReconstructionFilter.h" > +#include <itkChangeInformationImageFilter.h> > > #include <algorithm> > > namespace rtk > { > @@ -282,10 +283,15 @@ SARTConeBeamReconstructionFilter<TVolumeImage, > TProjectionImage> > > // Declare the image used in the main loop > typename TVolumeImage::Pointer pimg; > typename TVolumeImage::Pointer norm; > > + // test: insert itkChangeInformationImageFilter > + itk::ChangeInformationImageFilter<VolumeType>::Pointer change = itk:: > ChangeInformationImageFilter<VolumeType>::New(); > + change->SetInput(this->GetInput(0)); > + m_ForwardProjectionFilter->SetInput(1, change->GetOutput()); > + > // For each iteration, go over each projection > for(unsigned int iter = 0; iter < m_NumberOfIterations; iter++) > { > unsigned int projectionsProcessedInSubset = 0; > for(unsigned int i = 0; i < nProj; i++) > @@ -326,11 +332,11 @@ SARTConeBeamReconstructionFilter<TVolumeImage, > TProjectionImage> > else > pimg = m_AddFilter->GetOutput(); > pimg->Update(); > pimg->DisconnectPipeline(); > > - m_ForwardProjectionFilter->SetInput(1, pimg ); > + change->SetInput(pimg); > m_AddFilter->SetInput2(pimg); > m_BackProjectionFilter->SetInput(0, m_ConstantVolumeSource-> > GetOutput()); > m_BackProjectionNormalizationFilter->SetInput(0, > m_ConstantVolumeSource->GetOutput()); > > projectionsProcessedInSubset = 0; > ======================================================================== > > Results from the rtkSartCudaTest: > > ****** Case 1: Voxel-Based Backprojector ****** > > Error per Pixel = 0.0206672 > MSE = 0.00282352 > PSNR = 31.5127dB > QI = 0.989666 > > > Test PASSED! > > > ****** Case 2: Voxel-Based Backprojector, OS-SART with 2 projections per > subset ****** > > Error per Pixel = 0.0225105 > MSE = 0.00346037 > PSNR = 30.6294dB > QI = 0.988745 > > > Test PASSED! > > > ****** Case 3: Joseph Backprojector ****** > > Error per Pixel = 0.0189275 > MSE = 0.00259909 > PSNR = 31.8724dB > QI = 0.990536 > > > Test PASSED! > > > ****** Case 4: CUDA Voxel-Based Backprojector ****** > > Error per Pixel = 16.5716 > MSE = 525.278 > PSNR = -21.1833dB > QI = -7.28582 > Test Failed, Error per pixel not valid! 16.5716 instead of 0.032 > > > Best regards, > Chao > > _______________________________________________ > Rtk-users mailing list > [email protected] > https://public.kitware.com/mailman/listinfo/rtk-users > >
_______________________________________________ Rtk-users mailing list [email protected] https://public.kitware.com/mailman/listinfo/rtk-users
