Skip to content

SAFIR list-mode reading files fails from different directory #1680

@KrisThielemans

Description

@KrisThielemans

I have data from @markusjehl NeuroLF-15mm.hs listmode.safir listmode_file.par, where the latter is

CListModeDataSAFIR Parameters:=
  listmode data filename:= listmode.safir
  template projection data filename:= NeuroLF-15mm.hs
  LOR randomization (Gaussian) sigma := 0.0
END CListModeDataSAFIR Parameters:=

STIR can read this ok when run from the same directory. However, list_lm_info somedir/listmode_file.par fails with

WARNING: Error post processing keyword values.

WARNING: Error post processing keyword values.

HDF5-DIAG: Error detected in HDF5 (1.14.3) thread 1:
....
Available input file formats:
SAFIR Coincidence Listmode File Format
SAFIR Coincidence Listmode File Format
ECAT8_32bit
GEHDF5

ERROR: no file format found that can read file 'list-mode/listmode_file.par'

The HDF5 warnings/errors can be ignored, as it is indeed not an HDF5 file of course.

STIR generally follows the convention when parsing .hv/.hs etc that if an absolute path is not given, the filename is assumed to be relative to the directory of the header.

std::ifstream data_file(listmode_filename.c_str(), std::ios::binary);
, see e.g. here.

@markusjehl feel like doing this for SAFIR as well? (Obviously, best to avoid the C-strings functions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions