Replace missing opentps.core.examples imports with local helper modules#6
Merged
Replace missing opentps.core.examples imports with local helper modules#6
Conversation
Co-authored-by: Eliot-P <54665331+Eliot-P@users.noreply.github.com>
…s.path manipulation Co-authored-by: Eliot-P <54665331+Eliot-P@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove dependency on opentps.core.example module
Replace missing opentps.core.examples with local helper modules
Feb 3, 2026
Co-authored-by: Eliot-P <54665331+Eliot-P@users.noreply.github.com>
Copilot
AI
changed the title
Replace missing opentps.core.examples with local helper modules
Replace missing opentps.core.examples imports with local helper modules
Feb 3, 2026
Eliot-P
approved these changes
Feb 3, 2026
Member
Eliot-P
left a comment
There was a problem hiding this comment.
This PR was done using Copilot agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multiple example scripts imported from
opentps.core.examples.{syntheticData,showStuff}which no longer exists in the opentps package.Changes
Created local helper modules in
examples/:syntheticData.py- synthetic CT/4DCT generation (createSynthetic3DCT,createSynthetic4DCT,getPhasesPositions)showStuff.py- visualization utilities (showModelWithAnimatedFields, dose/DVH plotting functions)Updated 14 example scripts with direct imports:
Design notes:
filename_pattern: r'run_.*\.py$'config__init__.pyfiles requiredAffected: dynamicData (6 files), imageProcessing (4 files), Segmentation, multiplePythonEnv (2 files), registration (2 files)
Original prompt
examples/dynamicData/run_exampleMidP.py
examples/imageProcessing/exampleTransform3DCupy.py
examples/dynamicData/exampleInterFractionChanges.py
examples/Segmentation/run_Segmentation.py
examples/imageProcessing/cupyVSsitkTransforms.py
requires some opentps.core.example module that is no longer availiable. However, her is the script that they were using:
showStuff.py
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation
from scipy.ndimage import binary_dilation
import numpy as np
from opentps.core.processing.doseCalculation.doseCalculationConfig import DoseCalculationConfig
from opentps.core.processing.doseCalculation.protons.mcsquareDoseCalculator import MCsquareDoseCalculator
from opentps.core.io import mcsquareIO
from opentps.core.io.scannerReader import readScanner
from opentps.core.data import DVH
from opentps.core.processing.planOptimization.tools import evaluateClinical
from opentps.core.processing.imageProcessing.resampler3D import resampleImage3DOnImage3D, resampleImage3D
def showModelWithAnimatedFields(model):
def show2DMaskBorder(filledMaskSlice, color='red'):
def simulateAndShowOptiDoseDVH(ct, plan, roi, refSolver, figName='', outPutPath='', show=True):
# MCsquare simulation
ctCalibration = readScanner(DoseCalculationConfig().scannerFolder)
bdl = mcsquareIO.readBDL(DoseCalculationConfig().bdlFile)
...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.