ENHANCE-PET / FALCON

FALCON is a Python-based software application designed to facilitate PET motion correction, both for head and total-body scans. Our program is built around the fast 'greedy' registration toolkit, which serves as the registration engine. With FALCON, users can enjoy a streamlined experience for implementing motion correction.
GNU General Public License v3.0
36 stars 6 forks source link

Feat: Falcon now automatically identifies start frame for performing motion correction #18

Closed LalithShiyam closed 2 years ago

LalithShiyam commented 2 years ago

It would be great to objectively determine from which frame the motion correction needs to be performed. By doing so, the user doesn't need to mention a start frame based on heuristics.

Keyn34 commented 2 years ago

Using 37 Zubal phantom frames without imposed motion, acquired MI over all frames can be seen in the graph below:

Image

Two approaches I came up with for now to determine the starting frame: [1]: get the frame where the change in MI reduces by 75% (e.g.: frame 4 as in the figure above) as starting frame [2]: calculate the MI of the reference frame itself and base a threshold on this value to determine starting frame

LalithShiyam commented 2 years ago

Image

Awesome! This would be my suggested approach. We know that the last four frames are very similar to each other (34-37) in terms of structure and intensity (kind-of). I would take the average (median/mean) of the MI of the last four frames (original resolution), say "avg_ref_mi". And the rule for finding the start frame would be the following: If the downsampled (1/8th org resolution) MI ("low_res_mi" is greater than the "avg_ref_mi", we should consider this as the start frame. @Keyn34 do you feel this makes sense?

Keyn34 commented 2 years ago

It makes perfect sense to me... Working on it now!

I also quickly stitched together the first 25 frames, resampled vs original, for comparison: Resampled_vs_Original_ZUBAL.odt

LalithShiyam commented 2 years ago

@Keyn34 Great! would be nice to show the frame 37 (original and downsampled version as well). Because we need to see how they match up. Also use a screenshot, no .odt.

Keyn34 commented 2 years ago

The result of implementation is spot on with what you proposed @LalithShiyam: Computing threshold between file vol34.nii and vol37.nii MI threshold: -0.06680289264331131 Threshold: Starting frame found at index 2, file vol03.nii

Included frame 37. I will see how I can extract a nice screenshot from the odt, it's just for arranging the files for now.

Keyn34 commented 2 years ago

@LalithShiyam, I pushed the function I implemented for this issue in the corresponding issue branch in FALCON. I will wait for a pull request once we have decided where to put the function and tested it. Is this ok?