Skip to content

reading of PETSIRD list-mode function#1604

Draft
KrisThielemans wants to merge 101 commits intomasterfrom
PETSIRD
Draft

reading of PETSIRD list-mode function#1604
KrisThielemans wants to merge 101 commits intomasterfrom
PETSIRD

Conversation

@KrisThielemans
Copy link
Collaborator

WIP

@KrisThielemans KrisThielemans self-assigned this Jul 16, 2025
@NikEfth NikEfth marked this pull request as ready for review December 22, 2025 14:34
@NikEfth NikEfth marked this pull request as draft December 23, 2025 08:38
Copy link
Collaborator Author

@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.

This is mostly clean. thanks! A lot of my comments are housekeeping, but there are some important ones. Major thing is to keep this PR separate from other things (I won't accept this PR with them...), for example:

  • 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
  • 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.
  • there's some changes in find_basic_vs_nums... which don't belong here
  • 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.

I guess the BinNormalisation isn't finished yet. I would suggest we currently call error and do it in a separate PR.

ref: fix/cmake-export
path: PETSIRD

- name: Checkout Yardl (main)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can use yardl 0.6.6 now, no need to self-build

return false;
};

std::vector<petsird::ReplicatedDetectorModule> replicated_module_list
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why the copy? Can be const auto&?

void
PETSIRDInfo::figure_out_block_angles(std::set<float>& unique_angle_modules, const int rot_axis)
{
std::vector<petsird::ReplicatedDetectorModule> replicated_module_list
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy?

// const int num_ax = blocks_per_bucket_axial * num_axial_crystals_per_block;
// const int num_tang = blocks_per_bucket_transaxial * num_trans_crystals_per_block;

std::cerr << "Tile size (groupSize) = " << groupSize << "\n";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will want to comment this out, or replace with an info call at high verbosity (and sensible text)

Comment on lines +606 to +609
std::cerr << "Map size mismatch!\n"
<< "Forward size: " << petsird_to_stir->size() << "\n"
<< "Reverse size: " << stir_to_petsird->size() << std::endl;
error("Forward and reverse maps differ in size");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

merge all of that, e.g. using fmt::format as we cannot see stderr in ython for instance

// rotate by 30 degrees
phi2 = 30 * _PI / 180;
VoxelsOnCartesianGrid<float> image2 = *image.get_empty_copy();
VoxelsOnCartesianGrid<float> image2(image); // = *image.get_empty_copy();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changes from other PR?

# This is a temporary makefile used for development only.
# Do not use. Instead, use CMake for building
SWIG=swig
# CMAKE generated file: DO NOT EDIT!
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

certainly cannot have this. We should probably just delete this file (but not in this PR)

- *addons_apt_packages
- [g++-6]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=gcc-6 CXX=g++-6
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF -DDISABLE_PETSIRD:BOOL=ON" CC=gcc-6 CXX=g++-6
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

forget about .travis.yml, we should delete this file (but not in this PR)

Comment on lines +292 to +309
if(TARGET PETSIRD::petsird)
get_target_property(_petsird_libs PETSIRD::petsird INTERFACE_LINK_LIBRARIES)

# --- HDF5 ---
if(_petsird_libs MATCHES "HDF5::")
if(DISABLE_HDF5)
message(STATUS "PETSIRD was built with HDF5 → forcing DISABLE_HDF5=OFF")
set(DISABLE_HDF5 OFF CACHE BOOL "disable use of HDF5 libraries" FORCE)
endif()
endif()

# --- nlohmann_json (optional but recommended) ---
if(_petsird_libs MATCHES "nlohmann_json::")
if(DISABLE_NLOHMANN_JSON)
message(STATUS "PETSIRD was built with nlohmann_json → forcing DISABLE_NLOHMANN_JSON=OFF")
set(DISABLE_NLOHMANN_JSON OFF CACHE BOOL "disable use of nlohmann JSON libraries" FORCE)
endif()
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see no reason to do this. It might be that PETSIRD has it, but someone doesn't want to have it in STIR for whatever reason. Let's just cut this

- mkdir install
- cd build
- cmake .. -GNinja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_INSTALL_PREFIX="C:\projects\stir\install" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_CONFIGURATION_TYPES=%CONFIGURATION% -DSTIR_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=OFF -DBUILD_SWIG_PYTHON:BOOL=ON -DPython_EXECUTABLE=%CONDA_PREFIX%\python.exe -DCMAKE_PREFIX_PATH:PATH="%CONDA_PREFIX%"
- cmake .. -GNinja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_INSTALL_PREFIX="C:\projects\stir\install" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_CONFIGURATION_TYPES=%CONFIGURATION% -DSTIR_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=OFF -DDISABLE_PETSIRD:BOOL=ON -DBUILD_SWIG_PYTHON:BOOL=ON -DPython_EXECUTABLE=%CONDA_PREFIX%\python.exe -DCMAKE_PREFIX_PATH:PATH="%CONDA_PREFIX%"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hopefully no need for an explicit DISABLE_PETSIRD. Logic should be that it still works if it's not found

@KrisThielemans
Copy link
Collaborator Author

KrisThielemans commented Mar 4, 2026 via email

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.

5 participants