gschramm / pyapetnet

a CNN for anatomy-guided deconvolution and denoising of PET images
https://gschramm.github.io/pyapetnet/
MIT License
13 stars 4 forks source link

Added option to export the reconstructed data on the original PET geo… #4

Open sbaete opened 2 years ago

sbaete commented 2 years ago

…metry. Adapted code to allow for reconstruction of multi-volume binned PET data.

gschramm commented 2 years ago

Hi Steven,

(1) many thanks for the pull request. Could you also add an option that allows to register every frame (instead of the sum)? This is useful for "late static imaging" with motion during the acquisition.

(2) Why did you change the fallback version in setup.py?

Bests, Georg

sbaete commented 2 years ago

Hey Georg,

(1) Good idea, let me think about it. That may indeed be a better approach for the later frames. How would you handle the earlier (low SNR) frames though? For now, to avoid too many problems, I first register all the frames using mcflirt from FSL before applying pyapetnet. Then registering the sum of the frames is a good approximation.

(2) I was getting some errors earlier, though they seem to have disappeared now when I reverse the change in fallback version.

Best,

Steven

gschramm commented 2 years ago

Hi Steven,

to keep the flexibility in summing a certain range of frame, you could add another keyword that is a list of lists (or a 1d numpy array of 1d numpy arrays) indiciation which frames should be summed. E.g. [ [1,2,3], [4], [5] ] would mean sum the first 3 frames for alignment, but align frame 4 and 5 separately. or [ [1,2,3,4,5] ] would mean sum all frames and do only 1 alignment.

Georg

gschramm commented 2 years ago

Hi Steven, many thanks again for the changes. I was more thinking of a command line argument like:

import argparse

parser = argparse.ArgumentParser(description='...')
parser.add_argument('--sum_for_align', default = None, type = int, nargs='+', action='append')

args = parser.parse_args()

print(args.sum_for_align)

If you call the script then via:

python myscript.py --sum_for_align 1 2 3 4 --sum_for_align 5 6 7  --sum_for_align 8 9 

args.sum_for_align contains a list of lists like [[1,2,3,4],[5,6,7],[8,9]] that you can pass to the pre-processing function. In the case of the example, I would sum frames 1,2,3,4 for the alignment of frames 1-4, sum frames 5,6,7 for the alignment of frames 5,6,7 and sum frames 8,9 for the alignment of 8,9. All other frames should be aligned separately. Of course, I would do the predictions on all frames individually and only use the sums for a better alignment. If None is passed (default), all frames should be aligned individually.

Does that makes sense?

Georg

sbaete commented 2 years ago

Hey Georg,

Ah, I may have misunderstood you partially. Your suggestion makes complete sense and it would be a great addition to the code. I do want to advocate though to also keep the option to use the registration to the sum of all frames for the low SNR frames.

Unfortunately, my python skills are not as good as yours, so I will leave it to you to adapt the code as you describe.

Steven

gschramm commented 2 years ago

That is indeed a good suggestions. I will have a look next week. Maybe an option to simply specify registration parameters (that were e.g. determined from another run) would be the easiest.