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

acquisition_sensitivity_from_ecat8.py crashes #926

Closed
evgueni-ovtchinnikov opened this issue May 18, 2021 · 14 comments
Closed

acquisition_sensitivity_from_ecat8.py crashes #926

evgueni-ovtchinnikov opened this issue May 18, 2021 · 14 comments
Assignees

Comments

@evgueni-ovtchinnikov
Copy link
Contributor

Script acquisition_sensitivity_from_ecat8.py crashes on calling AcquisitionSensitivityModel.forward, same trouble actually happening with all other normalisation methods (invert, normalise and unnormalise). I managed to trace the trouble to calling STIR's BinNormalisation methods undo and apply.

The crash is silent on Windows, on VM I get

terminate called after throwing an instance of 'std::runtime_error'
  what():  TimeFrameDefinitions: asked for frame 1, but only 0 frames present.
Aborted (core dumped)

Older versions of SIRF (21f8b96, 24 Mar 2021) and STIR (63d8d2373113a3f90eb67dfae2b429b80de9e9bd, 16 Mar 2021) are ok.

@KrisThielemans
Copy link
Member

which STIR version/commit are you on? which data? Probably this is because of incomplete header info but I didn't think this would happen. @danieldeidda might be able to help

@evgueni-ovtchinnikov
Copy link
Contributor Author

I used STIR master, commit 877511b607a90cbc3c3faebf9fa4e2dc3ea72f1b on Windows and commit dc6f3566f050b8d50f775ca531b06b9cffea3a59 on VM, and the same data data/examples/PET/mMR/norm.n.hdr that we have been using for ages.

@evgueni-ovtchinnikov
Copy link
Contributor Author

@KrisThielemans @danieldeidda Forgot to mention that get_multiplicative_sinogram.py also crashes on call to unnormalise.

BTW, if git log -- norm.n.hdr is to be believed, norm.n.hdr has not been changed since Wed Mar 7 07:17:51 2018.

@KrisThielemans
Copy link
Member

KrisThielemans commented May 18, 2021 via email

@evgueni-ovtchinnikov
Copy link
Contributor Author

@KrisThielemans according to git log, all files in mMR subfolder were created on Mar 7 2018, and we have been happily using them until at least Mar 24 this year.

While I have caught your attention: scatter_estimation.py needs files sinospan11_f1g1d0b0.hs, MLrandomsspan11_f1.hs and acf.hs - is it possible to generate them using our existing scripts? If not, we need to have them in data/examples/PET/mMR - where can I download them from?

@KrisThielemans
Copy link
Member

The demo uses mMR_template_span11.hs (see here and here.

That file doesn't contain time frame info.

UCL/STIR#891 will fix that requirement. However, the demo will need adjusting when we get to including time-frame info for calibration.

@KrisThielemans
Copy link
Member

should be fine now. Note that there won't have been a problem with STIR 4.x.

thanks for spotting this!

@evgueni-ovtchinnikov
Copy link
Contributor Author

@KrisThielemans thanks for fixing this promptly!

now reconstruct_from_listmode.py fails though...

ERROR: BinNormalisation set-up with different ExamInfo.
 Set_up was with
Modality: PT
Calibration Factor: -1.000000000000
Radionuclide:
Patient position: HFS
Scan start time: 0.0
Time frame start - end (duration), all in secs: 0.0 - 50.0 (50.0)
number of energy windows:=1
energy window lower level[1] := 430.0
energy window upper level[1] := 610.0

Called with
Modality: PT
Calibration Factor: -1.000000000000
Radionuclide:
Patient position: HFS
Scan start time: 0.0
Time frame start - end (duration), all in secs: 0.0 - 50.0 (50.0)
number of energy windows:=1
energy window lower level[1] := 430.0
energy window upper level[1] := 610.0

@KrisThielemans
Copy link
Member

KrisThielemans commented May 19, 2021 via email

@evgueni-ovtchinnikov
Copy link
Contributor Author

By the way, scatter-simulation.py currently only time after scatter-estimation.py, as this creates some extra files

Sorry, did not get what you wanted to say. Did you mean scatter_simulation.py must be run after scatter_estimation.py? So far as I can see, the former actually seems to run ok without the latter, whereas the latter fails because I do not have sinospan11_f1g1d0b0.hs, MLrandomsspan11_f1.hs and acf.hs. Perhaps I can use the outputs from listmode_to_sinograms.py and randoms_from_listmode.py for the first two? What about the third?

@KrisThielemans
Copy link
Member

Sorry, did not get what you wanted to say. Did you mean scatter_simulation.py must be run after scatter_estimation.py? So far as I can see, the former actually seems to run ok without the latter, whereas the latter fails because I do not have sinospan11_f1g1d0b0.hs, MLrandomsspan11_f1.hs and acf.hs. Perhaps I can use the outputs from listmode_to_sinograms.py and randoms_from_listmode.py for the first two? What about the third?

you're right of course. If nothing writes acf.hs, we'd have to create it at the moment (STIR limitation). They are the attenuation correction factors (so 1/bin-efficiencies (i.e. normalise a set of ones) obtained from the mu-map only,

@KrisThielemans
Copy link
Member

now reconstruct_from_listmode.py fails though...

ERROR: BinNormalisation set-up with different ExamInfo.

Relevant comparison code is here. I note that it checks for originating_system but it isn't printed. All the other comparisons seems fine. Maybe you could try to comment out that and see what happens? (could just as well print them out to see what they are).

The only other candidate I see is the radionuclide.

Obviously you have to be a bit careful when using the SuperBuild (set DISABLE_GIT_CHECKOUT_STIR=ON)

@evgueni-ovtchinnikov
Copy link
Contributor Author

the culprit was originating_system: this->originating_system was 2008, and p1.originating_system was Siemens mMR.

@evgueni-ovtchinnikov
Copy link
Contributor Author

scatter_estimation.py (edited a bit) seems to work fine on raw data sinograms and randoms computed by randoms_from_listmode and acf.hs computed by acquisition_sensitivity_from_attenuation.py.

all demos now work, GHA is happy, tagging 3.0.0 can be done any moment

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

No branches or pull requests

3 participants