2nd - nested Patlak and generalized Patlak OSMAPOSL (POSMAPOSL & GPOSMAPOSL) and nested Richardson-Lucy Motion Deconvolution Image Reconstruction (RLMCIR) - #1736
Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 1 medium |
🟢 Metrics 266 complexity · 128 duplication
Metric Results Complexity 266 Duplication 128
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
I have noticed an important asymmetry with the parametric images IO. The problem is that @KrisThielemans I think we should make the kineticParameters non template in a new PR and merge here. |
|
Needs #1744 |
At the time, we made However,
|
KrisThielemans
left a comment
There was a problem hiding this comment.
Some minor house-keeping comments for now, not a review.
- copyright/headers seems to need changes in many places
- no output to
cout - seems you still need a
precommit run --all. However, need to be careful with ownership then. Ideally, this is done as @nkarakatsanis before @NikEfth major changes.
| @@ -0,0 +1,193 @@ | |||
| // | |||
| /* | |||
| Copyright (C) 2006 - 2011, Hammersmith Imanet Ltd | |||
| - The dynamic images will always be in decaying counts. | ||
| - The plasma data is assumed to be in decaying counts. | ||
|
|
||
| \todo Should be derived from LinearModels, but when non-linear models will be introduced, as well. |
The first was ran as @nkarakatsanis |
|
Great ( |
We cannot really ignore this because |
|
I suggest to do something like this in /! Convenience typedef for base-type of Cartesian Voxelised Parametric Images with just two parameters
typedef VoxelsOnCartesianGrid<KineticParameters<2, float>> Parametric2VoxelsOnCartesianGridBaseType;
//! Convenience typedef for Cartesian Voxelised Parametric Images with just two parameters
typedef ParametricDiscretisedDensity<ParametricVoxels2OnCartesianGridBaseType> Parametric2VoxelsOnCartesianGrid;
// same for 3
...
//! type for 2 parameters, we need this for backwards compatibility
using ParametricVoxelsOnCartesianGrid = Parametric2VoxelsOnCartesianGrid;and in auto param2_im_sptr(read_from_file<Parametric2VoxelsOnCartesianGrid>(argv[2]));
if (param2_im_sptr)
return call_function_that_does_the_extraction(param2_im_sptr);
auto param3_im_sptr(read_from_file<Parametric2VoxelsOnCartesianGrid>(argv[2]));
if (param3_im_sptr)
return call_function_that_does_the_extraction(param2_im_sptr);
error("Failed to read parametric image (" + std::string(argv[2]) + ")."); |
1602403 to
3b86ead
Compare
|
Not good. if you do a Either use BTW, please stop CI from running if we know it will fail. |
|
|
fb63adf to
09f50ea
Compare
I think there not way around. The hashes will change.
:/ I am sorry for this old habits.
Done.
|
|
Great. CI is now good! @NikEfth I suggest to squash your current commits (maybe even all of them). There's little value in keeping them. I would even squash @nkarakatsanis 2 first commits (the actual code and the precommit): we can just keep the history for one. Any reason not to? |
(cherry picked from commit d96f158) Run precommit.
1. Applied CODACY suggestions 2. Recon tests for NESTPOSMAPOSL * CODACY suggestions * NESTGPOSMAPOSL works. Test disabled for now because of inconstistaeny in parametric image reading precommit
09f50ea to
d6268e6
Compare
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 3 medium |
🟢 Metrics 248 complexity · 103 duplication
Metric Results Complexity 248 Duplication 103
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
forgotten copyright info fix copyright info
d6268e6 to
49ab80f
Compare
|
@KrisThielemans are you planning to squash the entire PR in the future? As it is now I am happy with the 3 commits |
|
My plan is to merge. This will preserve authorship, which is better for everyone (and also for our use of Current commits look great. Of course, now I'll have to do a proper review... |
|
The motion methods and IO and cerr stuff are not ready yet. I am sorry. A bit more |
|
I'm not in a hurry to review! |
…ad()
checks if the number of parameters in the header matches the template.
* Replaced Karakatsanis IO paths for 3-params images
* read_interfile_parametric_image is templated on num_params
* New typedefs Parametric3VoxelsOnCartesianGrid and Parametric2VoxelsOnCartesianGrid
* write_basic_interfile is templated on num_params
* PoissonNestedLogLikelihoodWithGeneralizedPatlakAndDynamicProjectionData and
use ParseAndCreateFrom to create the Target.
* cout and cerr replacement in many places
* set_matrix_in_total_frame_counts in PatlakPlot
* Introduced NestedGeneralizedPatlakOSMAPOSL to initialize
3-params recon with a 2-params image.
* Fixed the order of parameter names.
* run_tests_modelling now works with NESTGPOSMAPOSL and compares the
correct parameters
* pre-commit
|
@KrisThielemans @nkarakatsanis [x] NESTPOSMAPOSL A lot of extra IO has been implemented for modernization and alignment with modern STIR. I want to stress the lager number of "hacks" necessary to make this work with tempalated KineticParameters<num, float>. Not good. |
| double integral_step = cur_iter->get_plasma_counts_in_kBq() | ||
| * this->_plasma_frame_data.get_time_frame_definitions().get_duration(sample_num); | ||
|
|
||
| sum_value += 0.5 * integral_step; |
There was a problem hiding this comment.
@KrisThielemans @nkarakatsanis
If I understand this correctly. This moves the integral to the middle of the frame, rather than the beginning. This should break backwards compatibility. And more importantly test_modelling.cxx
Error : unequal values are 1996.12 and 1917.64. Check _model_array-1st column in ModelMatrix
Error : unequal values are 2076.65 and 2005.63. Check _model_array-1st column in ModelMatrix
Error : unequal values are 2141.73 and 2077.13. Check _model_array-1st column in ModelMatrix
Error : unequal values are 2193.4 and 2134.47. Check _model_array-1st column in ModelMatrix
Error : unequal values are 2233.58 and 2179.44. Check _model_array-1st column in ModelMatrix
(I prefer the new version)Any advice?
There was a problem hiding this comment.
I'd have to review this more, but generally I don't trust KM code that assumes "mid-points" are ok. We measure counts in time frames. Strictly speaking, all integrals need to be computed over the time frame. However, I'm not sure if that's what the old code did (although I might have convinced Harry accordingly...).
But again, I don't know why @nkarakatsanis made that change, so let's see what he says!
There was a problem hiding this comment.
Honestly I don't recall if I just followed an existing "KM convention" in STIR or simply made that choice. I have no strong feelings to change this to integration over the time frames. As long as we are explicit and consistent between plasma input function and TACs, I am fine with either approaches.
There was a problem hiding this comment.
I think the GeneralizedPatlakPlot also follows this convention and is (cryptically) documented as:
std::cout << "\nCreating Generalized Model Matrix (Here printed in its transverse format)\n\n"
<< "NOTE1: It contains as many columns as the number of later frames participating in parameter estimation\n"
<< "It contains as many rows as the convolution points of the input function\n"
<< "+ 1 last row consisting of the plasma counts for the corresponding later frame\n"
<< "NOTE2: Last element of each column is the plasma counts for the corresponding later frame\n\n"
<< "The total number of frames are: " << this->_num_frames << "\n"
<< "The total number of complete plasma samples are: " << this->_complete_plasma_data.size() << "\n"
<< "The last frame middle time is : " << this->_last_frame_mid_time << "\n"
<< "The time shift in complete plasma samples is: " << this->_complete_plasma_data.get_time_shift() << "\n"
<< "The total number of convolution points + 1(one) more column are: " << this->_num_conv_params << "\n"
<< "First Column: plasma samples for frame 1 ... Last Column: plasma samples for last frame\n";
There was a problem hiding this comment.
GeneralizedPatlakPlot has been designed to follow the same time frame convention with that implemented for PatlakPlot. Any changes will need to be implemented across both plots for consistent performance.
There was a problem hiding this comment.
OK, I had to push an update although it is partial. This issue is resolved with the introduction of frame reference time := frame end | frame midpoint. We can discuss more
* PatlakPlot and GeneralizedPatlakPlot both derive from KineticModel, * Take the isotope half-life from the ExamInfo radionuclide * NESTGPOSMAPOSL is broken at the moment.
|
In order to avoid extenssive code duplication I did some major changes (ongoing).
The |
Changes in this pull request
This is the second attempt to introduce the generalized Patlak code and nested Richardson-Lucy Motion Deconvolution image reconstruction by @nkarakatsanis
Testing performed
Related issues
Checklist before requesting a review
documentation/release_XXX.mdhas been updated with any functionality change (if applicable)Contribution Notes
Please tick the following: