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/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..4cc5aa9 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 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." ] }, { @@ -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. -