Skip to content

Commit 048b699

Browse files
CopilotEliot-P
andauthored
Replace missing opentps.core.examples imports with local helper modules (#6)
* Initial plan * Add helper modules syntheticData.py and showStuff.py and update imports --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Eliot-P <54665331+Eliot-P@users.noreply.github.com>
1 parent 6a39aa6 commit 048b699

16 files changed

Lines changed: 545 additions & 19 deletions

examples/Segmentation/run_Segmentation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
from opentps.core.data.images import CTImage
3232
from opentps.core.processing.segmentation.segmentation3D import applyThreshold
3333
from opentps.core.processing.segmentation.segmentationCT import SegmentationCT
34-
from opentps.core.examples.syntheticData import *
34+
import sys, os
35+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
36+
from syntheticData import *
3537

3638
logger = logging.getLogger(__name__)
3739

examples/dynamicData/exampleInterFractionChanges.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
from opentps.core.processing.deformableDataAugmentationToolBox.modelManipFunctions import *
4747
from opentps.core.processing.imageProcessing.imageTransform3D import rotateData, translateData, applyTransform3D
4848
from opentps.core.processing.imageProcessing.resampler3D import resampleImage3DOnImage3D
49-
from opentps.core.examples.syntheticData import createSynthetic4DCT
49+
import sys, os
50+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
51+
from syntheticData import createSynthetic4DCT
5052

5153
logger = logging.getLogger(__name__)
5254

examples/dynamicData/run_exampleApplyBaselineShiftToModel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
from opentps.core.processing.imageProcessing.syntheticDeformation import applyBaselineShift
3535
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
3636
from opentps.core.data.dynamicData._dynamic3DSequence import Dynamic3DSequence
37-
from opentps.core.examples.syntheticData import *
37+
import sys, os
38+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
39+
from syntheticData import *
3840

3941
logger = logging.getLogger(__name__)
4042

examples/dynamicData/run_exampleDeformableBreathigDataAugmentation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
from opentps.core.processing.deformableDataAugmentationToolBox.generateDynamicSequencesFromModel import generateDynSeqFromBreathingSignalsAndModel
4040
from opentps.core.processing.imageProcessing.imageTransform3D import getVoxelIndexFromPosition
4141
from opentps.core.processing.imageProcessing.resampler3D import resample
42-
from opentps.core.examples.syntheticData import*
42+
import sys, os
43+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
44+
from syntheticData import*
4345

4446
logger = logging.getLogger(__name__)
4547

examples/dynamicData/run_exampleDeformationFromWeightMaps.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131

3232
from opentps.core.processing.imageProcessing import resampler3D
3333
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
34-
from opentps.core.examples.syntheticData import createSynthetic4DCT
34+
import sys, os
35+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
36+
from syntheticData import createSynthetic4DCT
3537
from opentps.core.processing.deformableDataAugmentationToolBox.weightMaps import generateDeformationFromTrackers, generateDeformationFromTrackersAndWeightMaps
3638

3739
logger = logging.getLogger(__name__)

examples/dynamicData/run_exampleMidP.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
3434
from opentps.core.data.dynamicData._dynamic3DSequence import Dynamic3DSequence
3535
from opentps.core.data.images import CTImage
36-
from opentps.core.examples.syntheticData import *
36+
import sys, os
37+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
38+
from syntheticData import *
3739

3840
logger = logging.getLogger(__name__)
3941
#%%

examples/imageProcessing/cupyVSsitkTransforms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
from opentps.core.data.images import VectorField3D
3434
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
3535
from opentps.core.data._transform3D import Transform3D
36-
from opentps.core.examples.showStuff import showModelWithAnimatedFields
37-
from opentps.core.examples.syntheticData import *
36+
import sys, os
37+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
38+
from showStuff import showModelWithAnimatedFields
39+
from syntheticData import *
3840
from opentps.core.processing.imageProcessing.resampler3D import resampleImage3DOnImage3D
3941
from opentps.core.processing.imageProcessing.imageTransform3D import rotateData, translateData
4042
from opentps.core.processing.imageProcessing.resampler3D import resample

examples/imageProcessing/exampleTransform3DCupy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
from opentps.core.data.images import VectorField3D
3434
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
3535
from opentps.core.data._transform3D import Transform3D
36-
from opentps.core.examples.showStuff import showModelWithAnimatedFields
37-
from opentps.core.examples.syntheticData import *
36+
import sys, os
37+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
38+
from showStuff import showModelWithAnimatedFields
39+
from syntheticData import *
3840
from opentps.core.processing.imageProcessing.resampler3D import resampleImage3DOnImage3D
3941
from opentps.core.processing.imageProcessing.imageTransform3D import rotateData, translateData
4042
from opentps.core.processing.imageProcessing.resampler3D import resample

examples/imageProcessing/run_exampleApplyBaselineShift.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
from opentps.core.data.images import CTImage
3333
from opentps.core.data.images import ROIMask
3434
from opentps.core.processing.imageProcessing.syntheticDeformation import applyBaselineShift
35-
from opentps.core.examples.syntheticData import *
35+
import sys, os
36+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
37+
from syntheticData import *
3638

3739
logger = logging.getLogger(__name__)
3840

examples/imageProcessing/run_exampleTransform3D.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
from opentps.core.data.images import VectorField3D
3232
from opentps.core.data.dynamicData._dynamic3DModel import Dynamic3DModel
3333
from opentps.core.data._transform3D import Transform3D
34-
from opentps.core.examples.showStuff import showModelWithAnimatedFields
35-
from opentps.core.examples.syntheticData import *
34+
import sys, os
35+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
36+
from showStuff import showModelWithAnimatedFields
37+
from syntheticData import *
3638
from opentps.core.processing.imageProcessing.resampler3D import resampleImage3DOnImage3D
3739
from opentps.core.processing.imageProcessing.imageTransform3D import rotateData, translateData
3840
from opentps.core.processing.imageProcessing.resampler3D import resample

0 commit comments

Comments
 (0)