reading of PETSIRD list-mode function#1604
Conversation
…its from classes
…D listmode data classes.
NikEfth
left a comment
There was a problem hiding this comment.
[x] there are some changes here for set_proj_data_info which probably came from another PR. Maybe they'll disappear when you merge master here
- Merged with master is fine now.
[ x] there are changes here to cope with even number of TOF bins. They might be good, but it doesn't have anything to do with PETSIRD.
- I know. But I had to make them as the data shared by people in the hackathon had even number of bins. If you you want to compare with that we need these changes here. I can document more.
[x] there's some changes in find_basic_vs_nums... which don't belong here
- Yes that code doesn't do anything atm.
[x] I see no reason to make InputFormat::can_read non-const. If this is really required for PETSIRD, please explain. We should then work around it.
- Done
[x] I guess the BinNormalisation isn't finished yet. I would suggest we currently call error and do it in a separate PR.
- No it is finished. Unless you have comments.
| - Mat3: std::array<std::array<float,3>,3> for compact fixed-size storage. | ||
| - Vec3: std::array<float,3> for simple 3D vectors. |
There was a problem hiding this comment.
OK. I started a bit of this. From the test_ . It won't be hard.
| else | ||
| { | ||
| bin.timing_pos_num() = -timing_pos_num; | ||
| bin.timing_pos_num() = -timing_pos_num - (get_num_tof_poss() % 2 == 0); |
There was a problem hiding this comment.
I am sorry, I don't understand. We need to make adjustments for even and odd number of bins.
| auto stir_scanner_sptr = petsird_info_sptr->get_scanner_sptr(); | ||
|
|
||
| int tof_mash_factor = 1; | ||
| this->set_proj_data_info_sptr(std::const_pointer_cast<const ProjDataInfo>( |
| // for (int timing_pos_num = proj_data_info.get_min_tof_pos_num(); timing_pos_num <= proj_data_info.get_max_tof_pos_num(); | ||
| // ++timing_pos_num) |
KrisThielemans
left a comment
There was a problem hiding this comment.
some other clean-up suggestions
| find_unique_values(std::set<elemT>& values, const Array<num_dim, elemT>& input) | ||
| { | ||
| for (int i = input.get_min_index(); i <= input.get_max_index(); ++i) | ||
| { | ||
| find_unique_values(values, input[i]); | ||
| } | ||
| } |
There was a problem hiding this comment.
This will fail, as input[i] is an num_dim-1 array. You probably wanted to iterate using begin_all(), but as it doesn't create trouble, it means this function isn't used, so you could cut it. If it is needed, the 1D and nD implementation could be the same.
Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
|
Do you want the |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 219 |
| Duplication | 8 |
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.
|
@casperdcl This is the PR |
|
|
||
| template <typename elemT> | ||
| inline void | ||
| find_unique_values(std::set<elemT>& values, const Array<1, elemT>& input) |
There was a problem hiding this comment.
why not use use begin_all(), end_all(), then you need don' t need the template specialisation. In fact, I'm not sure if we then need the function at all as it's a 2 liner.
| else | ||
| { | ||
| bin.timing_pos_num() = -timing_pos_num; | ||
| bin.timing_pos_num() = -timing_pos_num - (get_num_tof_poss() % 2 == 0); |
There was a problem hiding this comment.
this needs discussion and serious thought
| string(REGEX MATCH "cxx_std_([0-9]+)" _petsird_std_match "${_petsird_features}") | ||
| if(CMAKE_MATCH_1) | ||
| UseCXX(${CMAKE_MATCH_1}) | ||
| endif() |
There was a problem hiding this comment.
impressive enough, but should not be necessary AFAIK. If the target set C++ version, then it should automatically transcend. no?
| #include "stir/ProjData.h" | ||
| #include "stir/ProjDataInfo.h" | ||
| #include "stir/listmode/CListRecord.h" | ||
| #include "stir/IO/InputStreamWithRecords.h" |
There was a problem hiding this comment.
all of these are unused in the .h, so should be removed. However, we do need DetectorCoordinateMap.h
| If listmode reconstruction is done, the map is regenerated on-the-fly. | ||
|
|
||
| */ | ||
| class CListModeDataPETSIRD : public CListModeDataBasedOnCoordinateMap |
There was a problem hiding this comment.
whenever you're ready, move implementations to .cxx
| #include <iostream> | ||
| #include <fstream> | ||
| #include "stir/Succeeded.h" |
There was a problem hiding this comment.
looks like we don't need any of this
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| See STIR/LICENSE.txt for detail | ||
| /*! |
There was a problem hiding this comment.
close comment first (compiler warning otherwise)
| #include "stir/DetectionPosition.h" | ||
| #include "stir/DetectionPositionPair.h" | ||
| #include "petsird/protocols.h" | ||
| #include "stir/Scanner.h" | ||
| #include "stir/DetectorCoordinateMap.h" | ||
| #include "stir/ProjDataInfo.h" | ||
| #include <set> | ||
| #include "stir/format.h" | ||
| #include "stir/info.h" | ||
| #include "stir/error.h" | ||
|
|
||
| #include "petsird_helpers.h" | ||
| #include "petsird_helpers/create.h" // for make_detection_bin | ||
| #include "petsird_helpers/geometry.h" // depending on where get_detection_efficiency lives |
There was a problem hiding this comment.
only include whatever is needed for the class definition and .inl (which should be as little as possible). Several reasons:
- easier to understand
- less auto-generated dependencies, so faster recompilation
- no (less?) issues with compiling registries, like we currently have for the MacOS job
in file included from /Users/runner/work/STIR/STIR/src/recon_buildblock/recon_buildblock_registries.cxx:87: In file included from /Users/runner/work/STIR/STIR/src/include/stir/recon_buildblock/BinNormalisationFromPETSIRD.h:27: In file included from /Users/runner/work/STIR/STIR/src/include/stir/PETSIRDInfo.h:25: /Users/runner/work/STIR/STIR/src/include/stir/format.h:40:12: fatal error: 'fmt/format.h' file not found 40 | # include "fmt/format.h"
KrisThielemans
left a comment
There was a problem hiding this comment.
Looks like CI is working! Great. (The MacOS job fails because of too much stuff in .h/.inl, see previous review).
| case ${{matrix.os}} in | ||
| (ubuntu* | macOS*) | ||
| sudo .github/workflows/GHA_increase_disk_space.sh | ||
| if [ "${ACT:-false}" = "true" ]; then |
There was a problem hiding this comment.
what is this? Is it https://github.com/nektos/act? Please add a comment line
There was a problem hiding this comment.
I forgot to remove it. I ran to problems executing the CI locally, as I don't have Github's infracture and this stops the execution of the GHA_increase_disk_space.
I run the CI like this:
act -W .github/workflows/build-test.yml -P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04 --env ACT=true
There was a problem hiding this comment.
keep it in. Seems quite useful anyway. But document, and add 2 lines in the developers guide
| cache-environment: true | ||
| cache-downloads: true | ||
|
|
||
| - name: Add STIR dependencies in PETSIRD environent |
There was a problem hiding this comment.
| - name: Add STIR dependencies in PETSIRD environent | |
| - name: Add STIR dependencies in PETSIRD environment |
| shell: bash -el {0} | ||
| run: | | ||
| set -ex | ||
| micromamba install -y -n yardl -c conda-forge boost-cpp swig matplotlib |
There was a problem hiding this comment.
Hopefully we don't need matplotlib. It's a large dependency...
Also, I'm doubtful of having boost-cpp and swig here, but also via APT/brew below. Do we really need this here?
| mkdir -p build | ||
| cd build | ||
|
|
||
| cmake .. \ |
There was a problem hiding this comment.
| cmake .. \ | |
| cmake .. \ | |
| -G Ninja \ |
as we use that for STIR itself, it provides clearer messages, and means we don't need make
| BUILD_TYPE: "Release" | ||
| parallelproj: "ON" | ||
| ROOT: "ON" | ||
| ROOT: "OFF" |
WIP