Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listmode files can start with non-zero time-tag #70

Open
KrisThielemans opened this issue Mar 12, 2017 · 7 comments
Open

listmode files can start with non-zero time-tag #70

KrisThielemans opened this issue Mar 12, 2017 · 7 comments
Milestone

Comments

@KrisThielemans
Copy link
Collaborator

Timing is currently in terms of the value of the time tag. For Siemens files, the first time tag is usually zero, but in ~1% of the cases not. GE files never start with zero. It would therefore be better to have timing relative to the value of the first time tag. Current work-around: use list_lm_events to find first time tag and create initial “skip-frame” in the frame-defs file.

@KrisThielemans
Copy link
Collaborator Author

KrisThielemans commented Jul 23, 2020

example script:

first_tag=`list_lm_events --time 1 --coincidence 0 --num-events-to-list 1 $list_filename`
echo "0 $first_tag" > $fdef_filename
# now have the rest of the fdef info, e.g.
1 $frame_duration

@AnderBiguri
Copy link
Collaborator

@KrisThielemans How is the skip frame defined then? will STIR know to ignore a frame that contains zero events in the listmode, or will it actually attempt to recon/process a PET image with all zeroes in the sinos?

@KrisThielemans
Copy link
Collaborator Author

an fdef with a line 0 100 will make LmToProjData et al skip 100 seconds. In this case, there are actually no data in those first $first_tag seconds, so it won't do anything, except make sure that all the rest is ok.

@AnderBiguri
Copy link
Collaborator

Ah, my question was more: Does it skip it because it skips whatever is in the first line? Skips whatever starts with 0? or checks if there are events, and skips if there are no events? What is the logic?

@KrisThielemans
Copy link
Collaborator Author

it advances the start of the next time frame without storing data because of the first 0

This class in fact allows an extension of the above. Setting
\a num_frames_of_this_duration to 0 allows skipping
a time period of the corresponding \a duration_in_secs.

the fdef doesn't check events itself at all.
LmToProjData and other loops only store data that are within the time-frames asked for (but it assumes that the clock starts at zero, which it doesn't for GE data, so we have to "skip" the first time until the start of the GE clock)

@AnderBiguri
Copy link
Collaborator

AnderBiguri commented Jul 24, 2020

In any case, a more complete example script would be:

first_tag=`list_lm_events --time 1 --coincidence 0 --num-events-to-list 1 $list_filename | tr -d '\n' | awk '{print $NF}'`
echo "0 $first_tag" > $fdef_filename

Just removes newlines and grabs the last word in the output of list_lm_events, as its a bit verbose.

@AnderBiguri
Copy link
Collaborator

AnderBiguri commented Jul 24, 2020

@KrisThielemans your proposed solution does not seem to work for GE data. the first prompt in my example dataset is at Time 7467, but when I do list_lm_events --time 1 --coincidence 0 --num-events-to-list 1 $list_filename, each single listed with +1 in that number. If I use 7467 to define the start time (by ignoring that amount of seconds) then it generates empty sinograms.... Only if I make a fdef with content 1 10000000 will the code generate non-empty sinograms for GE data.

Not sure if this is a problem with how list_lm_events reads GE data, with different scale of the numbers (ms vs s?) or something else, but just in case, letting you know that the example does not work for GE. I can't really test this because my n_samples=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants