Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLEstimateComponentBasedNormalisation refactor #1499

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3035db8
Refactor ML_estimate_component_based_normalisation creating sub-funct…
robbietuk Aug 29, 2024
bc58f39
Create MLEstimateComponentBasedNormalisation class and start to strip…
robbietuk Aug 29, 2024
0dca08e
Refactor to use class varables
robbietuk Aug 29, 2024
9fed40f
Add do_save_to_file guards
robbietuk Aug 29, 2024
2579f81
Documentation and minor refactors
robbietuk Aug 29, 2024
5d89071
Rename refactor
robbietuk Aug 29, 2024
86f6a82
Addition usage of shared_ptrs
robbietuk Aug 29, 2024
880e530
[ci skip] parameter rename, remove redundant logic, documentation
robbietuk Aug 29, 2024
dd711b1
Remove model_data member and pass by reference into the constructor
robbietuk Aug 30, 2024
2bcdc80
Readd stir/steam.h to includes
robbietuk Aug 30, 2024
0fa8455
[ci skip] Update copywrite
robbietuk Aug 30, 2024
90ea81b
[ci skip] Fix a bug with do_KL info print
robbietuk Aug 30, 2024
f0c788b
Add allocate override using a MLEstimateComponentBasedNormalisation
robbietuk Aug 30, 2024
e5e2cc7
[ci skip] cleanup comments
robbietuk Aug 30, 2024
8adb620
Rename files MLEstimateComponentBasedNormalisation
robbietuk Sep 3, 2024
9ff77fe
Remove allocate with norm estimator
robbietuk Sep 3, 2024
5c1a0f7
Add construct_bin_normfactors_from_components to MLEstimateComponentB…
robbietuk Sep 3, 2024
a114d14
Change efficiencies, norm_block_data, norm_geo_data values from sptr
robbietuk Sep 3, 2024
b0e05c9
Documentation update.
robbietuk Sep 3, 2024
1d6ca9b
Fix variable names
robbietuk Sep 4, 2024
0aae32e
Add guard to ensure measured and model data use the same pdi
robbietuk Sep 4, 2024
ca1140c
Add test for MLEstimateComponentBasedNormalisation
robbietuk Sep 4, 2024
2935b99
Correct comparison to objects, not sptr
robbietuk Sep 4, 2024
3c11502
[ci skip] Fix min/max tolerance check
robbietuk Sep 4, 2024
7c18bc7
Change scanner to Discovery
robbietuk Sep 12, 2024
42340f2
Add additional test on efficiency values
robbietuk Sep 12, 2024
f424ca8
Ensure normalization_projdata max and min values are about 2.0
robbietuk Sep 12, 2024
a5f4b91
Make test use check_if_equal
robbietuk Sep 13, 2024
1eefeff
Split test_normalization_calculation_with_efficiencies from the run_t…
robbietuk Sep 13, 2024
dcee251
Improve usage of data_is_processed()
robbietuk Sep 13, 2024
63f8560
Add getters and setters
robbietuk Sep 13, 2024
3d7e9ff
[ci skip] Add const to args
robbietuk Sep 13, 2024
55e5f1a
Merge remote-tracking branch 'UCL/master' into ML_estimate_component_…
robbietuk Sep 13, 2024
55897ee
[ci skip] Update release 6.3 notes
robbietuk Sep 13, 2024
cbe81ec
[ci skip] Fix error message
robbietuk Sep 16, 2024
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
11 changes: 11 additions & 0 deletions documentation/release_6.3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ <h3>New functionality</h3>

<h3>Changed functionality</h3>

<li>
Rework <code>MLEstimateComponentBasedNormalisation</code> into a class.
This allows for more flexibility in the use of the class without calling CLI executables. <br>
<a href=https:/UCL/STIR/pull/1499>PR # 1499</a>
</li>

<h3>Bug fixes</h3>

Expand Down Expand Up @@ -68,6 +73,12 @@ <h3>Test changes</h3>

<h4>C++ tests</h4>

<li>
Added <code>MLEstimateComponentBasedNormalisationTest</code> that tests the basic functionality of the
<code>MLEstimateComponentBasedNormalisation</code> class and creation of normalisation factors from
the calculated PET components. <br>
<a href=https:/UCL/STIR/pull/1499>PR # 1499</a>
</li>

<h4>recon_test_pack</h4>

Expand Down
12 changes: 6 additions & 6 deletions src/buildblock/ML_norm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,10 @@ get_fan_info(int& num_rings, int& num_detectors_per_ring, int& max_ring_diff, in
{
error("Can only process data without axial compression (i.e. span=1)\n");
}
if (proj_data_info_ptr->is_tof_data())
{
error("make_fan_data: Incompatible with TOF data. Abort.");
}
num_rings = proj_data_info.get_scanner_ptr()->get_num_rings();
num_detectors_per_ring = proj_data_info.get_scanner_ptr()->get_num_detectors_per_ring();
const int half_fan_size = min(proj_data_info.get_max_tangential_pos_num(), -proj_data_info.get_min_tangential_pos_num());
Expand Down Expand Up @@ -1141,23 +1145,19 @@ make_fan_data_remove_gaps(FanProjData& fan_data, const ProjData& proj_data)
int num_detectors_per_ring;
int fan_size;
int max_delta;

if (proj_data.get_proj_data_info_sptr()->is_tof_data())
error("make_fan_data: Incompatible with TOF data. Abort.");

const ProjDataInfo& proj_data_info = *proj_data.get_proj_data_info_sptr();
get_fan_info(num_rings, num_detectors_per_ring, max_delta, fan_size, proj_data_info);

if (proj_data.get_proj_data_info_sptr()->get_scanner_ptr()->get_scanner_geometry() == "Cylindrical")
{
auto proj_data_info_ptr = dynamic_cast<const ProjDataInfoCylindricalNoArcCorr* const>(&proj_data_info);
const auto proj_data_info_ptr = dynamic_cast<const ProjDataInfoCylindricalNoArcCorr* const>(&proj_data_info);
robbietuk marked this conversation as resolved.
Show resolved Hide resolved

make_fan_data_remove_gaps_help(
fan_data, num_rings, num_detectors_per_ring, max_delta, fan_size, *proj_data_info_ptr, proj_data);
}
else
{
auto proj_data_info_ptr = dynamic_cast<const ProjDataInfoBlocksOnCylindricalNoArcCorr* const>(&proj_data_info);
const auto proj_data_info_ptr = dynamic_cast<const ProjDataInfoBlocksOnCylindricalNoArcCorr* const>(&proj_data_info);

make_fan_data_remove_gaps_help(
fan_data, num_rings, num_detectors_per_ring, max_delta, fan_size, *proj_data_info_ptr, proj_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ START_NAMESPACE_STIR
Components currently supported are crystal efficiencies, geometric factors
(constrained by symmetry) and block data. The latter were introduced to
cope with timing alignment issues between blocks, but are generally
not recommended in the current estimation process (by ML_estimate_component_based_normalisation)
not recommended in the current estimation process (by MLEstimateComponentBasedNormalisation)
as the model allows for too much freedom.

The detection efficiency of a crystal pair is modelled as
Expand Down Expand Up @@ -126,15 +126,33 @@ class BinNormalisationPETFromComponents : public BinNormalisation
void
allocate(shared_ptr<const ProjDataInfo>, bool do_eff, bool do_geo, bool do_block = false, bool do_symmetry_per_block = false);

DetectorEfficiencies& crystal_efficiencies()

void set_crystal_efficiencies(const DetectorEfficiencies& eff)
{
efficiencies = eff;
}

DetectorEfficiencies& get_crystal_efficiencies()
{
return efficiencies;
}
GeoData3D& geometric_factors()

void set_geometric_factors(const GeoData3D& geo)
{
geo_data = geo;
}

GeoData3D& get_geometric_factors()
{
return geo_data;
}
BlockData3D& block_factors()

void set_block_factors(const BlockData3D& block)
{
block_data = block;
}

BlockData3D& get_block_factors()
{
return block_data;
}
Expand Down
Loading