Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b06adca
SPECTGPU:starting point; created SPECTGPU_projector folder and schel…
danieldeidda Mar 4, 2026
c948b16
forward line integrals
williamuic Mar 6, 2026
5d300cf
implemented a backward projection kernel in cuda
Mar 6, 2026
d4cd638
GPUSPECT: forward rotation and interpolation in cuda
Mar 6, 2026
9ca0e11
Adding kernel push
Mar 6, 2026
d731b5c
fixup! Adding kernel push
Mar 6, 2026
8dfbdd1
SPECTGPU: run pre-commit hooks on SPECTGPURotateAndGaussianInterpolate
Mar 6, 2026
aec9adf
joining all contributions; created an actual_forward_project() that …
danieldeidda Mar 6, 2026
edc60a8
fixup! joining all contributions; created an actual_forward_project(…
Mar 6, 2026
f91d680
SPECTGPU: creation of parfile for FP and BP;
danieldeidda Sep 9, 2026
e29f6f2
SPECTGPU: creation of parfile for FP and BP;
danieldeidda Sep 9, 2026
74a840c
SPECTGPU added Attenuation and depth dependent PSF;
danieldeidda Sep 14, 2026
e7cbf28
Update authorship in SPECTGPURotateAndGaussianInterpolate.cu
jchan192 Sep 14, 2026
5d162c3
Update SPECTGPUProjection.cu
jchan192 Sep 14, 2026
864c871
Update SPECTGPURotateAndGaussianInterpolate.cu
jchan192 Sep 14, 2026
8f0ab94
update contributors;
danieldeidda Sep 16, 2026
f79f532
relax condition of spacing
danieldeidda Sep 17, 2026
3c39f43
Merge branch 'UCL:master' into GPUSPECT
danieldeidda Sep 21, 2026
9413bf5
Working: adressing comments and keeping cxx class
danieldeidda Sep 23, 2026
e0eb2d6
Moving copying function definition into cuda_utilities.cu and instat…
danieldeidda Sep 23, 2026
b33fadf
Fixing scaling factor and pre-commit
danieldeidda Sep 23, 2026
bc28f3a
adding SPECTGPU recon test
danieldeidda Sep 25, 2026
c260566
adding python recon example
danieldeidda Sep 25, 2026
88e84be
skip SPECTGPU test if no CUDA run-time
KrisThielemans Sep 30, 2026
1257a9c
pre-commit: fix pymarkdown
casperdcl Oct 1, 2026
8f08cbc
fixing codacy issues and updating parfile
danieldeidda Oct 1, 2026
a9a3390
fixing bug on noPSF branch using empty blurred image in FP and additi…
danieldeidda Oct 2, 2026
f65ccee
Merge branch 'master' into GPUSPECT
danieldeidda Oct 2, 2026
7637dd4
To make things faster and given that all arrays are of the same size…
danieldeidda Oct 8, 2026
48d82ba
To make things faster and given that all arrays are of the same size…
danieldeidda Oct 8, 2026
708ddfe
reducing double exp() calculation in pull kernel for a little speed up;
danieldeidda Oct 12, 2026
dd22df7
reverting to cuda malloc(free) fixes problem with free()
danieldeidda Oct 15, 2026
eeabb81
adding working demo using SIMIND;
danieldeidda Oct 16, 2026
ecff145
exposing SPECTGPU to SWIGPy
danieldeidda Oct 16, 2026
b2276d2
making allocatedSatck it's own file; running FBP for SPECTGPU updatin…
danieldeidda Oct 19, 2026
e487850
moving SPECTGPU test within if stir_with_cuda
danieldeidda Oct 19, 2026
cf5d756
moving SPECTGPU test within if stir_with_cuda
danieldeidda Oct 19, 2026
a0d8edb
some clean up
danieldeidda Oct 19, 2026
208f897
hopefully fixing test error related to no GPU
danieldeidda Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
//
//
/*!
\file
\ingroup projection
\ingroup SPECTGPU

\brief Back projection class using SPECTGPU's GPU implementation.

\author Daniel Deidda

\todo SPECTGPU limitations -

\todo STIR wrapper limitations -
*/
/*
Copyright (C) 2026, National Physical Laboratory
This file is part of STIR.

SPDX-License-Identifier: Apache-2.0

See STIR/LICENSE.txt for details
*/
#ifndef __stir_gpu_BackProjectorByBinSPECTGPU_h__
#define __stir_gpu_BackProjectorByBinSPECTGPU_h__

#include "stir/RegisteredParsingObject.h"
#include "stir/recon_buildblock/BackProjectorByBin.h"
#include "stir/recon_buildblock/SPECTGPU_projector/SPECTGPUHelper.h"

START_NAMESPACE_STIR

class DataSymmetriesForViewSegmentNumbers;

/*!
\ingroup projection
\brief Class for SPECTGPU's GPU back projector
*/
class BackProjectorByBinSPECTGPU : public RegisteredParsingObject<BackProjectorByBinSPECTGPU, BackProjectorByBin>
{
public:
//! Name which will be used when parsing a BackProjectorByBin object
static const char* const registered_name;

//! Default constructor calls reset_timers()
BackProjectorByBinSPECTGPU();

virtual ~BackProjectorByBinSPECTGPU();

/// Keymap
virtual void initialise_keymap();

//! Stores all necessary geometric info
/*!
If necessary, set_up() can be called more than once.
*/
virtual void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
const shared_ptr<const DiscretisedDensity<3, float>>& density_info_sptr // TODO should be Info only
);

/// Back project
void back_project(const ProjData&, int subset_num = 0, int num_subsets = 1);

/// Get output
virtual void get_output(DiscretisedDensity<3, float>&) const;

/*! \brief tell the back projector to start accumulating into a new target.
This function has to be called before any back-projection is initiated.*/
virtual void start_accumulating_in_new_target();

/// Set verbosity
void set_verbosity(const bool verbosity) { _cuda_verbosity = verbosity; }

/// Set use truncation - truncate before forward
/// projection and after back projection
void set_use_truncation(const bool use_truncation) { _use_truncation = use_truncation; }

protected:
virtual void actual_back_project(const RelatedViewgrams<float>&,
const int min_axial_pos_num,
const int max_axial_pos_num,
const int min_tangential_pos_num,
const int max_tangential_pos_num);

virtual void actual_back_project(DiscretisedDensity<3, float>& stir_image,
const RelatedViewgrams<float>&,
const int min_axial_pos_num,
const int max_axial_pos_num,
const int min_tangential_pos_num,
const int max_tangential_pos_num);

private:
shared_ptr<DataSymmetriesForViewSegmentNumbers> _symmetries_sptr;
SPECTGPUHelper _helper;
int _cuda_device;
bool _cuda_verbosity;
std::vector<float> _np_sino;
bool _use_truncation;
};

END_NAMESPACE_STIR

#endif // __stir_gpu_BackProjectorByBinSPECTGPU_h__
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
//

#ifndef __stir_gpu_ForwardProjectorByBinSPECTGPU_h__
#define __stir_gpu_ForwardProjectorByBinSPECTGPU_h__
/*!
\file
\ingroup projection
\ingroup SPECTGPU

\brief Forward projection class using SPECTGPU's GPU implementation.

\author Daniel Deidda

\todo SPECTGPU limitations -

\todo STIR wrapper limitations -

*/
/*
Copyright (C) 2026, National Physical Laboratory
This file is part of STIR.

SPDX-License-Identifier: Apache-2.0

See STIR/LICENSE.txt for details
*/

#include "stir/RegisteredParsingObject.h"
#include "stir/recon_buildblock/ForwardProjectorByBin.h"
#include "stir/recon_buildblock/SPECTGPU_projector/SPECTGPUHelper.h"

START_NAMESPACE_STIR

class ProjDataInMemory;
class DataSymmetriesForViewSegmentNumbers;

/*!
\ingroup projection
\brief Class for SPECTGPU's GPU forward projector.
*/
class ForwardProjectorByBinSPECTGPU : public RegisteredParsingObject<ForwardProjectorByBinSPECTGPU, ForwardProjectorByBin>
{
public:
//! Name which will be used when parsing a ForwardProjectorByBin object
static const char* const registered_name;

//! Default constructor calls reset_timers()
// inline
ForwardProjectorByBinSPECTGPU();

/// Constructor
virtual ~ForwardProjectorByBinSPECTGPU();

/// Keymap
virtual void initialise_keymap();

//! Stores all necessary geometric info
/*!
If necessary, set_up() can be called more than once.

Derived classes can assume that forward_project() will be called
with input corresponding to the arguments of the last call to set_up().

\warning there is currently no check on this.
\warning Derived classes have to call set_up from the base class.
*/
virtual void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
const shared_ptr<const DiscretisedDensity<3, float>>& density_info_sptr // TODO should be Info only
);

/// Set input
virtual void set_input(const DiscretisedDensity<3, float>&);

/// Set verbosity
void set_verbosity(const bool verbosity) { _cuda_verbosity = verbosity; }

/// Set use truncation - truncate before forward
/// projection and after back projection
void set_use_truncation(const bool use_truncation) { _use_truncation = use_truncation; }

protected:
//! This virtual function has to be implemented by the derived class.
virtual void actual_forward_project(RelatedViewgrams<float>&,
const DiscretisedDensity<3, float>&,
const int min_axial_pos_num,
const int max_axial_pos_num,
const int min_tangential_pos_num,
const int max_tangential_pos_num);

virtual void actual_forward_project(RelatedViewgrams<float>& viewgrams,
const int min_axial_pos_num,
const int max_axial_pos_num,
const int min_tangential_pos_num,
const int max_tangential_pos_num);

protected:
struct cppdim3
{
int x;
int y;
int z;
};

int z_dim, y_dim, x_dim;
cppdim3 block_dim;
cppdim3 grid_dim;

private:
shared_ptr<ProjDataInMemory> _projected_data_sptr;
SPECTGPUHelper _helper;
int _cuda_device;
bool _cuda_verbosity;
bool _use_truncation;
};

END_NAMESPACE_STIR

#endif // __stir_gpu_ForwardProjectorByBinSPECTGPU_h__
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
//
/*
Copyright (C) 2026, National Physical Laboratory
This file is part of STIR.

SPDX-License-Identifier: Apache-2.0

See STIR/LICENSE.txt for details
*/
/*!
\file
\ingroup projection
\ingroup SPECTGPU

\brief Declares class stir::ProjectorByBinPairUsingSPECTGPU

\author Daniel Deidda

*/
#ifndef __stir_recon_buildblock_ProjectorByBinPairUsingSPECTGPU_h_
#define __stir_recon_buildblock_ProjectorByBinPairUsingSPECTGPU_h_

#include "stir/RegisteredParsingObject.h"
#include "stir/recon_buildblock/ProjectorByBinPair.h"

START_NAMESPACE_STIR

class Succeeded;
/*!
\ingroup projection
\brief A projector pair based on SPECTGPU projectors
*/
class ProjectorByBinPairUsingSPECTGPU
: public RegisteredParsingObject<ProjectorByBinPairUsingSPECTGPU, ProjectorByBinPair, ProjectorByBinPair>
{
private:
typedef RegisteredParsingObject<ProjectorByBinPairUsingSPECTGPU, ProjectorByBinPair, ProjectorByBinPair> base_type;

public:
//! Name which will be used when parsing a ProjectorByBinPair object
static const char* const registered_name;

//! Default constructor
ProjectorByBinPairUsingSPECTGPU();

/// Set verbosity
void set_verbosity(const bool verbosity);

/// Set use truncation - truncate before forward
/// projection and after back projection
void set_use_truncation(const bool use_truncation);

private:
void set_defaults();
void initialise_keymap();
bool post_processing();
bool _verbosity;
bool _use_truncation;
};

END_NAMESPACE_STIR

#endif // __stir_recon_buildblock_ProjectorByBinPairUsingSPECTGPU_h_
Loading