[Rtk-users] CUDA projections are blank

Solomon Tang solomoncztang at gmail.com
Fri Apr 29 18:14:42 EDT 2016


Hi Simon,

I am currently trying to create an alternate version of
rtkforwardprojection that takes an image pointer as an input and returns
the projection without using the GGO parser.

It is very similar to the original with some minor adjustments to determine
size and spacing. It currently works as intended when the forwardprojection
flag type is set to use the JosephForwardProjectionImageFilter, however it
returns a blank image with the correct spacing and dimensions when using
the CudaForwardProjectionImageFilter.

Cuda is installed on my machine and the original rtkforwardprojection with
cuda also works as intended. I have included a snippet of code and attached
the header file containing the function if anyone wants to help me out on
this one.

Thanks!

Solomon


....
rtk::ForwardProjectionImageFilter<OutputImageType,
OutputImageType>::Pointer forwardProjection;

  switch(fp_flag)
  {
  case(1):
    forwardProjection =
rtk::JosephForwardProjectionImageFilter<OutputImageType,
OutputImageType>::New();
    break;
  case(2):
    forwardProjection =
rtk::RayCastInterpolatorForwardProjectionImageFilter<OutputImageType,
OutputImageType>::New();
    break;
  case(3): //This section does not work as intended, even though it almost
exactly the same as original (SetStepSize argument is different)
#ifdef RTK_USE_CUDA
forwardProjection = rtk::CudaForwardProjectionImageFilter<OutputImageType,
OutputImageType>::New();
dynamic_cast<rtk::CudaForwardProjectionImageFilter<OutputImageType,
OutputImageType>*>( forwardProjection.GetPointer()
)->SetStepSize(spacingOutput[2]);
#else
std::cerr << "The program has not been compiled with cuda option" <<
std::endl;
return EXIT_FAILURE;
#endif
    break;
  default:
throw std::exception("Unhandled --method value.");
   /* std::cerr << "Unhandled --method value." << std::endl;
    return EXIT_FAILURE;*/
  }
  forwardProjection->SetInput( constantImageSource->GetOutput() );
  forwardProjection->SetInput(1, input_image );
  forwardProjection->SetGeometry( geometryReader->GetOutputObject() );
  projProbe.Start();
  if(lowmem_flag)
    {
TRY_AND_EXIT_ON_ITK_EXCEPTION( forwardProjection->Update() );
    }
  projProbe.Stop();

.....

return forwardProjection->GetOutput();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20160429/7e362638/attachment-0009.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ForwardProject3.h
Type: text/x-chdr
Size: 7066 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20160429/7e362638/attachment-0009.h>


More information about the Rtk-users mailing list