Skip to content

Commit

Permalink
Made step size configurable in cuda forward projector
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rit committed Jul 21, 2014
1 parent 6e040cb commit fb62489
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ int main(int argc, char * argv[])
case(fp_arg_CudaRayCast):
#ifdef RTK_USE_CUDA
forwardProjection = rtk::CudaForwardProjectionImageFilter::New();
dynamic_cast<rtk::CudaForwardProjectionImageFilter*>( forwardProjection.GetPointer() )->SetStepSize(args_info.step_arg);
#else
std::cerr << "The program has not been compiled with cuda option" << std::endl;
return EXIT_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option "config" - "Config file"
option "geometry" g "XML geometry file name" string yes
option "input" i "Input volume file name" string yes
option "output" o "Output projections file name" string yes
option "step" s "Step size along ray (for CudaRayCast only)" double no default="1"

section "Projectors"
option "fp" f "Forward projection method" values="Joseph","RayCastInterpolator","CudaRayCast" enum no default="Joseph"
Expand Down
6 changes: 3 additions & 3 deletions code/rtkCudaForwardProjectionImageFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ namespace rtk
{

CudaForwardProjectionImageFilter
::CudaForwardProjectionImageFilter()
::CudaForwardProjectionImageFilter():
m_StepSize(1)
{
}

Expand All @@ -46,7 +47,6 @@ ::GPUGenerateData()
const unsigned int nPixelsPerProj = this->GetOutput()->GetBufferedRegion().GetSize(0) *
this->GetOutput()->GetBufferedRegion().GetSize(1);

float t_step = 1; // Step in mm
itk::Vector<double, 4> source_position;

// Setting BoxMin and BoxMax
Expand Down Expand Up @@ -119,7 +119,7 @@ ::GPUGenerateData()
(float*)&(matrix[0][0]),
pout + nPixelsPerProj * projectionOffset,
pvol,
t_step,
m_StepSize,
(double*)&(source_position[0]),
boxMin,
boxMax,
Expand Down
5 changes: 5 additions & 0 deletions code/rtkCudaForwardProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class ITK_EXPORT CudaForwardProjectionImageFilter :
/** Run-time type information (and related methods). */
itkTypeMacro(CudaForwardProjectionImageFilter, ImageToImageFilter);

/** Set step size along ray (in mm). Default is 1 mm. */
itkGetConstMacro(StepSize, double);
itkSetMacro(StepSize, double);

protected:
rtkcuda_EXPORT CudaForwardProjectionImageFilter();
~CudaForwardProjectionImageFilter() {};
Expand All @@ -81,6 +85,7 @@ class ITK_EXPORT CudaForwardProjectionImageFilter :
CudaForwardProjectionImageFilter(const Self&);
void operator=(const Self&);

double m_StepSize;
int m_VolumeDimension[3];
int m_ProjectionDimension[2];
float * m_DeviceVolume;
Expand Down

0 comments on commit fb62489

Please sign in to comment.