[Rtk-users] cast itk:::Image to itk::CudaImage

tao sun colddiesun at gmail.com
Wed Jan 30 11:04:43 EST 2019


Hi Simon,

CUDA_HAVE_GPU is on. So is CUDA_FOUND. I can run examples like rtkfdk with
gpu on without any problem though,
By the way I am using CUDA 9.2.88.

Tao





Simon Rit <simon.rit at creatis.insa-lyon.fr> 於 2019年1月30日 週三 上午1:25寫道:

> Hi,
> No, not really. In my experience, this occurs mainly when you don't have a
> GPU properly configured for CUDA. Can you check the value of CUDA_HAVE_GPU
> in cmake ? If it's OFF, then this is indeed the problem.
> Simon
>
> On Wed, Jan 30, 2019 at 1:23 AM tao sun <colddiesun at gmail.com> wrote:
>
>> Hi again,
>>
>> Finally I got time to work on this. I was able to compile the program
>> this time using the Graft() function. However, there's a runtime error when
>> I run the program:
>>
>>
>> /home/tsun/bin/RTK-1.4.0/utilities/ITKCudaCommon/src/itkCudaDataManager.cxx:38
>> @ unknown : Cuda Error #3
>>     terminate called after throwing an instance of 'itk::ExceptionObject'
>>     what():
>> /home/tsun/bin/RTK-1.4.0/utilities/ITKCudaCommon/src/itkCudaDataManager.cxx:38:
>>     Cuda Error # 3
>>     Aborted
>>
>> It happens when a new gpu backprojector is created:
>>     bp = rtk::CudaRayCastBackProjectionImageFilter::New();
>>
>> Any insights for this?
>>
>> Thanks,
>> Tao
>>
>> tao sun <colddiesun at gmail.com> 於 2019年1月19日 週六 下午8:51寫道:
>>
>>> Thank you all! I will give a try using your solutions.
>>> Tao
>>>
>>> Simon Rit <simon.rit at creatis.insa-lyon.fr> 於 2019年1月17日 週四 上午12:26寫道:
>>>
>>>> Hi,
>>>> That's one solution. Two other:
>>>> - graft the output to a Cuda image
>>>> itk::CudaImage<float, 3>::Pointer cuImg = itk::CudaImage<float,
>>>> 3>::New();
>>>> cuImg->Graft(projectionReader->GetOutput())
>>>> - use the rtk::ImportImageFilter which is templated over image type to
>>>> allow precisely this (I used it in Gate here
>>>> <https://github.com/OpenGATE/Gate/blob/develop/source/digits_hits/src/GateFixedForcedDetectionActor.cc#L1583>
>>>> ).
>>>> Best regards,
>>>> Simon
>>>>
>>>> On Wed, Jan 16, 2019 at 11:06 PM Andreas Andersen <
>>>> andreasga22 at gmail.com> wrote:
>>>>
>>>>> Hi Tao,
>>>>>
>>>>> I think you want the CastImageFilter
>>>>> <https://itk.org/Doxygen/html/classitk_1_1CastImageFilter.html> from
>>>>> ITK.
>>>>>
>>>>> Something like this:
>>>>> using castToImageType = itk::CastImageFilter<itk:::Image<float,3>,
>>>>> itk::CudaImage<float,3>>;
>>>>> typename castToImageType::Pointer castfilter = castToImageType::New();
>>>>> castfilter->SetInput(projectionReader->GetOutput());
>>>>> castfilter->Update();
>>>>> auto cuda_image = castfilter->GetOutput();
>>>>>
>>>>> Best regards Andreas
>>>>>
>>>>> __________________________________
>>>>>
>>>>> Andreas Gravgaard Andersen
>>>>>
>>>>> Department of Oncology,
>>>>>
>>>>> Aarhus University Hospital
>>>>>
>>>>> Nørrebrogade 44,
>>>>>
>>>>> 8000, Aarhus C
>>>>>
>>>>> Mail:     agravgaard at protonmail.com
>>>>>
>>>>> Cell:      +45 3165 8140
>>>>>
>>>>>
>>>>> On Wed, 16 Jan 2019 at 22:59, tao sun <colddiesun at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have read in some image using  itk::ImportImageFilter.
>>>>>>  ImportFilterType::Pointer projectionReader = ImportFilterType::New();
>>>>>> ...
>>>>>>  projectionReader->Update();
>>>>>>
>>>>>> The type of the image is itk:::Image<float,3>. I wonder if there is
>>>>>> any way I can cast it to itk::CudaImage<float,3>?
>>>>>> In rtkforwardprojections.cxx the imageReaderType is defined as
>>>>>> CudaImageType so there is no such problem.
>>>>>>
>>>>>> Thanks,
>>>>>> Tao
>>>>>> _______________________________________________
>>>>>> Rtk-users mailing list
>>>>>> Rtk-users at public.kitware.com
>>>>>> https://public.kitware.com/mailman/listinfo/rtk-users
>>>>>>
>>>>> _______________________________________________
>>>>> Rtk-users mailing list
>>>>> Rtk-users at public.kitware.com
>>>>> https://public.kitware.com/mailman/listinfo/rtk-users
>>>>>
>>>> _______________________________________________
>> Rtk-users mailing list
>> Rtk-users at public.kitware.com
>> https://public.kitware.com/mailman/listinfo/rtk-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/rtk-users/attachments/20190130/c9330874/attachment.html>


More information about the Rtk-users mailing list