Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into NoBoostIteratorAdaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisThielemans committed Jun 7, 2024
2 parents ebc1fa6 + 982a5f8 commit b897a58
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/include/stir/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Array : public NumericVectorWithOffset<Array<num_dimensions - 1, elemT>, e
\c data_sptr.get() block. Therefore, any modifications to the array will modify the data at \c data_sptr.get().
This will be true until the Array is resized.
The C-array \data_ptr will be accessed with the last dimension running fastest
The C-array \a data_ptr will be accessed with the last dimension running fastest
("row-major" order).
*/
inline Array(const IndexRange<num_dimensions>& range, shared_ptr<elemT[]> data_sptr);
Expand Down
1 change: 1 addition & 0 deletions src/include/stir/Array.inl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Array<num_dimensions, elemT>::is_contiguous() const
if (mem != &(*(*this)[i + 1].begin_all()))
return false;
}
return true;
}

template <int num_dimensions, typename elemT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ class BinNormalisationFromAttenuationImage
*/
Succeeded set_up(const shared_ptr<const ExamInfo>& exam_info_sptr, const shared_ptr<const ProjDataInfo>&) override;

// import all apply/undo methods from base-class (we'll override some below)
using base_type::apply;
using base_type::undo;

//! Normalise some data
/*!
This means \c multiply with the data in the projdata object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ class BinNormalisationFromProjData : public RegisteredParsingObject<BinNormalisa
with the ProjDataInfo supplied. */
Succeeded set_up(const shared_ptr<const ExamInfo>& exam_info_sptr, const shared_ptr<const ProjDataInfo>&) override;

// import all apply/undo methods from base-class (we'll override some below)
using base_type::apply;
using base_type::undo;

//! Normalise some data
/*!
This means \c multiply with the data in the projdata object
passed in the constructor.
*/

void apply(RelatedViewgrams<float>& viewgrams) const override;

//! Undo the normalisation of some data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ class BinNormalisationPETFromComponents : public BinNormalisation
/*! Compares the stored ProjDataInfo with the ProjDataInfo supplied. */
Succeeded set_up(const shared_ptr<const ExamInfo>& exam_info_sptr, const shared_ptr<const ProjDataInfo>&) override;

// import all apply/undo methods from base-class (we'll override some below)
using base_type::apply;
using base_type::undo;

//! Normalise some data
/*!
This means \c divide with the efficiency model. 0/0 is set to 0.
*/

void apply(RelatedViewgrams<float>& viewgrams) const override;

using base_type::apply;
//! Undo the normalisation of some data
/*!
This means \c multiply with the efficiency model.
*/
void undo(RelatedViewgrams<float>& viewgrams) const override;
using base_type::undo;

float get_bin_efficiency(const Bin& bin) const override;

#if 0
Expand Down
4 changes: 4 additions & 0 deletions src/include/stir/recon_buildblock/BinNormalisationSPECT.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class BinNormalisationSPECT

float get_dead_time_efficiency(const DetectionPosition<>& det_pos, const double start_time, const double end_time) const;

// import all apply/undo methods from base-class (we'll override some below)
using base_type::apply;
using base_type::undo;

void apply(RelatedViewgrams<float>& viewgrams) const override;

void undo(RelatedViewgrams<float>& viewgrams) const override;
Expand Down
5 changes: 4 additions & 1 deletion src/include/stir/recon_buildblock/ChainedBinNormalisation.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ class ChainedBinNormalisation : public RegisteredParsingObject<ChainedBinNormali
/*! Calls set_up for the BinNormalisation members. */
Succeeded set_up(const shared_ptr<const ExamInfo>& exam_info_sptr, const shared_ptr<const ProjDataInfo>&) override;

// import all apply/undo methods from base-class (we'll override some below)
using base_type::apply;
using base_type::undo;

//! Normalise some data
/*!
This calls apply() of the 2 BinNormalisation members
*/

void apply(RelatedViewgrams<float>& viewgrams) const override;
#if 0
virtual void apply(ProjData&) const override;
Expand Down
2 changes: 2 additions & 0 deletions src/swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ set(swig_stir_dependencies
stir_coordinates.i
stir_dataprocessors.i
stir_exam.i
stir_LOR.i
stir_normalisation.i
stir_objectivefunctions.i
stir_priors.i
stir_projdata_coords.i
stir_projdata.i
stir_listmode.i
stir_projectors.i
Expand Down
3 changes: 2 additions & 1 deletion src/swig/stir.i
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,10 @@ ADD_REPR(stir::Succeeded, %arg($self->succeeded() ? "yes" : "no"));
%include "stir_exam.i"

%shared_ptr(stir::DataSymmetriesForViewSegmentNumbers);
%include "stir_projdata_coords.i"
%include "stir/DataSymmetriesForViewSegmentNumbers.h"
%include "stir_projdata.i"
%include "stir_listmode.i"
%include "stir/DataSymmetriesForViewSegmentNumbers.h"

%include "stir_voxels.i"
%include "stir_voxels_IO.i"
Expand Down
34 changes: 1 addition & 33 deletions src/swig/stir_projdata.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,6 @@
%shared_ptr(stir::Sinogram<float>);
%shared_ptr(stir::Viewgram<float>);

%shared_ptr(stir::DetectionPosition<unsigned int>);
%shared_ptr(stir::DetectionPositionPair<unsigned int>);

%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, tangential_coord);
%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, axial_coord);
%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, radial_coord);
%include "stir/DetectionPosition.h"
ADD_REPR(stir::DetectionPosition, %arg(*$self))
%template(DetectionPosition) stir::DetectionPosition<unsigned int>;

%attributeref(stir::DetectionPositionPair<unsigned int>, int, timing_pos);
%attributeref(stir::DetectionPositionPair<unsigned int>, stir::DetectionPosition<unsigned int>, pos1);
%attributeref(stir::DetectionPositionPair<unsigned int>, stir::DetectionPosition<unsigned int>, pos2);
%include "stir/DetectionPositionPair.h"
ADD_REPR(stir::DetectionPositionPair, %arg(*$self))
%template(DetectionPositionPair) stir::DetectionPositionPair<unsigned int>;

%attributeref(stir::SegmentIndices, int, segment_num);
%attributeref(stir::SegmentIndices, int, timing_pos_num);
%attributeref(stir::ViewgramIndices, int, view_num);
%attributeref(stir::SinogramIndices, int, axial_pos_num);
%attributeref(stir::Bin, int, axial_pos_num);
%attributeref(stir::Bin, int, tangential_pos_num);
%attributeref(stir::Bin, int, timing_pos_num);
%attributeref(stir::Bin, int, time_frame_num);
%attribute(stir::Bin, float, bin_value, get_bin_value, set_bin_value);
%include "stir/SegmentIndices.h"
%include "stir/ViewgramIndices.h"
%include "stir/SinogramIndices.h"
%include "stir/Bin.h"
ADD_REPR(stir::Bin, %arg(*$self))


%newobject stir::Scanner::get_scanner_from_name;
%include "stir/Scanner.h"

Expand Down Expand Up @@ -264,6 +231,7 @@ namespace stir {

namespace stir {
%template(FloatViewgram) Viewgram<float>;
%template(FloatRelatedViewgrams) RelatedViewgrams<float>;
%template(FloatSinogram) Sinogram<float>;
// TODO don't want to give a name
%template(FloatSegment) Segment<float>;
Expand Down
46 changes: 46 additions & 0 deletions src/swig/stir_projdata_coords.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright (C) 2023, 2024 University College London
This file is part of STIR.
SPDX-License-Identifier: Apache-2.0
See STIR/LICENSE.txt for details
*/
/*!
\file
\brief Interface file for SWIG: stir::Bin, stir:DetectionPosition etc
\author Kris Thielemans
*/

%shared_ptr(stir::DetectionPosition<unsigned int>);
%shared_ptr(stir::DetectionPositionPair<unsigned int>);

%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, tangential_coord);
%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, axial_coord);
%attributeref(stir::DetectionPosition<unsigned int>, unsigned int, radial_coord);
%include "stir/DetectionPosition.h"
ADD_REPR(stir::DetectionPosition, %arg(*$self))
%template(DetectionPosition) stir::DetectionPosition<unsigned int>;

%attributeref(stir::DetectionPositionPair<unsigned int>, int, timing_pos);
%attributeref(stir::DetectionPositionPair<unsigned int>, stir::DetectionPosition<unsigned int>, pos1);
%attributeref(stir::DetectionPositionPair<unsigned int>, stir::DetectionPosition<unsigned int>, pos2);
%include "stir/DetectionPositionPair.h"
ADD_REPR(stir::DetectionPositionPair, %arg(*$self))
%template(DetectionPositionPair) stir::DetectionPositionPair<unsigned int>;

%attributeref(stir::SegmentIndices, int, segment_num);
%attributeref(stir::SegmentIndices, int, timing_pos_num);
%attributeref(stir::ViewgramIndices, int, view_num);
%attributeref(stir::SinogramIndices, int, axial_pos_num);
%attributeref(stir::Bin, int, axial_pos_num);
%attributeref(stir::Bin, int, tangential_pos_num);
%attributeref(stir::Bin, int, timing_pos_num);
%attributeref(stir::Bin, int, time_frame_num);
%attribute(stir::Bin, float, bin_value, get_bin_value, set_bin_value);
%include "stir/SegmentIndices.h"
%include "stir/ViewgramIndices.h"
%include "stir/SinogramIndices.h"
%include "stir/Bin.h"
ADD_REPR(stir::Bin, %arg(*$self))

0 comments on commit b897a58

Please sign in to comment.