-
Notifications
You must be signed in to change notification settings - Fork 111
reading of PETSIRD list-mode function #1604
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
Open
KrisThielemans
wants to merge
23
commits into
master
Choose a base branch
from
PETSIRD
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b1a701e
Create CListModeDataBasedOnCoordinateMap from SAFIR
NikEfth 12985cc
creating template classes for PETSIRD [WIP]
ff1038e
initial attempt for CListModeDataPETSIRD [WIP]
NikEfth b80d022
reading PETSIRD header [WIP]
danieldeidda 4ce4ff2
Updates on the PETSIRD interface and CMake [WIP]
NikEfth f5b56f2
PETSIRD: extracting position of each detector [WIP]
danieldeidda 211cc15
PETSIRD: orientations etc [WIP]
NikEfth 030ffd5
PETSIRD: fixes for detector map [WIP]
danieldeidda e8fd6d4
PETSIRD: first working version
NikEfth 6437d97
PETSIRD: safe checking on type of scanner geometry
KrisThielemans 76b751c
* Documented that CListRecordPETSIRD has both detector position and t…
NikEfth 1e2088e
add test on tof_mashing factor
KrisThielemans e742484
PETSIRD: hdf5 input files for norm
KrisThielemans 8a04aa4
[GHA] simplification
KrisThielemans f3fcca6
Merge remote-tracking branch 'origin/master' into PETSIRD
KrisThielemans dec6303
[GHA] further simplification
KrisThielemans 6209572
use build_environment.yml and use on GHA
KrisThielemans a64da93
[GHA] change job to force action to run
KrisThielemans c453883
[GHA] fix
KrisThielemans 64e90c0
[GHA] add just
KrisThielemans b78e20f
add date to build_environment
KrisThielemans c3b8cdf
use mamba
KrisThielemans 74e1f42
use micromamba
KrisThielemans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Running the GitHub Actions workflow locally with `act` | ||
|
|
||
| The GitHub Actions CI workflow can be tested locally using [`act`](https://github.com/nektos/act). | ||
| This is useful for debugging workflow changes before pushing to GitHub. | ||
|
|
||
| ## Prerequisities | ||
|
|
||
| Install `act` and make sure Docker or Podman is available and running. | ||
|
|
||
| On Linux, the workflow can be run with an Ubuntu 24.04 | ||
| container image compatible with GitHub Actions: | ||
|
|
||
| ```bash | ||
| act -W .github/workflows/build-test.yml \ | ||
| -P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04 \ | ||
| --env ACT=true | ||
| ``` | ||
|
|
||
| * The ```-W``` option selects the workflow file to run | ||
| * The ```-P``` option maps the GitHub Actions | ||
| runner label ```ubuntu-24.04``` to a local container image. | ||
| The image in the command above is suggested online. | ||
| * The `--env ACT=true` option sets an environment variable | ||
| used by the workflow to detect that it is running under `act`. | ||
| Some GitHub steps are skipped. | ||
|
|
||
| ## NOTES | ||
|
|
||
| * It is highly recommended to run only one job at the time. | ||
| STIR has an array of different OSes and options. | ||
| Don't try to spin them up all together in your local workstation. | ||
| * Runnning the workflow locally with ```act``` is not always identical to GitHub. | ||
| * If Docker runs out of disk space, remove old images and containers before running | ||
|
|
||
| ```bash | ||
| docker system prune | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* PETSIRDCListmodeInputFileFormat.h | ||
|
KrisThielemans marked this conversation as resolved.
|
||
|
|
||
| Class defining input file format for coincidence listmode data for PETSIRD. | ||
|
|
||
| Copyright 2025, 2026, University Medical Center Groningen | ||
| Copyright 2025 National Physical Laboratory | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| See STIR/LICENSE.txt for details | ||
| */ | ||
| #include "stir/IO/PETSIRDCListmodeInputFileFormat.h" | ||
| #include "petsird/binary/protocols.h" | ||
| #include "petsird/hdf5/protocols.h" | ||
| #include "stir/error.h" | ||
| #include "stir/format.h" | ||
| #include <array> | ||
| // #include "../../PETSIRD/cpp/generated/types.h" | ||
| // #include "../../PETSIRD/cpp/helpers/include/petsird_helpers.h" | ||
|
|
||
| START_NAMESPACE_STIR | ||
|
|
||
| /*! | ||
|
|
||
| \file | ||
| \ingroup listmode | ||
| \brief Implementation of class stir::PETSIRDCListmodeInputFileFormat | ||
|
|
||
| \author Nikos Efthimiou | ||
| \author Daniel Deidda | ||
|
|
||
| */ | ||
|
|
||
| bool | ||
| PETSIRDCListmodeInputFileFormat::can_read(const FileSignature& signature, const std::string& filename) const | ||
| { | ||
|
|
||
| std::array<char, 4> hdf5_signature = { 'H', 'D', 'F', '5' }; | ||
|
KrisThielemans marked this conversation as resolved.
|
||
| std::array<char, 4> binary_signature = { 'y', 'a', 'r', 'd' }; | ||
|
|
||
| std::ifstream file(filename, std::ios::binary); | ||
| if (!file.is_open()) | ||
| { | ||
| error(format("Cannot open file: {}", filename)); | ||
| return false; | ||
| } | ||
| std::array<char, 4> signature_{}; | ||
| auto it = std::istreambuf_iterator<char>(file); | ||
| auto end = std::istreambuf_iterator<char>(); | ||
|
|
||
| for (size_t i = 0; i < signature_.size() && it != end; ++i, ++it) | ||
| { | ||
| signature_[i] = *it; | ||
| } | ||
|
|
||
| if (!file) | ||
| error("Stream error while reading file signature"); | ||
|
|
||
| if (signature_ == hdf5_signature) | ||
| { | ||
| use_hdf5 = true; | ||
| return use_hdf5; | ||
| } | ||
|
|
||
| if (signature_ == binary_signature) | ||
| { | ||
| use_hdf5 = false; | ||
| return true; | ||
| } | ||
|
|
||
| // petsird::hdf5::PETSIRDReader* petsird_reader = new petsird::hdf5::PETSIRDReader(filename); | ||
|
|
||
| // if (is_null_ptr(petsird_reader)) | ||
| // { | ||
|
|
||
| // petsird::binary::PETSIRDReader* petsird_reader = new petsird::binary::PETSIRDReader(filename); | ||
| // if (is_null_ptr(petsird_reader)) | ||
| // { | ||
| // return false; | ||
| // } | ||
| // return true; | ||
| // } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| END_NAMESPACE_STIR | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.