Repository navigation
SAFIR list-mode: find relative filenames next to the parameter file - #1799
Open
frostyhand wants to merge 2 commits into
Open
frostyhand wants to merge 2 commits into
frostyhand wants to merge 2 commits into
Conversation
The list-mode, template projection data and crystal map filenames in a SAFIR parameter file were opened relative to the current directory, so reading failed unless STIR was run from the directory of the parameter file. They are now relative to the directory of the parameter file, as for Interfile headers. Absolute filenames are unchanged. Adds test_SAFIRCListmodeInputFileFormat. Fixes UCL#1680
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes in this pull request
Relative filenames in a SAFIR list-mode parameter file (
listmode data filename,template projection data filename,crystal map filename) are now relative to the directory of the parameter file, as for Interfile headers. Absolute filenames are unchanged.Previously,
post_processing()checked that the list-mode and template files exist before any directory handling. Run from another directory, both checks failed, which gave the two "Error post processing keyword values" warnings and "no file format found" in #1680.actual_do_parsing()now stores the directory of the parameter file (get_directory_name()), andpost_processing()prepends it to each relative filename withFilePath::prepend_directory_name()before the existence checks. No C-string functions are used.One behaviour change to be aware of: a parameter file in another directory whose filenames were written relative to the current directory (not to the parameter file) no longer works. That matches the Interfile convention you described in the issue.
Testing performed
test_SAFIRCListmodeInputFileFormatwrites a SAFIRDualRingPrototype template, a minimal SAFIR list-mode file and a parameter file into a subdirectory, then reads the list-mode data viaread_from_file<ListModeData>from the parent directory, with relative and with absolute filenames. On master the relative case fails with "no file format found"; with this change both pass.list_lm_info test_SAFIR_listmode_dir/listmode.par: aborts on master with the error from SAFIR list-mode reading files fails from different directory #1680, succeeds with this change. Running it from the directory of the parameter file still works.cteston macOS (arm64, conda clang 21, Release, without ITK/HDF5/ROOT/parallelproj): 68 of 71 tests pass underctest -j8. The other three are Interfile image IO tests; they pass when rerun one at a time and do not involve SAFIR.crystal map filename, as I have no SAFIR crystal map file.Related issues
Fixes #1680
Checklist before requesting a review
documentation/release_6.6.htmhas been updated with any functionality change (if applicable)Contribution Notes
Please tick the following: