Skip to content

Simset input#1678

Draft
NikEfth wants to merge 41 commits intoUCL:masterfrom
NikEfth:simset_input
Draft

Simset input#1678
NikEfth wants to merge 41 commits intoUCL:masterfrom
NikEfth:simset_input

Conversation

@NikEfth
Copy link
Collaborator

@NikEfth NikEfth commented Feb 18, 2026

Changes in this pull request

This PR add support for SimSET history files.

In order to make this run you need to link to SimSET.
Apply this patch to SimSET and recompile.
This will crate a lib file that you can point to at CMake.

Testing performed

Related issues

Checklist before requesting a review

  • [] I have performed a self-review of my code
  • [] I have added docstrings/doxygen in line with the guidance in the developer guide
  • [] I have implemented unit tests that cover any new or modified functionality (if applicable)
  • The code builds and runs on my machine (in the past)
  • [] documentation/release_XXX.md has been updated with any functionality change (if applicable)

Contribution Notes

Please tick the following:

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in STIR (the Work) under the terms and conditions of the Apache-2.0 License.
  • I (or my institution) have signed the STIR Contribution License Agreement (not required for small changes).

NikEfth and others added 30 commits March 15, 2019 09:03
There is a weird point, as in order to get to the version I need to skip to byte 32 and read it as big endian. The header kind and header size are read correctly, as little endians in the right place.  In the print_header I cannot any relevant process.
Progress on matters of initialisations using SimSET headers. 
Next step, initialise the history header and get events.
Test pending. 
Todo: fix the signature. Now it is always on.
I am trying to make the old simSET example to work. Had to modify slightly the binning module to match with STIR scanner template. But the error of the different axial length persists. I am trying to guess the geometry with even fewer data.
Copy link
Collaborator

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

some initial comments. What's in the SimSET.tar.gz? Can't check in source code.


#endif

// This is an alternative version of the is_SimSET_signature.
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't be here

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 will have removed it by the end of this PR

endif()

if (HAVE_SIMSET)
list(APPEND ${dir_LIB_SOURCES}
Copy link
Collaborator

Choose a reason for hiding this comment

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

will probably need changing

// uncompressed bins in a compressed bin

const float bin_value = 1.f / bin_efficiency;
const float bin_value = uncompressed_bin.get_bin_value() / bin_efficiency;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems dangerous for backwards compatibility and will need careful checking

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem is that SimSET events carry can carry weights and we need those.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Either in the cylidrical or the blocks geometry, I am not 100% sure in which the weights were applicable.

# NOTE: Take note if you are setting min_td and max_td to any value less than the radius of your object cylinder.
# num_td_bins needs to be odd for STIR, and the range needs to be symmetric
INT num_td_bins = 287
INT num_td_bins = 288
Copy link
Collaborator

Choose a reason for hiding this comment

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

see comment above. For even-sized, I seem to recall there was a difference between SimSET and STIR conventions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably. But that is why the TOF modification from PETSIRD is relevant, here. IDK what to do. Bring that over and resolve the conflict later? Which one will be merged first?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This has nothing to do with TOF. It is tangential positions.

In any case, and "even TOF" mods should not be in either of these PRs, so they should be independent. To be discussed tomorrow what we do with the even TOF bins (with @danieldeidda)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops.. I missread. Let's keep this open I don't remeber right now.

@KrisThielemans KrisThielemans self-assigned this Feb 18, 2026
@NikEfth
Copy link
Collaborator Author

NikEfth commented Mar 4, 2026

OK, solid progress on this one. We are able to compile the latest master with SimSET support. I have not tested yet.

Copy link
Collaborator

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

some house-keeping comments, nothing really regarding functionality.

I suggest moving most (all?) of .inl to .cxx to .cxx. There seems to be no reason to think any compiler will be able to inline all of that code (and the remaining ones are probably hardly ever used anyway)

Comment on lines +53 to +58
target_compile_definitions(SIMSET::simset INTERFACE DARWIN MAC_10 GEN_UNIX arm64)
elseif(UNIX)
target_compile_definitions(SIMSET::simset INTERFACE GEN_UNIX)
elseif(WIN32)
target_compile_definitions(SIMSET::simset INTERFACE WIN32)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix indentation, but I'm hoping we don't need these (They are needed for Simset compilation, but do we need it for the Simset headers?) Add a comment if so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Photon.h uses types like LbFourByte, LbUsFourByte, etc. Those are defined in SimSET’s LbTypes.h inside an OS-specific #if ... #elif ... block. If none of the expected platform macros are defined, you get “unknown type name LbFourByte” (or even #error you have not declared an OS-dependent clause). This can be changed in the SimSET code. No super hard, but we need to wait until the public version.

START_NAMESPACE_STIR

//! N.E: Large parts adapted from phgbin and functions called by it;
CListModeDataSimSET::CListModeDataSimSET(const std::string& _hsimset_filename)
Copy link
Collaborator

Choose a reason for hiding this comment

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

either we move all/most of this into open_lm_file (which could be useful if at some point we want to be able to call it from somewhere else), or we delete open_lm_file

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.

3 participants