-
Notifications
You must be signed in to change notification settings - Fork 29
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
Enabling PET reconstruction from list mode data #1103
Conversation
looks good to me. Now the objective function... it should be virtually the same as the one for projection data. Main difference is that it only accepts a projection matrix (not a projector pair). |
Edo lm recon
@NikEfth I increased my VM memory to 16384, and got past set up, but the job was killed (it appears, not long before it would finish):
Would it be possible to shorten this test run time by quitting early? |
Yes, can you try with this file?
… On May 23, 2022, at 06:57, Evgueni Ovtchinnikov ***@***.***> wrote:
@NikEfth <https://github.com/NikEfth> I increased my VM memory to 16384, and got past set up, but the job was killed (it appears, not long before it would finish):
***@***.***:~$ cstir_test6
running test6.cpp...
WARNING: Interfile warning: 'default bin size (cm)' (0.208000) is expected to be 0.200000.
WARNING: Interfile warning: num_axial_blocks_per_bucket (35) is expected to be 7.
WARNING: Interfile warning: axial crystals per singles unit (8) is expected to be 56.
WARNING: Interfile warning: transaxial crystals per singles unit (8) is expected to be 32.
WARNING: Interfile warning: I have used all explicit settings for the scanner
from the Interfile header, and remaining fields set from the
UPENN_5rings model.
WARNING: Scanner UPENN_5rings: inconsistent transaxial block info
WARNING: Interfile parsing ended up with the following scanner:
Scanner parameters:=
Scanner type := UPENN_5rings
Number of rings := 280
Number of detectors per ring := 594
Inner ring diameter (cm) := 76.4
Average depth of interaction (cm) := 0.7
Distance between rings (cm) := 0.39655
Default bin size (cm) := 0.208
View offset (degrees) := 0
Maximum number of non-arc-corrected bins := 331
Default number of arc-corrected bins := 331
Energy resolution := 0.109
Reference energy (in keV) := 511
Number of blocks per bucket in transaxial direction := 4
Number of blocks per bucket in axial direction := 35
Number of crystals per block in axial direction := 8
Number of crystals per block in transaxial direction := 8
Number of detector layers := 1
Number of crystals per singles unit in axial direction := 8
Number of crystals per singles unit in transaxial direction := 8
Scanner geometry (BlocksOnCylindrical/Cylindrical/Generic) := Cylindrical
end scanner parameters:=
image dimensions: 559x200x200
Offset: (-208, -208, -0)
Spacing: (2.08, 2.08, 1.98275)
Size: (200, 200, 559)
Direction matrix:
1, 0, 0
0, 1, 0
0, 0, -1
== ok
WARNING: WARNING: ProjMatrixByBinUsingRayTracing used for pixel size (in x,y) that is larger than the bin size.
Backprojecting with this matrix might have artefacts at views 0 and 90 degrees.
WARNING: WARNING: ProjMatrixByBinUsingRayTracing used for pixel size (in x,y) that is larger than the bin size.
Backprojecting with this matrix might have artefacts at views 0 and 90 degrees.
tangential LORs: 2
Setting cache path...
Cache path: /home/sirfuser/devel/buildVM/sources/SIRF/data/examples/TBPET/
PoissonLogLikelihoodWithLinearModelForMeanAndListModeData: Skipping input!
Setting scanner template...
Dummy LM file
WARNING: The default max ring difference is set based full Scanner geometry
Setting acquisition model...
Setting max ring diff. ...
Sensitivity images: /home/sirfuser/devel/buildVM/sources/SIRF/data/examples/TBPET/sens_%d.hv
Setting max cache size ...
Max cache: 1500000000
Setting objective function ...
Setting up the reconstruction, please wait ...
WARNING: WARNING: ProjMatrixByBinUsingRayTracing used for pixel size (in x,y) that is larger than the bin size.
Backprojecting with this matrix might have artefacts at views 0 and 90 degrees.
WARNING: WARNING: ProjMatrixByBinUsingRayTracing used for pixel size (in x,y) that is larger than the bin size.
Backprojecting with this matrix might have artefacts at views 0 and 90 degrees.
WARNING: WARNING: ProjMatrixByBinUsingRayTracing used for pixel size (in x,y) that is larger than the bin size.
Backprojecting with this matrix might have artefacts at views 0 and 90 degrees.
WARNING: We skip the check on balanced subsets and presume they are balanced!
WARNING: We skip the check on balanced subsets and presume they are balanced!
Reconstructor set up.
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Starting loop with 10 threads
Killed
***@***.***:~$
Would it be possible to shorten this test run time by quitting early?
—
Reply to this email directly, view it on GitHub <#1103 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACEUB7U2TXCVNVKYSQ4TD43VLNQCLANCNFSM5VSFWYIA>.
You are receiving this because you were mentioned.
|
@NikEfth Thanks a lot, it works much faster now and does not get killed! |
Sure, but the images you get should not make sense |
@NikEfth not important at this stage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor comments which should be safe to implement as far as I can see.
src/xSTIR/pSTIR/STIR.py
Outdated
if likelihood_type == 'LinearModelForMean': | ||
#if likelihood_type == 'LinearModelForMean': | ||
if likelihood_type is None: | ||
obj_fun = PoissonLogLikelihoodWithLinearModelForMeanAndProjData() | ||
obj_fun.set_acquisition_data(acq_data) | ||
if acq_data is not None: | ||
obj_fun.set_acquisition_data(acq_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why we're changing this code here. Do we really need to? What happens if acq_data
is None
? It'd presumably crash. (Only the listmode case can handle this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KrisThielemans so far as I can see, Nikos' list mode objective function does not need acquisition data, so acq_data
must be optional. We need to discuss this with Nikos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. @NikEfth's listmode function can either use listmode data or the corresponding cache.
However, these lines are for the "old" case with projection data, which do need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will make this function throw in the non-listmode case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
presumably the old code did already, but if not, best to put it in, agreed.
I still think we can revert the default to what it as, such that we have minimal code change, but as you prefer.
@evgueni-ovtchinnikov @paskino Introducing an almost empty class on top of SIRF/src/xSTIR/cSTIR/cstir_p.cpp Lines 1056 to 1064 in 61e692d
So I think we can go ahead with this approach. I haven't checked the Python side yet. We did introduce a |
- derive ListmodeData from ContainerBase - add ListmodeData to C wrappers - add get_info() to STIRImageData and ListmodeData - expand STIRAcquisitionData::get_info() to add exam-info string - minimal documentation This now works fine through Python, but demos still need work.
things to do:
|
- add ListmodeData::acquisition_data_template() - let ListmodeToSinograms::set_input() cope with either filename or ListmodeData object
|
Best to remind all use_gpu lines from the demo, as it isn't supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the whole osem_lm_reconstruction.py needs to be removed. I think everything in it is in listmode_reconstruction.py, which is more complete. Some things on the osem demo are currently not supported anyway.
@@ -23,7 +23,7 @@ | |||
-C <cnts>, --counts=<cnts> account for delay between injection and acquisition start by shifting interval to start when counts exceed given threshold. | |||
--visualisations show visualisations | |||
--nifti save output as nifti | |||
--gpu use gpu | |||
--gpu use gpu (actually means: use NiftyPET projectors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep removed. The STIR listmode recon only supports projmatrixbybin at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean go back to just use gpu
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I mean remove all occurrences of use_gpu and the relevant lines to use niftypet, as it won't work anyway. See also main comment
I think that later we should move the preparation of randoms, scatter etc to SIRF itself, i.e. taking most of what you wrote for the challenge. However, let's do that in a separate PR, and merge this one asap. |
Still have trouble with
(see also our exchange with Nikos on 23 May 2022 above - back then reducing the size of data helped). |
I guess this is a problem on your VM. You should probably give it more memory. It's not clear where this happens. If it's during scatter estimation (as the above implies), reducing number of listmode events is not going to change anything, as the scatter estimate is a (full resolution) projdata. In any case, the number of events used here is very small. |
I think that later we should move the preparation of randoms, scatter etc to SIRF itself, i.e. taking most of what you wrote for the challenge. However, let's do that in a separate PR, and merge this one asap. |
True. I have increased VM memory from 6GB to 12GB, and Permission to merge? |
Great. Did you remove the osem_lm_reconstruction.py? Otherwise good to go. |
Oh. Don't forget to add something to the doc and changes.md |
Fixes #134.