elastix
elastix copied to clipboard
OpenCLResampler gives wrong result
I have compiled elastix 5.0 with OpenCL (win64, OpenCL 2.0, VS 2017, ITK 5.0.1) and everything seems to work fine.
However when I was testing GPU vs CPU I noticed that the GPU result was wrong but the CPU were not. I have checked all the logging and elastix seems to do exactly the same for the CPU and GPU and the transform parameters and all other outputs are identical. However, the results were definitely not.
elastix-OpenCL.log elastix.log
EDIT:
while using the OpenCLResampler but setting (OpenCLResamplerUseOpenCL "false") the result is correct again.
EDIT 2:
After some further testing the error is only happening when using the "AffineDTITransform" for all other transforms the result is as expected
Hi @mfroeling, thanks for taking the time to investigate this issue! We applied some recent changes that fix bugs related to the OpenCL resampler, please see #741. I know that it has been a while since you raised the issue, however, can you test if the error persists using the latest main
branch?
@ntatsisk i will compile and test as soon i have some time and let you know the outcome. Thanks for the update!
@ntatsisk i managed to reproduce the test. (win64, OpenCL 3.0.1, VS 2019, ITK 5.3) your fix did not solve my problem.
CPU AffineTransform vs AffineDTITransform
GPU AffineTransform vs AffineDTITransform
CPU vs GPU AffineDTITransform
What i did notice now looking at the outputs is that every method gives the same result. However the AffineDTITransform the MatrixTranslation is the matrix needed for the correct translation which for the AffineTransform is stored in the TransformParameters.
So my guess now is that the OpenCLResampler uses the TransformParameters always but for the AffineDTITransform it should rather use the MatrixTranslation.
Best Martijn