Skip to content

Commit

Permalink
[SWIG] add ListRecord and CList versions
Browse files Browse the repository at this point in the history
To do this cleanly, move lines from stir.i to separate stir_listmode.i
  • Loading branch information
KrisThielemans committed Nov 14, 2023
1 parent 5a49e13 commit b225bdb
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/swig/stir.i
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@
#include "stir/recon_buildblock/BinNormalisationFromProjData.h"
#include "stir/recon_buildblock/BinNormalisationFromAttenuationImage.h"
#include "stir/recon_buildblock/TrivialBinNormalisation.h"
#include "stir/listmode/LmToProjData.h"
#include "stir/listmode/ListRecord.h"
#include "stir/listmode/ListEvent.h"
#include "stir/listmode/CListRecord.h"
#include "stir/listmode/ListModeData.h"
#include "stir/listmode/CListModeData.h"
#include "stir/listmode/LmToProjData.h"

#include "stir/CartesianCoordinate2D.h"
#include "stir/CartesianCoordinate3D.h"
Expand Down Expand Up @@ -955,6 +959,7 @@ ADD_REPR(stir::Succeeded, %arg($self->succeeded() ? "yes" : "no"));

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

%include "stir_voxels.i"
Expand Down Expand Up @@ -989,10 +994,6 @@ ADD_REPR(stir::Succeeded, %arg($self->succeeded() ? "yes" : "no"));
%include "stir/multiply_crystal_factors.h"
%include "stir/decay_correction_factor.h"

%rename (set_template_proj_data_info) *::set_template_proj_data_info_sptr;
%shared_ptr(stir::LmToProjData);
%include "stir/listmode/LmToProjData.h"

%shared_ptr(stir::ScatterSimulation);
%shared_ptr(stir::RegisteredParsingObject<stir::SingleScatterSimulation,
stir::ScatterSimulation, stir::ScatterSimulation>);
Expand All @@ -1011,18 +1012,6 @@ ADD_REPR(stir::Succeeded, %arg($self->succeeded() ? "yes" : "no"));
%shared_ptr(stir::CreateTailMaskFromACFs);
%include "stir/scatter/CreateTailMaskFromACFs.h"

%shared_ptr(stir::ListModeData);
%include "stir/listmode/ListModeData.h"

%extend stir::ListModeData {
static shared_ptr<stir::ListModeData> read_from_file(const std::string& filename)
{
using namespace stir;
shared_ptr<ListModeData> ret(read_from_file<ListModeData>(filename));
return ret;
}
}

%shared_ptr(stir::FanProjData);
%shared_ptr(stir::GeoData3D);
%ignore operator<<;
Expand Down
53 changes: 53 additions & 0 deletions src/swig/stir_listmode.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
Copyright (C) 2023 University College London
Copyright (C) 2022 Positrigo
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::ListModeData, stir:LmToProjData, stir::ListRecord
\author Kris Thielemans
\author Markus Jehl
*/
%shared_ptr(stir::ListRecord);
%shared_ptr(stir::ListEvent);
%shared_ptr(stir::CListRecord);
%shared_ptr(stir::CListEvent);
%shared_ptr(stir::CListRecordWithGatingInput);

%include "stir/listmode/ListRecord.h"
%include "stir/listmode/ListEvent.h"
%include "stir/listmode/CListRecord.h"

%rename (get_empty_record) *::get_empty_record_sptr;

%rename (set_template_proj_data_info) *::set_template_proj_data_info_sptr;
%shared_ptr(stir::LmToProjData);
%include "stir/listmode/LmToProjData.h"
ADD_REPR_PARAMETER_INFO(stir::LmToProjData);

%shared_ptr(stir::ListModeData);
%include "stir/listmode/ListModeData.h"

%extend stir::ListModeData {
static shared_ptr<stir::ListModeData> read_from_file(const std::string& filename)
{
using namespace stir;
shared_ptr<ListModeData> ret(read_from_file<ListModeData>(filename));
return ret;
}
}

%extend stir::CListModeData {
static shared_ptr<stir::CListModeData> read_from_file(const std::string& filename)
{
using namespace stir;
shared_ptr<CListModeData> ret(read_from_file<CListModeData>(filename));
return ret;
}
}

0 comments on commit b225bdb

Please sign in to comment.