SyneRBI / PETRIC

PET Image Reconstruction Challenge 2024
https://www.ccpsynerbi.ac.uk/events/petric/
2 stars 1 forks source link

Additional scripts needed #13

Closed KrisThielemans closed 2 days ago

KrisThielemans commented 2 weeks ago

Prepared data (sinograms, OSEM_image, kappa, some plots) are at https://petric.tomography.stfc.ac.uk/data/

TODO

KrisThielemans commented 2 weeks ago

Current status on cdcl machine

download

python download_Siemens_mMR_NEMA_IQ.py 

creates

create acquisition data etc

first edit data_utilities.py to set DATA_PATH (see #15), then

python prepare_mMR_NEMA_IQ_data.py

creates in dir that you set for DATA_PATH, which I set to ~/work/PETRIC (files should be in mMR/NEMA_IQ` subfolder of that)

20170809_NEMA_MUMAP_UCL.hv
20170809_NEMA_MUMAP_UCL.v
20170809_NEMA_UCL.n
additive_term.hs
additive_term.s
intermediate
md5sums.txt
mMR_template_span11.hs
mMR_template_span11.s
mMR_template_span11_small.hs
mMR_template_span11_small.s
multfactors.hs
multfactors.s
norm.n.hdr
prompts_f1g1d0b0.hs
prompts_f1g1d0b0.s
prompts.hs
prompts.s

There's far too many files there. (Edit: fixed in 871346ba36cf324a1e943ba84c74819df4ec8920)

create OSEM

python create_initial_images.py ~/work/PETRIC/data -t 20170809_NEMA_MUMAP_UCL.hv

fails as filename conventions don't match. Fix: multfactors->mult_factors. (fixed in e6dd43a1209140d708917e225d92d4ce161c58fa)

The OSEM_image output was nonsense however (min -2E35, max 0). This is due to https://github.com/UCL/STIR/issues/1280

generate ROIs

find where SIRF-Contribs is from $PYTHONPATH (or later do from python)

cd ~/work/PETRIC/data
python ~/devel/install/sirf/contrib/NEMA/generate_nema_rois.py -i OSEM_image.hv

run BSREM

no script yet.

KrisThielemans commented 2 weeks ago

Using https://github.com/UCL/STIR/pull/1463, initialisation is fine. However, OSEM gives a ring-artefact at the edge of the FOV currently, but when forcing image-size to xy-size 200

python ~/devel/PETRIC/SIRF_data_preparation/create_initial_images.py ~/devel/PETRIC/data -t 20170809_NEMA_MUMAP_UCL.hv --xy-size 200

it's fine. ROIs are also fine

im=STIR.ImageData('../data/OSEM_image.hv')
S6=STIR.ImageData('../data/S6.hv')
...
plt.imshow(im.as_array()[72,:,:],alpha=((S1+S3+S5+S6).as_array()[72,:,:]+1)/2)

image

KrisThielemans commented 2 weeks ago

I've put a preliminary script for BSREM on the BSREM_scripts branch.

Left: 80 updates, middle: 660 updates, right: diff (at colour scale (-max,max)/20) image

(im80-im660).abs().max()/im660.max()
np.float32(0.022381468)
KrisThielemans commented 2 weeks ago

NeuroLF with some corrections. I used exactly same settings, but BSREM subsets 16 image

Objective function image still a bit to go.

This took 1.5s per update on tomography.stfc

KrisThielemans commented 1 week ago

Vision 600 data with same settings, but 5 subsets. 80, 580 and 660 updates. (sorry, diff image failed) image image image about 6s per update

KrisThielemans commented 1 week ago

For the record: data for mMR NEMA IQ was generated as follows:

cd ~/devel/PETRIC/SIRF_data_preparation
python download_Siemens_mMR_NEMA_IQ.py
python prepare_mMR_NEMA_IQ_data.py
DATADIR=~/devel/PETRIC/data/Siemens_mMR_NEMA_IQ/final
python create_initial_images.py $DATADIR -t ../processing/20170809_NEMA_MUMAP_UCL.hv --xy-size 200
pushd $DATADIR
python ~/devel/install/python/sirf/contrib/NEMA/generate_nema_rois.py -i OSEM_image.hv
rm *ahv *nii unregistered*
popd

However, I'll put the output in the shared location.

KrisThielemans commented 1 week ago

Latest mMR results (slightly noisier data). 80, 580 and 660 updates and diff between the last 2 (at -max/20,max/20) mMR_BSREM_obj_func mMR_NEMA_BSREM_transverse_images

KrisThielemans commented 2 days ago

all done with this!