[Rtk-users] CUDA projections are blank
Simon Rit
simon.rit at creatis.insa-lyon.fr
Wed May 25 15:45:57 EDT 2016
Hi Solomon,
I had still to look into this on my todo list. I did again but now I think
I overlooked something in your email. You say that going through
ChangeInformationImageFilter might be the problem. But now, I wonder if the
problem is not that the origin that you set is wrong and then the volume or
the projections are completely off (hence the projections).
So, here is my question : what happens if you replace
filter -> SetOutputOrigin(origin);
with
filter -> SetOutputOrigin(image->GetOutputOrigin());
Of course, it's not what you want to do but it might point to a wrong
choice of origin...
Simon
On Fri, May 6, 2016 at 1:45 AM, Solomon Tang <solomoncztang at gmail.com>
wrote:
> Hi Simon,
>
> I added the line as you suggested and it does not change the output (still
> blank). Sorry for the delayed response.
>
> Thanks for looking into it!
>
> On Wed, May 4, 2016 at 12:16 AM, Simon Rit <simon.rit at creatis.insa-lyon.fr
> > wrote:
>
>> Dear Solomon,
>> Thanks for the report. It looks like a bug to me. I checked and
>> itk::ChangeInformationImageFilter calls GetPixelContainer and, indeed, in
>> the itkGPUImage and the itkCudaImage, this function does not check
>> consistency between CPU and GPU data. I'll work on a minimal example to
>> check this but can you test that your problem is solved if you add
>> m_DataManager->UpdateCPUBuffer();
>> before
>> m_DataManager->SetGPUBufferDirty();
>> in itkCudaImage.h line 121?
>> Thanks,
>> Simon
>>
>> On Mon, May 2, 2016 at 10:42 PM, Solomon Tang <solomoncztang at gmail.com>
>> wrote:
>>
>>> Thanks for the tip Simon,
>>>
>>> I think I may have figured it out. I initially read as a CUDA Image, and
>>> then passed the CUDA image through ChangeInformationImageFilter to change
>>> the offset of the image.
>>>
>>> template <class T, int IM_DIM>
>>> typename itk::CudaImage<T, IM_DIM>::Pointer ShiftOffset(
>>> const typename itk::CudaImage<T, IM_DIM>::Pointer image,
>>> const typename itk::Image<T,IM_DIM>::PointType origin)
>>> {
>>> typedef itk::ChangeInformationImageFilter< itk::CudaImage<T,IM_DIM> >
>>> FilterType;
>>> FilterType::Pointer filter = FilterType::New();
>>> filter -> SetInput(image);
>>> filter -> SetOutputOrigin(origin);
>>> filter -> ChangeOriginOn();
>>> filter -> UpdateOutputInformation();
>>> filter -> Update();
>>> return filter->GetOutput();
>>> }
>>>
>>> If I pass the offset image pointer to ForwardProjection, it outputs a
>>> blank image.
>>>
>>> However, when I write the offset image and then read it again as a CUDA
>>> image, then the ForwardProjection works as intended. Perhaps using the CUDA
>>> version of ITK would fix this.
>>>
>>>
>>> On Sat, Apr 30, 2016 at 12:08 AM, Simon Rit <
>>> simon.rit at creatis.insa-lyon.fr> wrote:
>>>
>>>> Hi Solomon,
>>>> Hard to say without the full code. Maybe the cudaness of your output
>>>> image is lost further in the code. Try accessing the CPU buffer at the end,
>>>> after the update, to be sure that the GPU image is transferred to CPU, e.g.
>>>> std::cout << forwardProjection->GetOutput()->GetPointer() <<std::endl;
>>>> Simon
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20160525/70e36b69/attachment-0010.html>
More information about the Rtk-users
mailing list