Skip to content

Conversation

@ataha24
Copy link
Member

@ataha24 ataha24 commented Feb 14, 2025

🚀 PR: Stereotactic Target Prediction

🧠 Overview
This PR implements stereotactic target prediction, based on the idea that brain coordinates are spatially correlated and can be used to predict each other (10.1016/j.neurom.2022.10.015). This feature leverages a pre-trained machine learning model to predict surgical targets from anatomical fiducials (AFIDs), enhancing preoperative planning workflows.

🔍 How It Works
The workflow takes the output of the gen_fcsv rule (CNN-generated AFIDs) and feeds it into the new stereotaxy rule (stereotaxy.smk). The pre-trained model maps these AFIDs to a stereotactic target of interest. Currently, the codebase supports the prediction of the subthalamic nucleus (STN). Future updates will include support for additional targets (e.g., cZI, GPi).

📂 Outputs of stereotaxy.smk
.fcsv file: Contains the predicted target coordinates

ACPC transformation matrix (.txt): Compatible with 3D Slicer for easy visualization of the predicted target in native brain space

🔧 Changes to the Codebase

utils.py
Added new helper functions for coordinate transformation, ACPC alignment, and AFID manipulation (with annotations).

stereotaxy.smk
New rule to activate the correct model and predict surgical targets from AFIDs.

📁 Resource Additions
Pre-trained models, .fcsv template files, and transformation utilities for modularity and ease of extension.

📚 Documentation Updates
Instructions on how to use the stereotaxy feature, including guidelines for adding new stereotactic targets.

⚠️ Known Issues

  • Rebuild Docker and DAG files to represent added features
  • Rework stereotaxy.smk to dynamically load the correcttarget_fcsv template when target is requested (Currently only support STN)
  • Model and software compatibility issues (e.g., models may become incompatible with the latest versions of TensorFlow or scikit-learn)

@ataha24 ataha24 added the enhancement New feature or request label Feb 14, 2025
ataha24 added 4 commits March 6, 2025 11:31
-expose setereotaxy.py as a recognizable shell command (similar to apply.py)
-fix target labeling and encoding
-tested end-to-end workflow
- tested workflow end-to-end and ran successfully on linux machine using poetry for configuration
@Dhananjhay Dhananjhay force-pushed the ataha24/stereotaxy branch from 6974844 to 91ca79f Compare March 6, 2025 16:37
@Dhananjhay
Copy link
Contributor

⚠️ Known Issues

Rebuild Docker and DAG files to represent added features

Rework stereotaxy.smk to dynamically load the correcttarget_fcsv template when target is requested (Currently only support STN)

Model and software compatibility issues (e.g., models may become incompatible with the latest versions of TensorFlow or scikit-learn)

Hey @ataha24! I have rebased djay/docker branch onto this branch/PR which involved resolving some merge conflicts but it's done! Since this is the next big picture item on our to-do list, I think we should focus on merging this PR soon. Once you are done working on the above mentioned issues, more specifically issue number 2 on the list, @mackenziesnyder and I can takeover and get this PR ready, i..e, update DAG, docker image and any miscellaneous debugging, for merging!

@ataha24
Copy link
Member Author

ataha24 commented Mar 7, 2025

⚠️ Known Issues
Rebuild Docker and DAG files to represent added features
Rework stereotaxy.smk to dynamically load the correcttarget_fcsv template when target is requested (Currently only support STN)
Model and software compatibility issues (e.g., models may become incompatible with the latest versions of TensorFlow or scikit-learn)

Hey @ataha24! I have rebased djay/docker branch onto this branch/PR which involved resolving some merge conflicts but it's done! Since this is the next big picture item on our to-do list, I think we should focus on merging this PR soon. Once you are done working on the above mentioned issues, more specifically issue number 2 on the list, @mackenziesnyder and I can takeover and get this PR ready, i..e, update DAG, docker image and any miscellaneous debugging, for merging!

Cool, thanks for doing that @Dhananjhay! This branch is ok as is, just need to change the way we execute the rule as it is structured in the same way that apply used to be called.

@Dhananjhay
Copy link
Contributor

Merging this, excellent work as always @ataha24!!

@Dhananjhay Dhananjhay merged commit ab8bea3 into djay/docker Mar 7, 2025
@Dhananjhay Dhananjhay deleted the ataha24/stereotaxy branch March 7, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants