[SyneRBI/SIRF] STIR min/max-scale-factor in ScatterEstimation exposed. (PR #1271)

0 views
Skip to first unread message

Evgueni Ovtchinnikov

unread,
Jun 24, 2024, 11:34:40 AM (5 days ago) Jun 24
to SyneRBI/SIRF, Subscribed

Changes in this pull request

Added min/max_scale_factor methods to scatter estimation classes (C++ and Python).

Testing performed

Related issues

Fixes #1270.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added docstrings/doxygen in line with the guidance in the developer guide
  • I have implemented unit tests that cover any new or modified functionality
  • The code builds and runs on my machine
  • CHANGES.md has been updated with any functionality change

Contribution Notes

Please read and adhere to the contribution guidelines.

Please tick the following:

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in SIRF (the Work) under the terms and conditions of the Apache-2.0 License.

You can view, comment on, or merge this pull request online at:

  https://github.com/SyneRBI/SIRF/pull/1271

Commit Summary

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 3:44:50 AM (5 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans requested changes on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

I prefer to have the Python and C++ names to be identical. As far as I can see, these currently are SIRF names in addition to the (already exposed?) STIR names? Maybe just cut this?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2137733656@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 4:04:27 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

STIR's set_min_scale_value cannot be called directly by user's code because of

    class PETScatterEstimator : private stir::ScatterEstimation


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2137801264@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 4:36:10 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

I think using stir::ScatterEstimation::set_max_scale_value will work.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2137889995@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 6:43:48 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+
/home/sirfuser/devel/buildVM/sources/SIRF/src/xSTIR/cSTIR/cstir_p.cpp: In function ‘void* sirf::cSTIR_setScatterEstimatorParameter(const DataHandle*, const char*, const DataHandle*)’:
/home/sirfuser/devel/buildVM/sources/SIRF/src/xSTIR/cSTIR/cstir_p.cpp:875:53: error: cannot call member function ‘void stir::ScatterEstimation::set_max_scale_value(float)’ without object
  875 |         stir::ScatterEstimation::set_max_scale_value(dataFromHandle<float>(hv))


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138250108@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 7:03:58 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

Either

        void set_max_scale_factor(float v)
        {
            stir::ScatterEstimation::set_max_scale_value(v);
        }

        void set_min_scale_factor(float v)
        {
            stir::ScatterEstimation::set_min_scale_value(v);
        }

or

     using stir::ScatterEstimation::set_max_scale_value;
     using stir::ScatterEstimation::set_min_scale_value;

the 2nd option is much more concise, but I prefer to use the first and add a doxygen string (which I don't think you can do with the 2nd option)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138295732@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 7:17:16 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

The first way does not work - see the error message I reported above

The second way: where do I put using statements? I tried

    class PETScatterEstimator : private stir::ScatterEstimation
    {
      using recon_type = stir::OSMAPOSLReconstruction<DiscretisedDensity<3,float>>;
      using stir::ScatterEstimation::set_max_scale_value;

got

/home/sirfuser/devel/buildVM/sources/SIRF/src/xSTIR/cSTIR/cstir_p.cpp:880:32: error: ‘void stir::ScatterEstimation::set_max_scale_value(float)’ is inaccessible within this context
  880 |         obj.set_max_scale_value(dataFromHandle<float>(hv));


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138323890@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 7:24:48 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

The 1st option will work. this is a modification of your own. The lines above need to be in the (public section) of the class def.

similarly for using. Needs to be after public.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138340716@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 8:07:13 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> +        void set_max_scale_factor_value(float v)
+        {
+            set_max_scale_value(v);
+        }
+
+        void set_min_scale_factor_value(float v)
+        {
+            set_min_scale_value(v);
+        }
+

It turned out I was applying stir::ScatterEstimation:: prefix in a wrong place (in cstir_p.cpp) - all works now, thanks!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138473157@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 8:15:01 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Push

@evgueni-ovtchinnikov pushed 1 commit.

  • 004d968 accepted reviewers' suggestions


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/before/52cf5e3109a08e3130715cd4c223fb55ee3c50c4/after/004d968a9d02b102756b15aaa8a0f0c95d8e80f8@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 10:37:29 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans requested changes on this pull request.

excellent.


In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> @@ -947,6 +947,16 @@ The actual algorithm is described in
           return this->get_reconstruction_method().get_num_subsets();
         }
 
+        void set_max_scale_value(float v)
⬇️ Suggested change
-        void set_max_scale_value(float v)
+        //! Set maximal scale factor value of the SSS algorithm to use
+        void set_max_scale_value(float v)

In src/xSTIR/cSTIR/include/sirf/STIR/stir_x.h:

> @@ -947,6 +947,16 @@ The actual algorithm is described in
           return this->get_reconstruction_method().get_num_subsets();
         }
 
+        void set_max_scale_value(float v)
+        {
+            stir::ScatterEstimation::set_max_scale_value(v);
+        }
+
+        void set_min_scale_value(float v)
⬇️ Suggested change
-        void set_min_scale_value(float v)
+        //! Set minimal scale factor value of the SSS algorithm to use
+        void set_min_scale_value(float v)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138899192@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 10:38:19 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Push

@KrisThielemans pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/before/004d968a9d02b102756b15aaa8a0f0c95d8e80f8/after/cfbbb79f98158a5a5f5d569edb36bcd63fb31450@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 10:38:26 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans approved this pull request.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138903399@github.com>

Kris Thielemans

unread,
Jun 25, 2024, 10:39:45 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

@KrisThielemans commented on this pull request.

Please add a line to CHANGES.md and merge (pull first)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/review/2138906907@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 10:44:18 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Push

@evgueni-ovtchinnikov pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/before/cfbbb79f98158a5a5f5d569edb36bcd63fb31450/after/8a5b817d33c6eeb024eb66a05df7296422dccb43@github.com>

Evgueni Ovtchinnikov

unread,
Jun 25, 2024, 10:45:04 AM (4 days ago) Jun 25
to SyneRBI/SIRF, Subscribed

Merged #1271 into master.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF/pull/1271/issue_event/13282701363@github.com>

Reply all
Reply to author
Forward
0 new messages