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

block and generic scanner geometry #577

Merged
merged 99 commits into from
Feb 19, 2022
Merged

Conversation

pkhateri
Copy link
Contributor

new classes and changes for accurate scanner geometry

Parisa Khateri and others added 9 commits August 20, 2018 15:07
list of modified classes:
 - InterfileHeader
 - interfile.cxx
 - Scanner
 - VoxelsOnCartesianGrid
 - LORCoordinates
 - CListRecordSAFIR
 - DataSymmetriesForBins_PET_CartesianGrid
 - ProjMatrixByBinUsingRayTracing

list of added classes:
 - GeometryBlocksOnCylindrical
 - ProjDataInfoBlocksOnCylindrical
 - ProjDataInfoBlocksOnCylindricalNoArcCorr
@KrisThielemans
Copy link
Collaborator

https://travis-ci.org/github/UCL/STIR/jobs/697593231#L3130-3142 says

In file included from /home/travis/build/UCL/STIR/src/include/stir/make_array.h:209:0,
                 from /home/travis/build/UCL/STIR/src/include/stir/GeometryBlocksOnCylindrical.h:35,
                 from /home/travis/build/UCL/STIR/src/include/stir/ProjDataInfoBlocksOnCylindricalNoArcCorr.h:32,
                 from /home/travis/build/UCL/STIR/src/include/stir/listmode/CListRecordSAFIR.inl:33,
                 from /home/travis/build/UCL/STIR/src/include/stir/listmode/CListRecordSAFIR.h:261,
                 from /home/travis/build/UCL/STIR/src/include/stir/IO/SAFIRCListmodeInputFileFormat.h:47,
                 from /home/travis/build/UCL/STIR/src/IO/IO_registries.cxx:67:
/home/travis/build/UCL/STIR/src/include/stir/make_array.inl: In instantiation of ‘stir::Array<(num_dimensions + 1), T> 
stir::make_array(const stir::Array<num_dimensions, T>&, const stir::Array<num_dimensions, T>&, const stir::Array<num_dimensions, T>&) [with int num_dimensions = 1; T = float]’:

/home/travis/build/UCL/STIR/src/include/stir/GeometryBlocksOnCylindrical.inl:39:7:   required from here

/home/travis/build/UCL/STIR/src/include/stir/make_array.inl:255:113: error: conversion from ‘stir::NumericVectorWithOffset<stir::Array<1, float>, float>’ to non-scalar type ‘const stir::Array<2, float>’ requested

   const Array<num_dimensions+1,T> a = NumericVectorWithOffset<Array<num_dimensions,T>,T>(make_vector(a0, a1, a2));

make[2]: *** [src/swig/CMakeFiles/_stir.dir/__/IO/IO_registries.cxx.o] Error 1

Not sure why all the previous IO_registries compilations worked though.

This was referenced Jun 24, 2020
@KrisThielemans
Copy link
Collaborator

@pkhateri I believe I fixed the problem in #605 . If you merge STIR master in here, that might work.

Potentially I could do it for you, but I'd be pushing to your master branch apparently. 9always best to use a branch for a PR in the future).

@KrisThielemans
Copy link
Collaborator

same problem when compiler _stir.dir/IO_registries related to SWIG strangely enough.
https://travis-ci.org/github/UCL/STIR/jobs/707135030#L3168

/home/travis/build/UCL/STIR/src/include/stir/make_array.inl: In instantiation of ‘stir::Array<(num_dimensions + 1), T> stir::make_array(const stir::Array<num_dimensions, T>&, const stir::Array<num_dimensions, T>&, const stir::Array<num_dimensions, T>&) [with int num_dimensions = 1; T = float]’:
/home/travis/build/UCL/STIR/src/include/stir/GeometryBlocksOnCylindrical.inl:39:7:   required from here
/home/travis/build/UCL/STIR/src/include/stir/make_array.inl:255:113: error: conversion from ‘stir::NumericVectorWithOffset<stir::Array<1, float>, float>’ to non-scalar type ‘const stir::Array<2, float>’ requested
   const Array<num_dimensions+1,T> a = NumericVectorWithOffset<Array<num_dimensions,T>,T>(make_vector(a0, a1, a2));

- moved some inline functions to .cxx. They were either not used frequently
or probably too big to be inlined
- made some member functions const and pass "bigger" arguments as references
- avoid some warnings about double->float conversion

The first item resolves a problem with SWIG compilation UCL#604 by working around it.
They aren't used, and probably more confusing than anything else.
Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkhateri I've resolved the SWIG compilation error. However, there are now a lot of failures in the tests. Many of them just state

ERROR: Crystal Map not defined!

Python tests show

RuntimeError: ProjDataInfoGeneric::get_ring_pair_for_segment_axial_pos_num does not work for data with axial compression

implying that ProjDataInfoGeneric is called for "normal" interfile headers.

I do not understand your intentions with this PR well enough to solve this. Can you help?

@@ -42,7 +44,7 @@
#include "boost/cstdint.hpp"

#include "stir/listmode/DetectorCoordinateMapFromFile.h"

#include "boost/make_shared.hpp"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed. You can use either MAKE_SHARED (or even std::make_shared now that we're C++11).

@KrisThielemans
Copy link
Collaborator

Example Travis test log https://travis-ci.org/github/UCL/STIR/jobs/707731577

@pkhateri
Copy link
Contributor Author

@pkhateri I've resolved the SWIG compilation error. However, there are now a lot of failures in the tests. Many of them just state

ERROR: Crystal Map not defined!

Python tests show

RuntimeError: ProjDataInfoGeneric::get_ring_pair_for_segment_axial_pos_num does not work for data with axial compression

implying that ProjDataInfoGeneric is called for "normal" interfile headers.

I do not understand your intentions with this PR well enough to solve this. Can you help?

I pushed some fixes to the repository. Now all the tests should pass.
The modifications were originally applied into an old version (from ~3 yrs ago). When I merged that version to this new one, not all changes were copied. So I added them manually now. Hopefully, there's no problem any more. Otherwise please let me know.
I also added some new utilities...

@KrisThielemans
Copy link
Collaborator

thanks @pkhateri sorry for the delay. ctest is indeed happy. great. Unfortunately there were still quite a lot of errors with the recon_test_pack. You could have a look at https://travis-ci.org/github/UCL/STIR/jobs/712819897 but will just have to run the scripts yourself to figure out what they are, as Travis doesn't show us the logs at the moment. Feel free to ask questions of course.

Thanks for the extra utilities. Could you add some brief info on them in the STIR_UsersGuide.tex? Ideally also a bit more documentation in their headers (doxygen) if it isn't immediately obvious what they do. I'm reluctant to add the following though:

  • find_counts_in_cylindrical_ROI.cxx can be done via list_ROI_values I guess
  • convert_projdata_types.cxx seems unnecessary. I believe it just makes a copy, but you can do that with stir_math -s copy orig
  • trim_projdata.cxx seems unnecessary: SSRB -t <trim> out in 1 should do the same

Please also update documentation/release_5.0.htm.

@KrisThielemans
Copy link
Collaborator

@danieldeidda Appveyor builds are all failing on test_blocks_on_cylindrical with an exception, see bottom of
https://ci.appveyor.com/project/KrisThielemans/stir/builds/42581277/job/lq3sb3pvh81g31gp

It runs fine on my Visual Studio, so I suspect this it hits a memory limit, as these tests use ~6GB. I think best to use enable_caching(false) on the matrices. Also, the compilation above of test_blocks_on_cylindrical.cxx shows quite a few warnings. Maybe you can kill a few?

@danieldeidda
Copy link
Collaborator

@danieldeidda Appveyor builds are all failing on test_blocks_on_cylindrical with an exception, see bottom of https://ci.appveyor.com/project/KrisThielemans/stir/builds/42581277/job/lq3sb3pvh81g31gp

It runs fine on my Visual Studio, so I suspect this it hits a memory limit, as these tests use ~6GB. I think best to use enable_caching(false) on the matrices. Also, the compilation above of test_blocks_on_cylindrical.cxx shows quite a few warnings. Maybe you can kill a few?

I think we can remove the following:
WARNING: Disabling all symmetries except for symmtery_z since they are not implemented in block geometry yet.

as the symmetry_z is also disabled

@KrisThielemans
Copy link
Collaborator

I guess we cannot remove it, but have to rephrase it to "all symmetries disabled".

However, I was talking about compilation warnings (as you can see in the Appveyor log). The MS VC compiler issues far more warnings than gcc...

@danieldeidda
Copy link
Collaborator

the all seem to be conversion from 'double' to 'float'

Anyway do you want the scatter changes to be pushed here or we merge to master first?

@KrisThielemans
Copy link
Collaborator

the all seem to be conversion from 'double' to 'float'

yup. needs some (ugly) static_cast<float>(xxx)

Anyway do you want the scatter changes to be pushed here or we merge to master first?

I'd like to merge this to master first.

@danieldeidda
Copy link
Collaborator

This should be my last commit for this PR I guess

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. A few more unfortunately. sorry

src/include/stir/ProjDataInfoGeneric.inl Outdated Show resolved Hide resolved
src/include/stir/ProjDataInfoGeneric.inl Outdated Show resolved Hide resolved
src/test/test_proj_data_info.cxx Outdated Show resolved Hide resolved
src/recon_test/test_blocks_on_cylindrical_projectors.cxx Outdated Show resolved Hide resolved
src/recon_test/test_blocks_on_cylindrical_projectors.cxx Outdated Show resolved Hide resolved
danieldeidda and others added 2 commits February 18, 2022 13:33
Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
@KrisThielemans
Copy link
Collaborator

can you fix white-spacing any the test_blocks* file, and any other file you created in this PR, and also fix its permissions

cd STIR/src/recon_test
clang-format -i test_blocks_on_cylindrical_projectors.cxx
chmod -x test_blocks_on_cylindrical_projectors.cxx

@danieldeidda
Copy link
Collaborator

OK I think I have done all the corrections

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more things to do, but we'll merge this now as it's in good shape.

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry. hit the wrong button!

@KrisThielemans KrisThielemans merged commit bbe9f5a into UCL:master Feb 19, 2022
@KrisThielemans KrisThielemans added this to the v5.0 milestone Feb 20, 2022
@KrisThielemans
Copy link
Collaborator

@pkhateri This is merged now. Thanks a lot! I've sent an email to the list, but don't seem to have an email address for you anymore. I hope that this messages reaches you. All the best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants