From 1c63798b7685756be9b8050ce5dce9cc775cfec1 Mon Sep 17 00:00:00 2001 From: Carlos Uribe Date: Fri, 13 Nov 2026 18:43:35 -0700 Subject: [PATCH 1/2] docs: fold the workflows directory into the documentation The repository root had a separate `workflows/` directory holding a single notebook and a README. Nothing in the repository referenced it, and its content is documentation: a task-oriented notebook that complements the qSPECT tutorial already published under docs/. - Move `workflows/qSPECT/counts_to_bqml.ipynb` to `docs/source/tutorials/qSPECT/counts_to_bqml.ipynb` and add it to the tutorials toctree beside the qSPECT tutorial it builds on. - Rewrite the notebook's introduction for a docs reader: name it as the batch counterpart to the qSPECT tutorial, link to that page, and carry over the conventions that lived in `workflows/README.md` (configure before running, keep patient data and outputs out of the repository, move reusable logic into the package). - Note the guided-lesson vs. run-on-your-own-data distinction in the tutorials index, so the rest of the README's purpose survives the move. - Delete `workflows/`. Verified with a clean Sphinx build: the page renders, the cross-link to the qSPECT tutorial resolves, and it appears in the tutorials index. The two remaining build warnings (the dosiomicsclass autodoc import, which needs the undeclared pyradiomics dependency, and a JSON lexing warning in the ROI mapping tutorial) both predate this change. --- docs/source/tutorials/index.rst | 9 ++++++++- .../tutorials}/qSPECT/counts_to_bqml.ipynb | 18 +++++++---------- workflows/README.md | 20 ------------------- 3 files changed, 15 insertions(+), 32 deletions(-) rename {workflows => docs/source/tutorials}/qSPECT/counts_to_bqml.ipynb (95%) delete mode 100644 workflows/README.md diff --git a/docs/source/tutorials/index.rst b/docs/source/tutorials/index.rst index 6eb244a..f686a96 100644 --- a/docs/source/tutorials/index.rst +++ b/docs/source/tutorials/index.rst @@ -1,7 +1,13 @@ Tutorials ========= -Hands-on walkthroughs that demonstrate common PyTheranostics workflows. +Hands-on walkthroughs that demonstrate common PyTheranostics workflows. + +Most pages here are guided lessons: read them through, and run the cells if you +want to follow along. A few are task-oriented notebooks meant to be downloaded, +configured and executed against your own data — they say so at the top. For +those, keep patient data, credentials and generated outputs outside the +repository, and never commit executed cells containing patient information. .. toctree:: :maxdepth: 1 @@ -11,5 +17,6 @@ Hands-on walkthroughs that demonstrate common PyTheranostics workflows. Data_Ingestion_Examples/Data_Ingestion_Examples segmentation/total_segmentator_tutorial qSPECT/qSPECT_Tutorial + qSPECT/counts_to_bqml ROI_Mapping_Tutorial/ROI_Mapping_Tutorial Dosimetry_Pipeline/voxel_based_dosimetry_with_lu177_dose_kernel diff --git a/workflows/qSPECT/counts_to_bqml.ipynb b/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb similarity index 95% rename from workflows/qSPECT/counts_to_bqml.ipynb rename to docs/source/tutorials/qSPECT/counts_to_bqml.ipynb index db74ed4..85635d5 100644 --- a/workflows/qSPECT/counts_to_bqml.ipynb +++ b/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb @@ -5,11 +5,15 @@ "id": "workflow-introduction", "metadata": {}, "source": [ - "# Convert reconstructed SPECT counts to Bq/mL\n", + "# Convert reconstructed SPECT counts to Bq/mL (batch)\n", "\n", - "This workflow finds reconstructed SPECT DICOM files below a user-selected directory, converts each image from scanner counts to quantitative Bq/mL with `DicomModify.make_bqml_suv`, and writes a new file beside the source using the suffix `_qSPECT.dcm`.\n", + "This page finds reconstructed SPECT DICOM files below a user-selected directory, converts each image from scanner counts to quantitative Bq/mL with `DicomModify.make_bqml_suv`, and writes a new file beside the source using the suffix `_qSPECT.dcm`.\n", "\n", - "One run represents **one radiopharmaceutical administration**. All time points therefore share the calibration factor, injection record, patient weight and height. Run the notebook separately for data from different administrations. Source files are never modified." + "It is the batch counterpart to the [qSPECT Tutorial](qSPECT_Tutorial.ipynb), which converts a single image and explains what the conversion does to the pixels and the header. Read that one first; this page assumes it.\n", + "\n", + "One run represents **one radiopharmaceutical administration**. All time points therefore share the calibration factor, injection record, patient weight and height. Run the notebook separately for data from different administrations. Source files are never modified.\n", + "\n", + "> **Before you run it.** Unlike the other tutorials, this notebook is meant to be configured and executed against your own data rather than read as a guided lesson. Download it from the [repository](https://github.com/qurit/PyTheranostics/blob/main/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb), then edit the configuration cells for your study. Keep patient data, credentials and generated outputs outside the repository, and never commit executed cells that contain patient information. If you find yourself adding reusable processing logic here, move it into the `pytheranostics` package instead and keep the notebook to configuration, orchestration, review and quality control." ] }, { @@ -554,14 +558,6 @@ "skipped_count = int((conversion_summary[\"status\"] == \"skipped\").sum())\n", "print(f\"Completed: {converted_count} converted, {skipped_count} skipped.\")" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "45005496", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/workflows/README.md b/workflows/README.md deleted file mode 100644 index 38fc8b6..0000000 --- a/workflows/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# PyTheranostics workflows - -This directory contains task-oriented notebooks for running common processing -steps. Unlike the notebooks under `docs/source/tutorials`, these workflows are -intended to be configured and executed on local data rather than read as guided -lessons. - -## Available workflows - -- `qSPECT/counts_to_bqml.ipynb`: convert reconstructed SPECT DICOM images from - scanner counts to quantitative Bq/mL DICOM files. - -## Usage conventions - -- Review and edit each notebook's configuration cells before execution. -- Keep patient data, credentials, and generated outputs outside the repository. -- Do not commit executed cell outputs containing patient information. -- Move reusable processing logic into `pytheranostics`; notebooks should focus - on configuration, orchestration, review, and quality control. - From dce944fa761b0376145e3ed92f3057ccb35af7d8 Mon Sep 17 00:00:00 2001 From: Carlos Uribe Date: Sat, 14 Nov 2026 05:48:22 -0700 Subject: [PATCH 2/2] docs: point source links at main and add notebook download links Two fixes to the documentation configuration. `source_branch` was still "dev". That branch was deleted when the trunk was consolidated onto main, so furo's View and Edit buttons pointed at a branch that no longer exists; the published site served a 404 from every one of its 17 pages. Point it at main. Furo has no download button, and nbsphinx adds none by default, so the notebooks were published but unlinked: nbsphinx copies each .ipynb next to its rendered HTML, and the file was reachable only by typing its URL. Add an nbsphinx_prolog giving each notebook page a link to its source on GitHub and a download link to its own .ipynb. The href is a plain relative filename pointing at the copy nbsphinx already writes, so no second copy is created under _downloads. The batch qSPECT page no longer needs the hardcoded repository URL in its introduction and now refers to the prolog's link instead. Verified in a clean build: no /dev/ links remain, View and Edit resolve against main, all seven notebook pages carry a download link whose target file exists beside the page, the prolog does not reach non-notebook pages, and the generated-from links return 200 on GitHub. The two remaining build warnings predate this branch. --- docs/source/conf.py | 26 ++++++++++++++++++- .../tutorials/qSPECT/counts_to_bqml.ipynb | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 88dddf6..982ffab 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -75,7 +75,7 @@ "navigation_with_keys": True, "top_of_page_buttons": ["view", "edit"], "source_repository": "https://github.com/qurit/PyTheranostics/", - "source_branch": "dev", + "source_branch": "main", "source_directory": "docs/source/", "light_css_variables": { "color-brand-primary": "#0f766e", @@ -129,6 +129,30 @@ nbsphinx_allow_errors = False nbsphinx_codecell_lexer = "python" +# Furo has no download button, so give every notebook page a link to its own +# .ipynb. nbsphinx already copies that file next to the rendered HTML, so the +# href is a plain relative filename and nothing is duplicated into _downloads. +# nbsphinx_prolog is applied to notebooks only, so env.docname + ".ipynb" is +# always the source file for the page being rendered. +nbsphinx_prolog = """ +{% set nbpath = env.docname + '.ipynb' %} +{% set nbfile = env.docname.split('/')|last|e + '.ipynb' %} + +.. raw:: html + +
+

Jupyter notebook

+

+ This page was generated from + {{ nbpath }}. + Download the notebook + to run it on your own data. +

+
+""" + myst_enable_extensions = [ "colon_fence", "deflist", diff --git a/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb b/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb index 85635d5..4cc5aa9 100644 --- a/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb +++ b/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb @@ -13,7 +13,7 @@ "\n", "One run represents **one radiopharmaceutical administration**. All time points therefore share the calibration factor, injection record, patient weight and height. Run the notebook separately for data from different administrations. Source files are never modified.\n", "\n", - "> **Before you run it.** Unlike the other tutorials, this notebook is meant to be configured and executed against your own data rather than read as a guided lesson. Download it from the [repository](https://github.com/qurit/PyTheranostics/blob/main/docs/source/tutorials/qSPECT/counts_to_bqml.ipynb), then edit the configuration cells for your study. Keep patient data, credentials and generated outputs outside the repository, and never commit executed cells that contain patient information. If you find yourself adding reusable processing logic here, move it into the `pytheranostics` package instead and keep the notebook to configuration, orchestration, review and quality control." + "> **Before you run it.** Unlike the other tutorials, this notebook is meant to be configured and executed against your own data rather than read as a guided lesson. Download it with the link above, then edit the configuration cells for your study. Keep patient data, credentials and generated outputs outside the repository, and never commit executed cells that contain patient information. If you find yourself adding reusable processing logic here, move it into the `pytheranostics` package instead and keep the notebook to configuration, orchestration, review and quality control." ] }, {