Skip to content

Commit

Permalink
Use arithmetic in size keywords (#9)
Browse files Browse the repository at this point in the history
Use arithmetic in size keywords as now supported in yardl 0.3.1
  • Loading branch information
KrisThielemans authored Oct 26, 2023
1 parent ef3a7a0 commit 9f73265
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions cpp/prd_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: " <<header.scanner.NumberOfEnergyBins() << std::endl;

const auto& tof_bin_edges = header.scanner.tof_bin_edges;
std::cout << "TOF bin edges: " << tof_bin_edges << std::endl;
Expand Down
5 changes: 2 additions & 3 deletions model/ScannerInformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions python/prd_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 energy bins: {header.scanner.number_of_energy_bins()}")

energy_bin_edges = header.scanner.energy_bin_edges
print(f"Energy bin edges: {energy_bin_edges}")
Expand Down

0 comments on commit 9f73265

Please sign in to comment.