Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions for MAPEM and reconstruct_measured_data #140

Merged
merged 2 commits into from
Jun 28, 2021

Conversation

ashgillman
Copy link
Member

No description provided.

@@ -254,7 +254,7 @@
"# Implement MAP-EM!\n",
"Actually, we will implement MAP-OSEM as that's easy to do.\n",
"\n",
"The lines below (almost) implement MAP-OSEM with a prior which just smooths along the horizontal direction. Either evaluate, and/or extend to 2D, and/or increase the speed of your Python code.\n",
"The lines below (almost) implement MAP-OSEM with a prior which just smooths along the horizontal direction.\n",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that the current compute_xreg would actually be made much faster by tweaking the implementation - and the use of jit would make it unpredictable. I don't know if its a good idea to suggest that the participants try to optimise it.

Extending to 2D is a good suggestion, but its already below in the "what now?" section

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

notebooks/PET/MAPEM.ipynb Outdated Show resolved Hide resolved
notebooks/PET/MAPEM.ipynb Outdated Show resolved Hide resolved
@@ -292,7 +294,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We will use the \"Just In Time\" compilation feature if `numba` here to speed-up the following function. (There are faster ways to write it, but this might be easier to understand)."
"We will use the \"Just In Time\" (jit) compilation feature of `numba` here to speed-up the following function."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'm not sure that this actually is that slow. I think jit would have every reason to be able to optimise this well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

"# This command prepends the data path to the data file so that the header in our working folder points to the data\n",
"# You likely won't need to do this for your own data if the data file is in the same directory.\n",
"!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1${data_path}/#\" umap.v.hdr\n",
"!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1${data_path}/#\" norm.v.hdr\n",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this seding is probably already confusing to the reader.

I've made the two sed lines more similar to one-another rather that confusingly using jupyter commands on the first one and os.system calls on the second

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you checked it still worked ok?

Of course, they can be combined in1, but that probably doesn't help the user.

could add a note that this is needed due to limitations of the current convert* scripts in STIR if you think that'd help

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tested.

this is needed due to limitations of the current convert* scripts

Well normally you'd run this and still have the file in the same directory - I don't think we'd want the convert* scripts to convert to absolute files (makes a pain for network directories, moving data, etc.) anyway. So I think the current comment communicates that

"# Advanced: if you'd like to have a look at what changed in the umap, uncomment below\n",
"# Lines starting with < are the original Siemens\n",
"# and lines starting with > are the STIR converted\n",
"# !diff $data_path/20170809_NEMA_MUMAP_UCL.v.hdr umap.v.hdr"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably quite interesting to participants who are familiar enough with diff

@@ -129,7 +137,7 @@
"metadata": {},
"outputs": [],
"source": [
"!cp $SIRF_PATH/../STIR/scripts/IO/convertSiemensInterfileToSTIR.sh $SIRF_INSTALL_PATH/bin"
"# !cp $SIRF_PATH/../STIR/scripts/IO/convertSiemensInterfileToSTIR.sh $SIRF_INSTALL_PATH/bin"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment it out so that users with trigger-happy fingers don't run it unnecessarily (although it will be needed for the course)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, is it going to fail on JupyterHub (and docker) due to read-only location? Better to write it in the current dir?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.. I don't have JupyterHub account to test. Can you give me one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think that can be a separate issue

"# is what we need to muliply by to correct for attenuation, while we computed the attenuation\n",
"# factors above, which is how much attenuation is estimated.\n",
"# Fortunately, these are simply the inverse.\n",
"acf_factors = attn_factors.get_uniform_copy()\n",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if readers will be familiar with the ACF/AF nomenclature?

@@ -254,7 +254,7 @@
"# Implement MAP-EM!\n",
"Actually, we will implement MAP-OSEM as that's easy to do.\n",
"\n",
"The lines below (almost) implement MAP-OSEM with a prior which just smooths along the horizontal direction. Either evaluate, and/or extend to 2D, and/or increase the speed of your Python code.\n",
"The lines below (almost) implement MAP-OSEM with a prior which just smooths along the horizontal direction.\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

notebooks/PET/MAPEM.ipynb Outdated Show resolved Hide resolved
notebooks/PET/MAPEM.ipynb Outdated Show resolved Hide resolved
notebooks/PET/MAPEM.ipynb Outdated Show resolved Hide resolved
notebooks/PET/reconstruct_measured_data.ipynb Outdated Show resolved Hide resolved
"# This command prepends the data path to the data file so that the header in our working folder points to the data\n",
"# You likely won't need to do this for your own data if the data file is in the same directory.\n",
"!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1${data_path}/#\" umap.v.hdr\n",
"!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1${data_path}/#\" norm.v.hdr\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you checked it still worked ok?

Of course, they can be combined in1, but that probably doesn't help the user.

could add a note that this is needed due to limitations of the current convert* scripts in STIR if you think that'd help

@@ -129,7 +137,7 @@
"metadata": {},
"outputs": [],
"source": [
"!cp $SIRF_PATH/../STIR/scripts/IO/convertSiemensInterfileToSTIR.sh $SIRF_INSTALL_PATH/bin"
"# !cp $SIRF_PATH/../STIR/scripts/IO/convertSiemensInterfileToSTIR.sh $SIRF_INSTALL_PATH/bin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, is it going to fail on JupyterHub (and docker) due to read-only location? Better to write it in the current dir?

Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
@KrisThielemans
Copy link
Member

done?

@ashgillman
Copy link
Member Author

Yes, with two spin-off issues

@KrisThielemans KrisThielemans merged commit b496149 into SyneRBI:master Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants