-
Notifications
You must be signed in to change notification settings - Fork 95
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
Scatter simulation #44
Scatter simulation #44
Conversation
Transfer code from the other branches.
Files which were deleted when merged with UCL/master
the run_scatter_tests.sh.
New clone functions added in ExamInfo.
Hi Some of these functions should probably have PET in their name (Maybe only the ScatterSimulation bits?)
ScatterEstimationByBin
ScatterSimulation
other
|
- [x] Choose set_up by dynamic_cast rather than name. - [x] post_processing() I think we should move most of its functionality to setup(). post_processing is only called after parsing, so wouldn’t be appropriate within python/Matlab. - [x] reconstruction_template_par_filename usage. I see you had to do some explicit KeyParser stuff here after all. Maybe that means we had to have it elsewhere after all? I guess same for ScatterSimulation
SingleScatterSimulation ScatterEstimationByBin: - [x] post_processing() I think we should move most of its functionality to setup(). post_processing is only called after parsing, so wouldn’t be appropriate within python/Matlab. - [x] ProjDataInfoCylindricalNoArcCorr * proj_data_info_2d_ptr; No raw pointers as class members. ExamInfo::clone() . no need for the static cast (just return new ExamInfo(*this)) - [x] Choose set_up by dynamic_cast rather than name. ScatterSimulation: - [x] Lots of inline functions. I think we should move it to .cxx. Inline is good for small functions called often, but otherwise slow down the compiler (and mean more recompilations if you change their implementation). (could leave the Compton ones inline if you prefer) - [x] set_activity_image_sptr return Succeeded, set_activity_image doesn’t (calls error). Best to let both do the same,and I’m these days in favour of the latter. (i.e. let the user catch exceptions) - [x] set_attenuation_threshold(const float& arg) etc. ok to use references but it’s quite non-standard and actually slower for such small entities (as you’ll be passing pointers around) - [x] post_processing creates a ProjDataInMemory for input_projdata_2d_sptr if data is 2D, just copy pointer? — I presume that this comment is for ScatterEstimationaByBin. Well not quite. If it is 2D then I cannot upsample. So (better) through an error? - [x] reconstruction_template_par_filename usage. I see you had to do some explicit KeyParser stuff here after all. Maybe that means we had to have it elsewhere after all? I guess same for ScatterSimulation - Most of this code is now in the post_processing().
Next steps are to run the estimation process.
What is left to be tested is the return to 3D. - [x] There are multiplicative_data_3d and normalisation_data_3d (what’s the difference?) and norm_projdata_3d_sptr. The latter one should normally not be a class member as it’s presumably used to create normalisation_data_3d
the results are disappointing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi. most comments are tiny. I think there is one bug (in attenuation coefficients).
there's still a few files with mostly white-space diffs. I'd prefer that you revert those such that I can see what actually changed (unless you're 100% sure that you current editor settings are the final ones that we're going to use, and you email me a diff ignoring white-space...)
thanks!
In addition to the comments in the github side: - [x] mask_atten_image_filename etc. Why the “atten” in the variable name? - [x] variable multimulti2d is a strange name :-; - [x] get_output_proj_data(shared_ptr& arg), change to shared_ptr get_output_proj_data() const; - [x] Zoom factors currently still hard-wired - [x] Every member initialised in post_proccessing must have a set function - [x] Use only BinNormalisation throught out the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs some clean up but most comments have been implemented.
this->multiplicative_data_2d_sptr.reset( | ||
new ChainedBinNormalisation(attenuation_correction, normalisation_coeffs)); | ||
|
||
iterative_object->get_objective_function_sptr()->set_normalisation_sptr(multiplicative_data_2d_sptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot fully understand the comment.
int len_x = this->atten_image_sptr.get()[0][min_z][min_y].get_length(); | ||
|
||
if (len_y != len_x) | ||
error(boost::format("The voxels in the x (%1%) and y (%2%)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to check this more. I think I saw it somewhere
I had some mistakes mainly in the normalisations. I think the estimation it working now.
fitting to the input_data than (input_data - randoms). In addition, I removed some obsolete variables.
minor amendments and addition of the code to sabsample the scanner
Use boost::filesystem to create the path and filenames in debug mode. Now, paths are cross-platform more minor aesthetic corrections
… Correction made.
In estimation the appending to boost path was corrected in more places.
The run_scatter_test was a bit weird as in the simultion sets the zoomed image both in for the scatter points and as the original attenuation image. I am not sure wether this is bug or a feature to speed up the process. I left it as is for now.
hi nikos, I haven't checked why you need boost filesystem and boost system, but I'm somewhat reluctant to use this. We'd introduce a dependency on compiled libraries for boost, and that's creating us a ton of problems for SIRF sadly (you would think it'd be simple but it isn't). could you tell me what you're using this for? We likely have equivalents in |
8fd93fd
to
e6a41de
Compare
We were using the environment variable RANDOM before, but this is a system variable that returns a random number. This caused failurs on OSX.
e6a41de
to
e04c3af
Compare
Success! https://travis-ci.org/github/UCL/STIR/builds/674304290. The problem was that the test-script was using the env variable Code was fine all along. I've also (re)checked that results of the scatter-simulation are identical to what we have in I'll extend the tests a bit, possibly do a bit more renaming, and then it should be ready. However, while checking everything, I discovered a problem when using the zooming of the attenuation image. I'll file a separate issue for that as it's also in |
A few more thing to finish
|
- Currently only check in Debug mode to avoid impact on computation time. - move computation of shift_detector_coordinates_to_origin to set_up (from process_data)
we had some static variables, and forget to clear the cached detection_points_vector
These are tests for a symmetric object, checking if the result is symmetric. Also enabled the consistency check mentioned in UCL#495. This means that run_scatter_tests/sh will now fail.
This is now done by default in ScatterSimulation. Removing this avoids problems with UCL#495. - changed recon_test_pack and PET_simulation script/par-file - changed scatter-output file in recon_test_pack to take the new zooming into account. Difference with respect to the previous version is about 4%. (Note that the previous version was incorrect due to UCL#495)
- some clarifications in sample scatter_simulation.par - removed obsolete file
hopefully a better name...
now consistent with the rest of STIR
Use scatter_estimate(Bin) as opposed to in terms of 2 detectors such that it will apply for SPECT at some point.
original values did not reflect this was PET specific. Also used more standard-form keywords for the simulate_scatter .par file. Also fixed some issues in example files and STIR-UsersGuide
This was not necessary earlier-on as SingleScatterSimulation::process_data() was calling set_up(), but no longer...
- use standard keywords for reconstruction and scatter simulation - allow specifying these in the parameter file itself (as opposed to requiring a separate file)
3 Travis jobs gave errors of 0.124% while our threshold was 0.1%.
This commit finally closes UCL#495
I'm going to stop with this. There's still improvements to be made, but time has run out. It's working ok as far as I can see, and tests succeeded. I'll make an issue with extra things to do. |
…3_05_07 Merge master to tof 2023 05 07 + Siemens support
So, this is the PR for the scatter simulation.
New classes ScatterSimulation and SingleScatterSimulation which have taken over the old ScatterEstimation. This is their "minimal" implementation having only the functionality that the older class used to have. I removed, for the time being, the subsampling stuff, in order to first see why/where there is the mistake. Once this has been sorted I will start adding more things bit-by-bit.
Please don't review the new ScatterEstimation class, yet. I will create a branch, from this one, on which I will work on the ScatterEstimation and let you know when it will be ready for reviewing.
In addition, there are some minor changes in other places, like clone functions in ExamInfo.
In my laptop all tests succeeded and Travis is doing good, so far.
ATB,
Nikos