Skip to content

Commit

Permalink
update SPECT measured data
Browse files Browse the repository at this point in the history
- put in cells explictly for the download
- fixed typos
  • Loading branch information
KrisThielemans committed Jan 22, 2023
1 parent 9261007 commit f29e13d
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions notebooks/SPECT/SPECT_OSEM_measured_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "d65d78e9-42e6-41e3-906d-7feed7d333c7",
"metadata": {},
"source": [
"Simple OSEM reconstruction demo for real data: \n",
Expand All @@ -27,6 +28,7 @@
},
{
"cell_type": "markdown",
"id": "b6178d32-5fed-437f-a09b-e09e7f8806d3",
"metadata": {},
"source": [
"In this exercise you are going to apply what you learned in the previous notebooks about SPECT reconstruction to reconstruct real data. \n"
Expand All @@ -35,6 +37,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "aa352bef-7909-441c-b777-afdefe63f6ec",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -47,72 +50,72 @@
"# import engine module\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
"import os\n",
"from sirf_exercises import cd_to_working_dir\n",
"from sirf.Utilities import examples_data_path\n",
"from sirf.STIR import show_2D_array\n",
"from sirf.STIR import MessageRedirector\n",
"\n",
"import sirf.STIR as spect\n",
"cd_to_working_dir('measured_SPECT')\n",
"msg_red = MessageRedirector('info.txt', 'warnings.txt', 'errors.txt')"
"msg_red = MessageRedirector('info.txt', 'warnings.txt')"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"id": "076a8deb-632a-45a7-a696-78a4603dd4b3",
"metadata": {},
"outputs": [],
"source": [
"#move data to working_folder and show where we are\n",
"!pwd\n",
"!cp -r /mnt/materials/SIRF/PSMRTBP2022/Y90-NEMA-NPL/SPECT/* .\n",
"!ls ."
"Install OSF client and download the NPL data from https://osf.io/pcfb4/ this is a NEMA phantom with spherical inserts filled with Y90. No need to redo this if the data is already downloaded"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"id": "e3aa67ff-1507-44c2-93bc-de18d5ffa632",
"metadata": {},
"outputs": [],
"source": [
"The following is not needed if the data is already downloaded"
"%%bash\n",
"$SIRF_PYTHON_EXECUTABLE -m pip install osfclient\n",
"osf -p pcfb4 clone"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a48828a-6073-4176-bc88-b623e340df80",
"metadata": {},
"outputs": [],
"source": [
"# Install OSF client to download the NPL data from https://osf.io/pcfb4/ this is a NEMA phantom with spherical inserts filled with Y90\n",
"#bash_install = \"pip install osfclient\"\n",
"#process = sp.Popen(bash_install.split(), stdout=sp.PIPE)\n",
"#output, error = process.communicate()\n"
"os.chdir('pcfb4/osfstorage/Y90-NEMA-NPL/SPECT/')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "078feb1f-4b6e-48f6-800c-1e86d9089950",
"metadata": {},
"outputs": [],
"source": [
"# Actuall download\n",
"#bash_clone = \"osf -p pcfb4 clone\"\n",
"#process = sp.Popen(bash_clone.split(), stdout=sp.PIPE)\n",
"#output, error = process.communicate()"
"%ls"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d8cd3966-a6dd-496b-9209-662f785682b8",
"metadata": {},
"outputs": [],
"source": [
"# set data template use the path where the data is \n",
"templ_sino = spect.AcquisitionData('peak_1_projdata__f1g1d0b0.hs')\n",
"#check the name of umap in the folder as you will have to load that in the SPECTUBMatrix"
"sino = spect.AcquisitionData('peak_1_projdata__f1g1d0b0.hs')\n",
"mumap = spect.ImageData('umap_zoomed.hv')"
]
},
{
"cell_type": "markdown",
"id": "c6b812f7-062d-4ff3-b3f3-b0f5e79c8695",
"metadata": {},
"source": [
"# Exercise 1: Simple Reconstruction:\n",
Expand All @@ -122,18 +125,20 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c6bdf0f3-bddc-4389-a4e3-b715bf9c4eff",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "0d0677c5-69a0-4df3-8be7-373c13f6501e",
"metadata": {},
"source": [
"# Exercise 2: PSF Reconstruction:\n",
"2a) now change the acquisition model to include resolution modelling (use help(SPECTUBMatrix)) to find the right function. The resolution model in STIR is based on Gaussian function and assumes linear dependency of the sigma from the distance of the detector Sigma(d) = slope*d +Sigma0.\n",
"\n",
"The measured slope and sigma0 for these data is respectevely 0.027 and 0.417 (cm)\n",
"The measured slope and sigma0 for these data is respectively 0.027 and 0.417 (cm)\n",
"\n",
"2b) study the difference between OSEM and OSEM-PSF\n",
"\n",
Expand All @@ -143,6 +148,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c2299673-a6b7-4072-800f-268fe71bef7a",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit f29e13d

Please sign in to comment.