-
Notifications
You must be signed in to change notification settings - Fork 95
STIR Howto Create Custom InputFileFormat
Casper da Costa-Luis edited this page Nov 25, 2024
·
1 revision
When using a custom scanner, it might be convenient or needed to create one's own (coincidence) list-mode input file format. Here are some basic steps
In coincidence list mode data (cLMD) there are usually two types of records: Event data records, which essentially store the coordinates of the two detectors in coincidence, and time data records, which contain a time stamps and are inserted every so and so many event records. Some inspiration of the following can be obtained from CListRecordECAT962.h in the STIR source code. In that you need
- class CListEventDataMyScanner
- contains the event data as POD types. Be sure not to have pointers or fancy data types. ECAT962 for example uses unsigned int bitfields. Careful with byte order!
- class CListTimeDataMyScanner
- Same as before just for time stamps. One bit of each class data should be reserved for labeling type and both classes data members should have same size, i.e. sizeof(CListEventDataMyScanner) == sizeof(CListTimeDataMyScanner) should be true.
- template class CListEventMyScanner : public CListEvent
- needs the following abstract methods to be implemented in the custom
class
- virtual bool is_prompt () const =0
- virtual LORAs2Points< float > get_LOR () const =0
- needs the following abstract methods to be implemented in the custom
class
- class CListRecordMyScanner : public CListRecord, public CListTime,
public CListEventMyScanner
- needs the following abstract methods to be implemented in the custom
class (see also implementation for ECAT962)
- virtual bool is_time () const =0
- virtual bool is_event () const =0
- virtual CListEvent & event ()=0
- virtual const CListEvent & event () const =0
- virtual CListTime & time ()=0
- virtual const CListTime & time () const =0
- virtual bool operator== (const CListRecord &e2) const =0
- virtual unsigned long get_time_in_millisecs () const =0
- virtual Succeeded set_time_in_millisecs (const unsigned long time_in_millisecs)=0
- nice to have is a private union data type to combine time and event
data and provide a raw data access, where sizeXX corresponds to the
size of an integer data type equal to the size of your event and
time classes from above
- union { CListEventDataMUPET event_data; CListTimeDataMUPET time_data; sizeXX raw; };
- needs the following abstract methods to be implemented in the custom
class (see also implementation for ECAT962)