spedemon / niftypy

(GPU accelerated) geometric primitives for volumetric imaging: ray-tracing, spatial transformations, finite differences, FFT-IFFT
Other
6 stars 1 forks source link

Basic Example for PET OSEM Reconstruction? #1

Closed kastman closed 9 years ago

kastman commented 9 years ago

Hi Stefano,

NiftyRec looks very promising, and I was able to get both the NiftyRec libraries installed (from the binary installer) and the NiftyPy wrapper set up (from pip, currently, but that's probably not master since import NiftyCore doesn't work). However, I'm totally clueless now as to what methods are required for running reconstruction.

My use case is a set of list-mode PET scans that I would like to reconstruct, probably using something simple like OSEM. I looked at the help for NiftyPy.NiftyRec.NiftyRec.PET_Project and see the arguments are "activity", "attenuation", and "binning". I also saw from the Programming Manual from 2012 that the inputs to these should be numpy arrays. However, when I look at the ctypes wrapper, it doesn't look like the "binning" argument is even used, and trying to run with made up data (a bunch of ones() and zeros() also following the manual matlab Transmission Tomography example, it's failing testing the exit status of the call - whatever was returned isn't even setting a .status attribute.

The data that I'm trying to reconstruct is from the MGH PET/MR scanner, so your back yard so to speak. Would you be interested in helping me adapt NiftyRec and your wrapper to it? If so I'd be happy to potentially write up some examples or tutorials, but my PET knowledge is fairly weak so I would definitely need help.

If tutorials or examples exist please send them my way; I won't be able to use this without a little more direction! Thanks in advance,

Erik

spedemon commented 9 years ago

Hi Erik,

At the moment the documentation is very scarce. NiftyPy provides functions for projection and back-projection. occiput.io uses NiftyPy and provides the higher level functionality to load list-mode data and reconstruct. In order to get started with OSEM reconstruction from list-mode PET data, refer to the IPython notebook ‘Occiput_PET_pineapple_reconstruct.ipynb’, in the /notebooks folder of occiput.io. If you have never used IPython, install it with pip, launch the terminal, change directory to /notebooks, type ‘ipython notebook’, then click on ‘Occiput_PET_pineapple_reconstruct.ipynb’. This opens the notebook. Edit the file name of the list-mode file and execute the notebook. (repeatedly press Shit+Return). This should give you a OSEM reconstruction. Note that the reconstruction does not account for the sensitivity of the detectors; this determines artifacts in the reconstructed image. I am working on a method to measure the characteristics of the scanner.

Thank you for offering to write a tutorial, it would be great. The software is just starting to be operative and needs documentation. Since we are both in Boston, let me know if you would like to meet in person! Streets are clear from the snow, I can easily reach you with my bike. Email me at spedemonte@mgh.harvard.edu

Best regards,

Stefano

kastman commented 9 years ago

Hey Stefano,

Got it - occiput is the main wrapper, and NiftyPy is the ctypes library. That makes sense.

I’ll take a look at our data; the notebook you were talking about [link] looks like it should give me a fighting chance, though some of the options aren't totally clear to me yet.

I’d definitely like to meet up and talk about putting together a little more documentation - even just my notes coming into this fresh may be useful for people? I’ll send you a separate email and we can take it from there!

One last thing to note - the js progress bar is probably great during recon, but makes reading the notebook a little tricky - even when running locally all you see is some ugly js output with a ton of scrolling. Not a problem, but worth mentioning. Cheers, Erik