From 19a3e91c09125bef09e37f890cd4e582b3bd7b13 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Thu, 26 Oct 2023 12:24:52 +0100 Subject: [PATCH 1/3] Use arithmetic in size keywords now supported in yardl 0.3.1 --- .devcontainer/Dockerfile | 2 +- model/ScannerInformation.yml | 5 ++--- python/prd_analysis.py | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 41e0677..e08d20e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -89,7 +89,7 @@ RUN mkdir -p /home/vscode/.local/share/CMakeTools \ && chown vscode:conda /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json # Install the yardl tool -ARG YARDL_VERSION=0.3.0 +ARG YARDL_VERSION=0.3.1 RUN wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \ && tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \ && mv yardl "/opt/conda/envs/${CONDA_ENVIRONMENT_NAME}/bin/" \ diff --git a/model/ScannerInformation.yml b/model/ScannerInformation.yml index e5cdfba..99992c9 100644 --- a/model/ScannerInformation.yml +++ b/model/ScannerInformation.yml @@ -34,6 +34,5 @@ ScannerInformation: !record computedFields: numberOfDetectors: size(detectors) - # TODO: can we subtract 1 to get the number? - numberP1OfTOFBins: size(tofBinEdges) - numberP1OfEnergyBins: size(energyBinEdges) + numberOfTOFBins: size(tofBinEdges)-1 + numberOfEnergyBins: size(energyBinEdges)-1 diff --git a/python/prd_analysis.py b/python/prd_analysis.py index 3565aa9..a832bdf 100644 --- a/python/prd_analysis.py +++ b/python/prd_analysis.py @@ -8,6 +8,8 @@ header = reader.read_header() print(f"Subject ID: {header.exam.subject.id}") print(f"Number of detectors: {header.scanner.number_of_detectors()}") + print(f"Number of TOF bins: {header.scanner.number_of_tof_bins()}") + print(f"Number of TOF bins: {header.scanner.number_of_energy_bins()}") energy_bin_edges = header.scanner.energy_bin_edges print(f"Energy bin edges: {energy_bin_edges}") From b744d8cea1c849908a21fdbc59b75e06b2cb8a4a Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Thu, 26 Oct 2023 12:30:05 +0100 Subject: [PATCH 2/3] [GHA] update yardl version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57f4739..8163e9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: mkdir ${YARDL_DIR} cd ${YARDL_DIR} echo "${{github.workspace}}/yardl" >> $GITHUB_PATH - YARDL_VERSION=0.3.0 + YARDL_VERSION=0.3.1 wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" rm "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" From 8c7f269d0c6f8c13a74c50b8079bc6fc9400a1ec Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Thu, 26 Oct 2023 12:36:32 +0100 Subject: [PATCH 3/3] also print in C++ --- cpp/prd_analysis.cpp | 2 ++ python/prd_analysis.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/prd_analysis.cpp b/cpp/prd_analysis.cpp index 4c8af11..ad06808 100644 --- a/cpp/prd_analysis.cpp +++ b/cpp/prd_analysis.cpp @@ -29,6 +29,8 @@ main(int argc, char* argv[]) if (header.exam) // only do this if present std::cout << "Subject ID: " << header.exam->subject.id << std::endl; std::cout << "Number of detectors: " << header.scanner.NumberOfDetectors() << std::endl; + std::cout << "Number of TOF bins: " << header.scanner.NumberOfTOFBins() << std::endl; + std::cout << "Number of energy bins: " <