示例#1
0
    def calibration_FlatFoot(cls):

        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.4\\medial\\"
        staticFilename = "static.c3d"

        markerDiameter=14
        mp={
        'Bodymass'   : 69.0,
        'LeftLegLength' : 930.0,
        'RightLegLength' : 930.0 ,
        'LeftKneeWidth' : 94.0,
        'RightKneeWidth' : 64.0,
        'LeftAnkleWidth' : 67.0,
        'RightAnkleWidth' : 62.0,
        'LeftSoleDelta' : 0,
        'RightSoleDelta' : 0,
        "LeftToeOffset" : 0,
        "RightToeOffset" : 0,
        }


        # --- Calibration ---
        acqStatic = btkTools.smartReader(str(MAIN_PATH +  staticFilename))

        model=cgm2.CGM2_4LowerLimbs()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # ---- Calibration ----

        scp=modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp,acqStatic,model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(scp,acqStatic,model,
                           markerDiameter=markerDiameter,
                           leftFlatFoot = True, rightFlatFoot = True).compute()


        # display CS
        csp = modelFilters.ModelCoordinateSystemProcedure(model)
        csf = modelFilters.CoordinateSystemDisplayFilter(csp,model,acqStatic)
        csf.setStatic(True)
        csf.display()

        btkTools.smartWriter(acqStatic,"cgm2.4_FlatFoot.c3d")
示例#2
0
    def advancedCGM11_KneeMedKad(cls):
        """


        """
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM1\CGM1.1\medial\\"
        staticFilename = "static-all.c3d"

        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm.CGM1
        model.configure()
        markerDiameter = 14
        mp = {
            'Bodymass': 71.0,
            'LeftLegLength': 860.0,
            'RightLegLength': 865.0,
            'LeftKneeWidth': 102.0,
            'RightKneeWidth': 103.4,
            'LeftAnkleWidth': 75.3,
            'RightAnkleWidth': 72.9,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
        }

        optional_mp = {
            'InterAsisDistance': 0,
            'LeftAsisTrocanterDistance': 0,
            'LeftThighRotation': 0,
            'LeftShankRotation': 0,
            'LeftTibialTorsion': -10,
            'RightAsisTrocanterDistance': 0,
            'RightThighRotation': 0,
            'RightShankRotation': 0,
            'RightTibialTorsion': 15
        }

        model.addAnthropoInputParameters(mp, optional=optional_mp)

        # -----------CGM STATIC CALIBRATION--------------------
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.KneeCalibrationDecorator(model).midCondyles_KAD(
            acqStatic)
        #modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, side="both")

        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        btkTools.smartWriter(acqStatic, "advancedCGM11_KneeMedKad.c3d")
示例#3
0
    def full_IK(cls):

        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.3\\fullBody\\"
        staticFilename = "PN01OP01S01STAT.c3d"
        gaitFilename = "PN01OP01S01SS01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 83.0,
            'LeftLegLength': 874.0,
            'RightLegLength': 876.0,
            'LeftKneeWidth': 106.0,
            'RightKneeWidth': 103.0,
            'LeftAnkleWidth': 74.0,
            'RightAnkleWidth': 72.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
        }

        # --- Calibration ---
        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))
        translators = files.getTranslators(MAIN_PATH, "CGM2_3.translators")
        acqStatic = btkTools.applyTranslators(acqStatic, translators)

        model = cgm2.CGM2_3LowerLimbs()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # ---- Calibration ----

        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(
            scp, acqStatic, model, markerDiameter=markerDiameter).compute()

        # ------ Fitting -------
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))
        acqGait = btkTools.applyTranslators(acqGait, translators)

        # Motion FILTER
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, enums.motionMethod.Sodervisk)
        modMotion.compute()

        # ------- OPENSIM IK --------------------------------------
        # --- osim builder ---
        cgmCalibrationprocedure = opensimFilters.CgmOpensimCalibrationProcedures(
            model)
        markersetFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_3\\cgm2_3-markerset.xml"

        osimfile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\osim\\lowerLimb_ballsJoints.osim"

        oscf = opensimFilters.opensimCalibrationFilter(
            osimfile, model, cgmCalibrationprocedure, MAIN_PATH)
        oscf.addMarkerSet(markersetFile)
        scalingOsim = oscf.build(exportOsim=False)

        # --- fitting ---
        #procedure
        cgmFittingProcedure = opensimFilters.CgmOpensimFittingProcedure(model)

        iksetupFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_3\\cgm2_3-ikSetUp_template.xml"

        osrf = opensimFilters.opensimFittingFilter(iksetupFile, scalingOsim,
                                                   cgmFittingProcedure,
                                                   MAIN_PATH)

        acqIK = osrf.run(acqGait,
                         str(MAIN_PATH + gaitFilename),
                         exportSetUp=False)

        # -------- NEW MOTION FILTER ON IK MARKERS ------------------

        modMotion_ik = modelFilters.ModelMotionFilter(
            scp,
            acqIK,
            model,
            enums.motionMethod.Sodervisk,
            useForMotionTest=True)
        modMotion_ik.compute()

        finalJcs = modelFilters.ModelJCSFilter(model, acqIK)
        finalJcs.setFilterBool(False)
        finalJcs.compute(description="ik", pointLabelSuffix="2_ik")  #

        btkTools.smartWriter(acqIK, "cgm23_fullIK_Motion.c3d")
示例#4
0
    def CGM2_4_SARA_test(cls):
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.4\\Knee Calibration\\"
        staticFilename = "static.c3d"

        funcFilename = "functional.c3d"
        gaitFilename = "gait trial 01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 69.0,
            'LeftLegLength': 930.0,
            'RightLegLength': 930.0,
            'LeftKneeWidth': 94.0,
            'RightKneeWidth': 64.0,
            'LeftAnkleWidth': 67.0,
            'RightAnkleWidth': 62.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
            "LeftToeOffset": 0,
            "RightToeOffset": 0,
        }

        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm2.CGM2_4LowerLimbs()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # --- INITIAL  CALIBRATION ---
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic,
            markerDiameter=markerDiameter,
            side="both",
            cgm1Behaviour=True)
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            seLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="LKJC_mid",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="RKJC_mid",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter).compute()

        # ------ LEFT KNEE CALIBRATION -------
        acqFunc = btkTools.smartReader(str(MAIN_PATH + funcFilename))

        # Motion of only left
        modMotionLeftKnee = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, pyCGM2Enums.motionMethod.Sodervisk)
        modMotionLeftKnee.segmentalCompute(["Left Thigh", "Left Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).sara(
            "Left", indexFirstFrame=831, indexLastFrame=1280)

        # ----add Point into the c3d----
        Or_inThigh = model.getSegment("Left Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionOri")
        axis_inThigh = model.getSegment("Left Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionAxis")
        btkTools.smartAppendPoint(acqFunc, "Left" + "_KneeFlexionOri",
                                  Or_inThigh)
        btkTools.smartAppendPoint(acqFunc, "Left" + "_KneeFlexionAxis",
                                  axis_inThigh)

        # ------ RIGHT KNEE CALIBRATION -------

        # Motion of only left
        modMotionRightKnee = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, pyCGM2Enums.motionMethod.Sodervisk)
        modMotionRightKnee.segmentalCompute(["Right Thigh", "Right Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).sara("Right",
                                                            indexFirstFrame=61,
                                                            indexLastFrame=551)

        # ----add Point into the c3d----
        Or_inThigh = model.getSegment("Right Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionOri")
        axis_inThigh = model.getSegment("Right Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionAxis")
        btkTools.smartAppendPoint(acqFunc, "Right" + "_KneeFlexionOri",
                                  Or_inThigh)
        btkTools.smartAppendPoint(acqFunc, "Right" + "_KneeFlexionAxis",
                                  axis_inThigh)

        btkTools.smartWriter(acqFunc, "acqFunc-Sara.c3d")

        #--- FINAL  CALIBRATION ---
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            useLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="KJC_Sara",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="KJC_Sara",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter,
            RotateLeftThighFlag=True,
            RotateRightThighFlag=True).compute()

        #  save static c3d with update KJC
        btkTools.smartWriter(acqStatic, "Static-SARA.c3d")

        # ------ Fitting -------
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))

        # Motion FILTER

        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, pyCGM2Enums.motionMethod.Determinist)
        modMotion.compute()

        # relative angles
        modelFilters.ModelJCSFilter(model, acqGait).compute(
            description="vectoriel", pointLabelSuffix="cgm1_6dof")

        # absolute angles
        longitudinalAxis, forwardProgression, globalFrame = btkTools.findProgressionAxisFromPelvicMarkers(
            acqGait, ["LASI", "RASI", "RPSI", "LPSI"])
        modelFilters.ModelAbsoluteAnglesFilter(
            model,
            acqGait,
            segmentLabels=["Left HindFoot", "Right HindFoot", "Pelvis"],
            angleLabels=["LFootProgress", "RFootProgress", "Pelvis"],
            eulerSequences=["TOR", "TOR", "ROT"],
            globalFrameOrientation=globalFrame,
            forwardProgression=forwardProgression).compute(
                pointLabelSuffix="cgm1_6dof")

        # ------- OPENSIM IK --------------------------------------

        # --- osim builder ---
        cgmCalibrationprocedure = opensimFilters.CgmOpensimCalibrationProcedures(
            model)
        markersetFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_4\\cgm2_4-markerset.xml"

        osimfile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\osim\\lowerLimb_ballsJoints.osim"

        oscf = opensimFilters.opensimCalibrationFilter(
            osimfile, model, cgmCalibrationprocedure)
        oscf.addMarkerSet(markersetFile)
        scalingOsim = oscf.build(exportOsim=False)

        # --- fitting ---
        #procedure
        cgmFittingProcedure = opensimFilters.CgmOpensimFittingProcedure(model)
        iksetupFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_4\\cgm2_4-ikSetUp_template.xml"

        osrf = opensimFilters.opensimFittingFilter(iksetupFile, scalingOsim,
                                                   cgmFittingProcedure,
                                                   MAIN_PATH)
        acqIK = osrf.run(acqGait,
                         str(MAIN_PATH + gaitFilename),
                         exportSetUp=False)

        # -------- NEW MOTION FILTER ON IK MARKERS ------------------

        modMotion_ik = modelFilters.ModelMotionFilter(
            scp,
            acqIK,
            model,
            pyCGM2Enums.motionMethod.Sodervisk,
            useForMotionTest=True)
        modMotion_ik.compute()

        finalJcs = modelFilters.ModelJCSFilter(model, acqIK)
        finalJcs.setFilterBool(False)
        finalJcs.compute(description="ik", pointLabelSuffix="2_ik")  #

        btkTools.smartWriter(acqIK, "gait trial 01 - Fitting.c3d")
示例#5
0
    def cgm24(cls):
        """

        """
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "operations\\markerDecomposition\\CGM24decomposeTracking\\"
        #

        staticFilename = "PN01OP01S01STAT.c3d"

        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm2.CGM2_4LowerLimbs()
        model.setVersion("CGM2.4e")
        model.configure()

        markerDiameter = 14
        mp = {
            'Bodymass': 83.0,
            'LeftLegLength': 874.0,
            'RightLegLength': 876.0,
            'LeftKneeWidth': 106.0,
            'RightKneeWidth': 103.0,
            'LeftAnkleWidth': 74.0,
            'RightAnkleWidth': 72.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
        }
        model.addAnthropoInputParameters(mp)

        # CALIBRATION
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            leftFlatFoot=1,
            rightFlatFoot=1,
            markerDiameter=markerDiameter,
        ).compute()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="left")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="left")
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="right")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="right")

        modelDecorator.HipJointCenterDecorator(model).hara(side="Both")

        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            leftFlatFoot=1,
            rightFlatFoot=1,
            markerDiameter=markerDiameter,
        ).compute()

        # --- Test 1 Motion Axe X -------
        gaitFilename = "PN01OP01S01SS01.c3d"
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))

        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, pyCGM2Enums.motionMethod.Sodervisk)
        modMotion.compute()

        mtf = modelFilters.TrackingMarkerDecompositionFilter(model, acqGait)
        mtf.decompose()

        btkTools.smartWriter(acqGait, "cgm24-decompose.c3d")
示例#6
0
    def kinematicFitting_oneFile_cgmProcedure(cls):

        DATA_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\LowerLimb\\subject10_S1A1_julieDataSet_noModelOutputs\\"

        config = dict()
        config["static"] = "StaticR010S1A1.c3d"
        config["dynamicTrial"] = [
            "R010S1A1Gait001.c3d", "R010S1A1Gait003.c3d",
            "R010S1A1Gait004.c3d", "R010S1A1Gait005.c3d",
            "R010S1A1Gait007.c3d", "R010S1A1Gait010.c3d"
        ]

        configMP = {
            "Bodymass": 64.0,
            "LeftLegLength": 865.0,
            "RightLegLength": 855.0,
            "LeftKneeWidth": 100.0,
            "RightKneeWidth": 101.0,
            "LeftAnkleWidth": 69.0,
            "RightAnkleWidth": 69.0
        }

        requiredMarkers = [
            "LASI", "RASI", "LPSI", "RPSI", "RTHIAP", "RTHIAD", "RTHI", "RKNE",
            "RSHN", "RTIAP", "RTIB", "RANK", "RHEE", "RTOE", "RCUN", "RD1M",
            "RD5M"
        ]

        acqStatic = btkTools.smartReader(DATA_PATH + config["static"])

        # model
        model = cgm2Julie.CGM2ModelInf()
        model.configure()
        markerDiameter = 14

        mp = {
            'Bodymass': configMP["Bodymass"],
            'LeftLegLength': configMP["LeftLegLength"],
            'RightLegLength': configMP["RightLegLength"],
            'LeftKneeWidth': configMP["LeftKneeWidth"],
            'RightKneeWidth': configMP["RightKneeWidth"],
            'LeftAnkleWidth': configMP["LeftAnkleWidth"],
            'RightAnkleWidth': configMP["RightAnkleWidth"],
        }

        #offset 2ndToe Joint
        toe = acqStatic.GetPoint("RTOE").GetValues()[:, :].mean(axis=0)
        mp["rightToeOffset"] = (toe[2] - markerDiameter / 2.0) / 2.0

        model.addAnthropoInputParameters(mp)

        # -----------CGM STATIC CALIBRATION--------------------

        #  --- Initial calibration
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(
            scp, acqStatic, model,
            rightFlatHindFoot=True).compute()  # Initial calibration

        # --- decorator
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, leftMedialKneeLabel="LKNM", rightMedialKneeLabel="RKNM")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic,
            leftMedialAnkleLabel="LMMA",
            rightMedialAnkleLabel="RMMA")

        # --- Updated calibration
        modelFilters.ModelCalibrationFilter(scp,
                                            acqStatic,
                                            model,
                                            useLeftKJCnode="LKJC_mid",
                                            useRightKJCnode="RKJC_mid",
                                            useLeftAJCnode="LAJC_mid",
                                            useRightAJCnode="RAJC_mid",
                                            rightFlatHindFoot=True).compute()

        # ---- optional -update static c3d
        #btkTools.smartWriter(acqStatic, "StaticCalibrated.c3d")

        # -----------CGM MOTION  6dof--------------------

        # --- reader and checking
        acqGait = btkTools.smartReader(DATA_PATH + config["dynamicTrial"][0])
        btkTools.checkMarkers(acqGait, requiredMarkers)
        btkTools.isGap(acqGait, requiredMarkers)
        btkTools.checkFirstAndLastFrame(acqGait, "LASI")
        logging.info("dyn Acquisition ---> OK ")

        # --- filters
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, pyCGM2Enums.motionMethod.Determinist)
        modMotion.compute()

        modelFilters.ModelJCSFilter(model,
                                    acqGait).compute(description="vectoriel",
                                                     pointLabelSuffix="2_6dof")

        # --- writer
        #btkTools.smartWriter(acqGait, "motionCalibrated.c3d")

        # ------- OPENSIM IK --------------------------------------
        cgmprocedure = opensimFilters.CgmOpensimCalibrationProcedures(model)
        markersetFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\draft-opensimPreProcessing\\cgm2-markerset.xml"

        osimfile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\draft-opensimPreProcessing\\cgm2-model.osim"

        oscf = opensimFilters.opensimCalibrationFilter(osimfile, model,
                                                       cgmprocedure)
        oscf.addMarkerSet(markersetFile)
        fittingOsim = oscf.build()

        filename = config["dynamicTrial"][0]
        cgmFittingProcedure = opensimFilters.CgmOpensimFittingProcedure(model)

        cgmFittingProcedure.updateMarkerWeight("LASI", 100)

        iksetupFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\draft-opensimPreProcessing\\ikSetUp_template.xml"

        osrf = opensimFilters.opensimFittingFilter(iksetupFile, fittingOsim,
                                                   cgmFittingProcedure,
                                                   DATA_PATH)
        acqIK = osrf.run(acqGait, str(DATA_PATH + filename))

        # -------- NEW MOTION FILTER ON IK MARKERS ------------------

        modMotion_ik = modelFilters.ModelMotionFilter(
            scp, acqIK, model, pyCGM2Enums.motionMethod.Sodervisk)
        modMotion_ik.compute()

        finalJcs = modelFilters.ModelJCSFilter(model, acqIK)
        finalJcs.setFilterBool(False)
        finalJcs.compute(description="ik", pointLabelSuffix="2_ik")  #

        # recup du mot file
        motFilename = str(DATA_PATH + config["dynamicTrial"][0][:-4] + ".mot")

        comparisonOpensimVsCGM(motFilename, acqIK, "2_ik")
示例#7
0
    def CGM2_4_SARA_test(cls):
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.4\\Knee Calibration\\"
        staticFilename = "static.c3d"

        funcFilename = "functional.c3d"
        gaitFilename = "gait trial 01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 69.0,
            'LeftLegLength': 930.0,
            'RightLegLength': 930.0,
            'LeftKneeWidth': 94.0,
            'RightKneeWidth': 64.0,
            'LeftAnkleWidth': 67.0,
            'RightAnkleWidth': 62.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
            "LeftToeOffset": 0,
            "RightToeOffset": 0,
        }

        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm2.CGM2_4()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # --- INITIAL  CALIBRATION ---
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            seLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="LKJC_mid",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="RKJC_mid",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter).compute()

        # ------ LEFT KNEE CALIBRATION -------
        acqFunc = btkTools.smartReader(str(MAIN_PATH + funcFilename))

        # Motion of only left
        modMotionLeftKnee = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Sodervisk)
        modMotionLeftKnee.segmentalCompute(["Left Thigh", "Left Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).sara(
            "Left", indexFirstFrame=831, indexLastFrame=1280)

        # ----add Point into the c3d----
        Or_inThigh = model.getSegment("Left Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionOri")
        axis_inThigh = model.getSegment("Left Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionAxis")
        btkTools.smartAppendPoint(acqFunc, "Left" + "_KneeFlexionOri",
                                  Or_inThigh)
        btkTools.smartAppendPoint(acqFunc, "Left" + "_KneeFlexionAxis",
                                  axis_inThigh)

        # ------ RIGHT KNEE CALIBRATION -------

        # Motion of only left
        modMotionRightKnee = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Sodervisk)
        modMotionRightKnee.segmentalCompute(["Right Thigh", "Right Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).sara("Right",
                                                            indexFirstFrame=61,
                                                            indexLastFrame=551)

        # ----add Point into the c3d----
        Or_inThigh = model.getSegment("Right Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionOri")
        axis_inThigh = model.getSegment("Right Thigh").getReferential(
            "TF").getNodeTrajectory("KneeFlexionAxis")
        btkTools.smartAppendPoint(acqFunc, "Right" + "_KneeFlexionOri",
                                  Or_inThigh)
        btkTools.smartAppendPoint(acqFunc, "Right" + "_KneeFlexionAxis",
                                  axis_inThigh)

        btkTools.smartWriter(acqFunc, "acqFunc-Sara.c3d")

        #--- FINAL  CALIBRATION ---
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            useLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="KJC_Sara",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="KJC_Sara",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter).compute()

        #  save static c3d with update KJC
        btkTools.smartWriter(acqStatic, "Static-SARA.c3d")

        # print functional Offsets
        print model.mp_computed["LeftKneeFuncCalibrationOffset"]
        print model.mp_computed["RightKneeFuncCalibrationOffset"]
示例#8
0
def sara(model, DATA_PATH, reconstructFilenameLabelled, translators, side,
         beginFrame, endFrame, **kwargs):

    # --- btk acquisition ----
    if "forceBtkAcq" in kwargs.keys():
        acqFunc = kwargs["forceBtkAcq"]
    else:
        acqFunc = btkTools.smartReader(
            str(DATA_PATH + reconstructFilenameLabelled))

    btkTools.checkMultipleSubject(acqFunc)
    acqFunc = btkTools.applyTranslators(acqFunc, translators)

    #---get frame range of interest---
    ff = acqFunc.GetFirstFrame()
    lf = acqFunc.GetLastFrame()

    start, end = btkTools.getStartEndEvents(acqFunc, side)

    if start is not None:
        logging.info("Start event detected")
        initFrame = start
    else:
        initFrame = beginFrame if beginFrame is not None else ff

    if end is not None:
        logging.info("End event detected")
        endFrame = end
    else:
        endFrame = endFrame if endFrame is not None else lf

    iff = initFrame - ff
    ilf = endFrame - ff

    #---motion side of the lower limb---
    if side is None:
        side = detectSide(acqFunc, "LANK", "RANK")
        logging.info("Detected motion side : %s" % (side))

    # --------------------------RESET OF THE STATIC File---------

    # load btkAcq from static file
    staticFilename = model.m_staticFilename
    acqStatic = btkTools.smartReader(str(DATA_PATH + staticFilename))
    btkTools.checkMultipleSubject(acqStatic)
    acqStatic = btkTools.applyTranslators(acqStatic, translators)

    # initial calibration ( i.e calibration from Calibration operation)
    leftFlatFoot = model.m_properties["CalibrationParameters"]["leftFlatFoot"]
    rightFlatFoot = model.m_properties["CalibrationParameters"][
        "rightFlatFoot"]
    markerDiameter = model.m_properties["CalibrationParameters"][
        "markerDiameter"]
    headFlat = model.m_properties["CalibrationParameters"]["headFlat"]

    if side == "Left":
        model.mp_computed["LeftKneeFuncCalibrationOffset"] = 0
    if side == "Right":
        model.mp_computed["RightKneeFuncCalibrationOffset"] = 0

    # initial calibration ( zero previous KneeFunc offset on considered side )
    scp = modelFilters.StaticCalibrationProcedure(model)
    modelFilters.ModelCalibrationFilter(
        scp,
        acqStatic,
        model,
        leftFlatFoot=leftFlatFoot,
        rightFlatFoot=rightFlatFoot,
        headFlat=headFlat,
        markerDiameter=markerDiameter).compute()

    if model.version in ["CGM2.3", "CGM2.4", "CGM2.5"]:
        if side == "Left":
            thigh_markers = model.getSegment("Left Thigh").m_tracking_markers
            shank_markers = model.getSegment("Left Shank").m_tracking_markers

        elif side == "Right":
            thigh_markers = model.getSegment("Right Thigh").m_tracking_markers
            shank_markers = model.getSegment("Right Shank").m_tracking_markers

        validFrames, vff, vlf = btkTools.findValidFrames(
            acqFunc, thigh_markers + shank_markers)

        proximalSegmentLabel = str(side + " Thigh")
        distalSegmentLabel = str(side + " Shank")

        # segment Motion
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Sodervisk)
        modMotion.segmentalCompute([proximalSegmentLabel, distalSegmentLabel])

        # decorator

        modelDecorator.KneeCalibrationDecorator(model).sara(
            side, indexFirstFrame=iff, indexLastFrame=ilf)

        # --------------------------FINAL CALIBRATION OF THE STATIC File---------

        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            leftFlatFoot=leftFlatFoot,
            rightFlatFoot=rightFlatFoot,
            headFlat=headFlat,
            markerDiameter=markerDiameter).compute()

    return model, acqFunc, side
示例#9
0
def calibration2Dof(model, DATA_PATH, reconstructFilenameLabelled, translators,
                    side, beginFrame, endFrame, jointRange):

    acqFunc = btkTools.smartReader(str(DATA_PATH +
                                       reconstructFilenameLabelled))

    btkTools.checkMultipleSubject(acqFunc)
    acqFunc = btkTools.applyTranslators(acqFunc, translators)

    #---get frame range of interest---
    ff = acqFunc.GetFirstFrame()
    lf = acqFunc.GetLastFrame()

    initFrame = beginFrame if beginFrame is not None else ff
    endFrame = endFrame if endFrame is not None else lf

    iff = initFrame - ff
    ilf = endFrame - ff

    # motion
    if side is None:
        side = detectSide(acqFunc, "LANK", "RANK")
        logging.info("Detected motion side : %s" % (side))

    if model.version in ["CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e"]:
        validFrames, vff, vlf = btkTools.findValidFrames(
            acqFunc, cgm.CGM1LowerLimbs.TRACKING_MARKERS)

    # --------------------------RESET OF THE STATIC File---------
    # load btkAcq from static file
    staticFilename = model.m_staticFilename
    acqStatic = btkTools.smartReader(str(DATA_PATH + staticFilename))
    btkTools.checkMultipleSubject(acqStatic)
    acqStatic = btkTools.applyTranslators(acqStatic, translators)

    # initial calibration ( i.e calibration from Calibration operation)
    leftFlatFoot = model.m_properties["CalibrationParameters"]["leftFlatFoot"]
    rightFlatFoot = model.m_properties["CalibrationParameters"][
        "rightFlatFoot"]
    markerDiameter = model.m_properties["CalibrationParameters"][
        "markerDiameter"]

    if side == "Left":
        # remove other functional calibration
        model.mp_computed["LeftKneeFuncCalibrationOffset"] = 0

    if side == "Right":
        # remove other functional calibration
        model.mp_computed["RightKneeFuncCalibrationOffset"] = 0

    # no rotation on both thigh - re init anatonical frame
    scp = modelFilters.StaticCalibrationProcedure(model)
    modelFilters.ModelCalibrationFilter(
        scp,
        acqStatic,
        model,
        leftFlatFoot=leftFlatFoot,
        rightFlatFoot=rightFlatFoot,
        markerDiameter=markerDiameter).compute()

    if model.version in ["CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e"]:

        modMotion = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Determinist)
        modMotion.compute()

    elif model.version in ["CGM2.3", "CGM2.3e", "CGM2.4", "CGM2.4e"]:
        if side == "Left":
            thigh_markers = model.getSegment("Left Thigh").m_tracking_markers
            shank_markers = model.getSegment("Left Shank").m_tracking_markers

        elif side == "Right":
            thigh_markers = model.getSegment("Right Thigh").m_tracking_markers
            shank_markers = model.getSegment("Right Shank").m_tracking_markers

        validFrames, vff, vlf = btkTools.findValidFrames(
            acqFunc, thigh_markers + shank_markers)

        proximalSegmentLabel = str(side + " Thigh")
        distalSegmentLabel = str(side + " Shank")

        # Motion
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Sodervisk)
        modMotion.segmentalCompute([proximalSegmentLabel, distalSegmentLabel])

    # calibration decorators
    modelDecorator.KneeCalibrationDecorator(model).calibrate2dof(
        side, indexFirstFrame=iff, indexLastFrame=ilf, jointRange=jointRange)

    # --------------------------FINAL CALIBRATION OF THE STATIC File---------

    # ----  Calibration
    modelFilters.ModelCalibrationFilter(
        scp,
        acqStatic,
        model,
        leftFlatFoot=leftFlatFoot,
        rightFlatFoot=rightFlatFoot,
        markerDiameter=markerDiameter).compute()

    return model, acqFunc, side
示例#10
0
    # --- Calibration ---
    acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

    model = cgm2.CGM2_2LowerLimbs()
    model.configure()

    model.addAnthropoInputParameters(mp)

    # ------ calibration -------
    scp = modelFilters.StaticCalibrationProcedure(model)
    modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

    # cgm decorator
    modelDecorator.HipJointCenterDecorator(model).hara()
    modelDecorator.KneeCalibrationDecorator(model).midCondyles(
        acqStatic, markerDiameter=markerDiameter, side="both")
    modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
        acqStatic, markerDiameter=markerDiameter, side="both")

    # final
    modelFilters.ModelCalibrationFilter(
        scp, acqStatic, model, markerDiameter=markerDiameter).compute()

    # ------ Fitting -------
    acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))

    # Motion FILTER
    modMotion = modelFilters.ModelMotionFilter(
        scp, acqGait, model, pyCGM2Enums.motionMethod.Determinist)
    modMotion.compute()
示例#11
0
    def test_lowLevel(self):
        DATA_PATH = pyCGM2.TEST_DATA_PATH + "GaitModels\CGM2.3\\Hannibal-medial\\"

        staticFilename = "static.c3d"
        gaitFilename= "gait1.c3d"

        markerDiameter=14
        required_mp={
        'Bodymass'   : 71.0,
        'LeftLegLength' : 860.0,
        'RightLegLength' : 865.0 ,
        'LeftKneeWidth' : 102.0,
        'RightKneeWidth' : 103.4,
        'LeftAnkleWidth' : 75.3,
        'RightAnkleWidth' : 72.9,
        'LeftSoleDelta' : 0,
        'RightSoleDelta' : 0,
        'LeftShoulderOffset' : 0,
        'RightShoulderOffset' : 0,
        'LeftElbowWidth' : 0,
        'LeftWristWidth' : 0,
        'LeftHandThickness' : 0,
        'RightElbowWidth' : 0,
        'RightWristWidth' : 0,
        'RightHandThickness' : 0
        }
        optional_mp = {
            'LeftTibialTorsion' : 0,
            'LeftThighRotation' : 0,
            'LeftShankRotation' : 0,
            'RightTibialTorsion' : 0,
            'RightThighRotation' : 0,
            'RightShankRotation' : 0
            }

        # --- Calibration ---
        # ---check marker set used----
        acqStatic = btkTools.smartReader(DATA_PATH +  staticFilename)

        dcm = cgm.CGM.detectCalibrationMethods(acqStatic)
        model=cgm2.CGM2_3()
        model.configure(detectedCalibrationMethods=dcm)
        model.addAnthropoInputParameters(required_mp,optional=optional_mp)

        # ---- Calibration ----

        scp=modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp,acqStatic,model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(scp,acqStatic,model,
                           markerDiameter=markerDiameter).compute()


        # ------ Fitting -------
        acqGait = btkTools.smartReader(DATA_PATH +  gaitFilename)


        # Motion FILTER
        modMotion=modelFilters.ModelMotionFilter(scp,acqGait,model,enums.motionMethod.Sodervisk)
        modMotion.compute()



        # ------- OPENSIM IK --------------------------------------
        # --- osim builder ---
        cgmCalibrationprocedure = opensimFilters.CgmOpensimCalibrationProcedures(model)
        markersetFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_3\\cgm2_3-markerset.xml"

        osimfile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\osim\\lowerLimb_ballsJoints.osim"


        oscf = opensimFilters.opensimCalibrationFilter(osimfile,
                                                model,
                                                cgmCalibrationprocedure,
                                                DATA_PATH)
        oscf.addMarkerSet(markersetFile)
        scalingOsim = oscf.build(exportOsim=False)


        # --- fitting ---
        #procedure
        cgmFittingProcedure = opensimFilters.CgmOpensimFittingProcedure(model)

        iksetupFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_3\\cgm2_3-ikSetUp_template.xml"

        osrf = opensimFilters.opensimFittingFilter(iksetupFile,
                                                          scalingOsim,
                                                          cgmFittingProcedure,
                                                          DATA_PATH,
                                                          acqGait )


        acqIK = osrf.run(str(DATA_PATH + gaitFilename ),exportSetUp=False)

        # -------- NEW MOTION FILTER ON IK MARKERS ------------------

        modMotion_ik=modelFilters.ModelMotionFilter(scp,acqIK,model,enums.motionMethod.Sodervisk,
                                                    useForMotionTest=True)
        modMotion_ik.compute()

        finalJcs =modelFilters.ModelJCSFilter(model,acqIK)
        finalJcs.compute(description="ik", pointLabelSuffix = "2_ik")#

        btkTools.smartWriter(acqIK,"cgm23_fullIK_Motion.c3d")
示例#12
0
    def calibrate(self, aquiStatic, dictRef, dictAnatomic, options=None):

        # add markers
        valSACR = (aquiStatic.GetPoint("LPSI").GetValues() +
                   aquiStatic.GetPoint("RPSI").GetValues()) / 2.0
        btkTools.smartAppendPoint(aquiStatic, "SACR", valSACR, desc="")
        valMidAsis = (aquiStatic.GetPoint("LASI").GetValues() +
                      aquiStatic.GetPoint("RASI").GetValues()) / 2.0
        btkTools.smartAppendPoint(aquiStatic, "midASIS", valMidAsis, desc="")
        valLMET = (aquiStatic.GetPoint("LFMH").GetValues() +
                   aquiStatic.GetPoint("LVMH").GetValues()) / 2.0
        btkTools.smartAppendPoint(aquiStatic, "LMET", valLMET, desc="")
        valRMET = (aquiStatic.GetPoint("RFMH").GetValues() +
                   aquiStatic.GetPoint("RVMH").GetValues()) / 2.0
        btkTools.smartAppendPoint(aquiStatic, "RMET", valRMET, desc="")

        ff = aquiStatic.GetFirstFrame()
        lf = aquiStatic.GetLastFrame()
        frameInit = ff - ff
        frameEnd = lf - ff + 1

        # calibrate technical
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Pelvis",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Left Thigh",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Right Thigh",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Left Shank",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Right Shank",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Left Foot",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)
        self._calibrateTechnicalSegment(aquiStatic,
                                        "Right Foot",
                                        dictRef,
                                        frameInit,
                                        frameEnd,
                                        options=options)

        # # ---- decorator ----
        modelDecorator.HipJointCenterDecorator(self).greatTrochanterOffset(
            aquiStatic)
        modelDecorator.KneeCalibrationDecorator(self).midCondyles(aquiStatic)
        modelDecorator.AnkleCalibrationDecorator(self).midMaleolus(aquiStatic)

        # calibrate anatomic
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Pelvis",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Left Thigh",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Right Thigh",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Left Shank",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Right Shank",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Left Foot",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
        self._calibrateAnatomicalSegment(aquiStatic,
                                         "Right Foot",
                                         dictAnatomic,
                                         frameInit,
                                         frameEnd,
                                         options=options)
示例#13
0
# -*- coding: utf-8 -*-
import logging
from argparse import Namespace
import os
from tkFileDialog import askopenfilenames, askopenfilename
from extraction_enf import extraction_enf as extraction_enf
from extract_metaData_pycgm2 import extract_metaData_pycgm2 as extract_metaData_pycgm2
from extraction_name_enf import extraction_name_enf as extraction_name_enf
# pyCGM2 libraries
import pyCGM2
# from pyCGM2 import enums
from pyCGM2.Model.CGM2.coreApps import cgm2_1, cgmUtils
from pyCGM2.Model import modelDecorator
from pyCGM2.Tools import btkTools
from pyCGM2.Utils import files
# from pyCGM2.Eclipse import vskTools

from shutil import copy2

# test decorator
cgm2_1_DynaKad = modelDecorator.KneeCalibrationDecorator(cgm2_1).calibrate2dof('Left')

cgm2_1_DynaKad.calibrate2dof('Left')
cgm2_1_DynaKad.calibrate2dof('Right')
示例#14
0
    def CGM23_2DOF_test(cls):
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.3\\Knee Calibration\\"
        staticFilename = "Static.c3d"

        leftKneeFilename = "Left Knee.c3d"
        rightKneeFilename = "Right Knee.c3d"
        gaitFilename = "gait trial 01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 71.0,
            'LeftLegLength': 860.0,
            'RightLegLength': 865.0,
            'LeftKneeWidth': 102.0,
            'RightKneeWidth': 103.4,
            'LeftAnkleWidth': 75.3,
            'RightAnkleWidth': 72.9,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
        }

        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm2.CGM2_3()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # --- INITIAL  CALIBRATION ---
        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            seLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="LKJC_mid",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="RKJC_mid",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter).compute()

        # ------ LEFT KNEE CALIBRATION -------
        acqLeftKnee = btkTools.smartReader(str(MAIN_PATH + leftKneeFilename))

        # Motion of only left
        modMotionLeftKnee = modelFilters.ModelMotionFilter(
            scp, acqLeftKnee, model, enums.motionMethod.Sodervisk)
        modMotionLeftKnee.segmentalCompute(["Left Thigh", "Left Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).calibrate2dof(
            "Left", indexFirstFrame=489, indexLastFrame=1451)

        # ----add Point into the c3d----
        btkTools.smartWriter(acqLeftKnee, "Left Knee-2dof.c3d")

        # ------ RIGHT KNEE CALIBRATION -------
        acqRightKnee = btkTools.smartReader(str(MAIN_PATH + rightKneeFilename))

        # Motion of only left
        modMotionRightKnee = modelFilters.ModelMotionFilter(
            scp, acqRightKnee, model, enums.motionMethod.Sodervisk)
        modMotionRightKnee.segmentalCompute(["Right Thigh", "Right Shank"])

        # decorator
        modelDecorator.KneeCalibrationDecorator(model).calibrate2dof(
            "Right", indexFirstFrame=25, indexLastFrame=1060)

        # ----add Point into the c3d----
        btkTools.smartWriter(acqRightKnee, "Right Knee-2dof.c3d")

        #--- FINAL  CALIBRATION ---
        modelFilters.ModelCalibrationFilter(
            scp,
            acqStatic,
            model,
            useLeftHJCnode="LHJC_Hara",
            useRightHJCnode="RHJC_Hara",
            useLeftKJCnode="KJC_Sara",
            useLeftAJCnode="LAJC_mid",
            useRightKJCnode="KJC_Sara",
            useRightAJCnode="RAJC_mid",
            markerDiameter=markerDiameter).compute()

        #  save static c3d with update KJC
        btkTools.smartWriter(acqStatic, "Static-2DOF.c3d")
示例#15
0
    def noIK_6dof(cls):
        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.3\\fullBody\\"
        staticFilename = "PN01OP01S01STAT.c3d"
        gaitFilename = "PN01OP01S01SS01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 83.0,
            'LeftLegLength': 874.0,
            'RightLegLength': 876.0,
            'LeftKneeWidth': 106.0,
            'RightKneeWidth': 103.0,
            'LeftAnkleWidth': 74.0,
            'RightAnkleWidth': 72.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
        }

        # --- Calibration ---
        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        translators = files.getTranslators(MAIN_PATH, "CGM2_3.translators")
        acqStatic = btkTools.applyTranslators(acqStatic, translators)

        model = cgm2.CGM2_3LowerLimbs()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # ---- Calibration ----

        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        print "----"
        print model.getSegment("Left Shank").getReferential(
            "TF").relativeMatrixAnatomic
        print "----"

        # # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")
        #
        # # final
        modelFilters.ModelCalibrationFilter(
            scp, acqStatic, model, markerDiameter=markerDiameter).compute()

        #import ipdb; ipdb.set_trace()
        # ------ Fitting -------
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))
        acqGait = btkTools.applyTranslators(acqGait, translators)

        # Motion FILTER
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, enums.motionMethod.Sodervisk)
        modMotion.compute()

        csp = modelFilters.ModelCoordinateSystemProcedure(model)
        modelFilters.CoordinateSystemDisplayFilter(csp, model,
                                                   acqGait).display()

        btkTools.smartWriter(acqGait, "cgm23_noIK6dof_Motion.c3d")
示例#16
0
                      "TF",
                      sequence="ZXY",
                      pointLabel1="RSMH",
                      pointLabel2="RHEE",
                      pointLabel3="RVMH",
                      pointLabelOrigin="RHEE")

    #---Initial Calibration Filter---
    smf0 = modelFilters.ModelCalibrationFilter(gcp, acqStatic, bioMechModel)
    smf0.setBoolOption("technicalReferentialOnly")
    smf0.compute()

    # ---- decorator ----
    modelDecorator.HipJointCenterDecorator(bioMechModel).greatTrochanterOffset(
        acqStatic)
    modelDecorator.KneeCalibrationDecorator(bioMechModel).midCondyles(
        acqStatic)
    modelDecorator.AnkleCalibrationDecorator(bioMechModel).midMaleolus(
        acqStatic)

    gcp.setAnatomicalDefinition("Pelvis",
                                sequence="YZX",
                                nodeLabel1="RASI",
                                nodeLabel2="LASI",
                                nodeLabel3="SACR",
                                nodeLabelOrigin="midASIS")
    gcp.setAnatomicalDefinition("Left Thigh",
                                sequence="ZXiY",
                                nodeLabel1="LKJC_mid",
                                nodeLabel2="LHJC_gt",
                                nodeLabel3="LKNE",
                                nodeLabelOrigin="LHJC_gt")
示例#17
0
    scp = modelFilters.StaticCalibrationProcedure(model)
    modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

    # motion
    gaitFilename = "MRI-US-01, 2008-08-08, 3DGA 14.c3d"
    acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))

    modMotion = modelFilters.ModelMotionFilter(scp,
                                               acqGait,
                                               model,
                                               enums.motionMethod.Determinist,
                                               usePyCGM2_coordinateSystem=True)
    modMotion.compute()

    # calibration decorators
    modelDecorator.KneeCalibrationDecorator(model).calibrate2dof("Left")
    modelDecorator.KneeCalibrationDecorator(model).calibrate2dof("Right")

    # final calibration
    modelFilters.ModelCalibrationFilter(scp,
                                        acqStatic,
                                        model,
                                        RotateLeftThigh=True,
                                        RotateRightThigh=True).compute()

    #----MOTION----
    # motion with dynakadOffset
    modMotion = modelFilters.ModelMotionFilter(scp,
                                               acqGait,
                                               model,
                                               enums.motionMethod.Determinist,
示例#18
0
    def full_IK(cls):

        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "CGM2\\cgm2.4\\medial\\"
        staticFilename = "static.c3d"
        gaitFilename = "gait Trial 01.c3d"

        markerDiameter = 14
        mp = {
            'Bodymass': 69.0,
            'LeftLegLength': 930.0,
            'RightLegLength': 930.0,
            'LeftKneeWidth': 94.0,
            'RightKneeWidth': 64.0,
            'LeftAnkleWidth': 67.0,
            'RightAnkleWidth': 62.0,
            'LeftSoleDelta': 0,
            'RightSoleDelta': 0,
            "LeftToeOffset": 0,
            "RightToeOffset": 0,
        }

        # --- Calibration ---
        acqStatic = btkTools.smartReader(str(MAIN_PATH + staticFilename))

        model = cgm2.CGM2_4LowerLimbs()
        model.configure()

        model.addAnthropoInputParameters(mp)

        # ---- Calibration ----

        scp = modelFilters.StaticCalibrationProcedure(model)
        modelFilters.ModelCalibrationFilter(scp, acqStatic, model).compute()

        # cgm decorator
        modelDecorator.HipJointCenterDecorator(model).hara()
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(
            acqStatic, markerDiameter=markerDiameter, side="both")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
            acqStatic, markerDiameter=markerDiameter, side="both")

        # final
        modelFilters.ModelCalibrationFilter(
            scp, acqStatic, model, markerDiameter=markerDiameter).compute()

        # ------ Fitting -------
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))

        # Motion FILTER
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqGait, model, pyCGM2Enums.motionMethod.Sodervisk)
        modMotion.compute()

        # relative angles
        modelFilters.ModelJCSFilter(model, acqGait).compute(
            description="vectoriel", pointLabelSuffix="cgm1_6dof")

        # absolute angles
        longitudinalAxis, forwardProgression, globalFrame = btkTools.findProgressionAxisFromPelvicMarkers(
            acqGait, ["LASI", "RASI", "RPSI", "LPSI"])
        modelFilters.ModelAbsoluteAnglesFilter(
            model,
            acqGait,
            segmentLabels=["Left Foot", "Right Foot", "Pelvis"],
            angleLabels=["LFootProgress", "RFootProgress", "Pelvis"],
            eulerSequences=["TOR", "TOR", "ROT"],
            globalFrameOrientation=globalFrame,
            forwardProgression=forwardProgression).compute(
                pointLabelSuffix="cgm1_6dof")

        # ---Marker decomp filter----
        mtf = modelFilters.TrackingMarkerDecompositionFilter(model, acqGait)
        mtf.decompose()
        # ------- OPENSIM IK --------------------------------------

        # --- osim builder ---
        cgmCalibrationprocedure = opensimFilters.CgmOpensimCalibrationProcedures(
            model)
        markersetFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_4\\cgm2_4-markerset - expert.xml"

        osimfile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\osim\\lowerLimb_ballsJoints.osim"

        oscf = opensimFilters.opensimCalibrationFilter(
            osimfile, model, cgmCalibrationprocedure, MAIN_PATH)
        oscf.addMarkerSet(markersetFile)
        scalingOsim = oscf.build(exportOsim=False)

        # --- fitting ---
        #procedure
        cgmFittingProcedure = opensimFilters.CgmOpensimFittingProcedure(
            model, expertMode=True)

        iksetupFile = pyCGM2.OPENSIM_PREBUILD_MODEL_PATH + "models\\settings\\cgm2_4\\cgm2_4-expert-ikSetUp_template.xml"

        osrf = opensimFilters.opensimFittingFilter(iksetupFile, scalingOsim,
                                                   cgmFittingProcedure,
                                                   MAIN_PATH)

        acqIK = osrf.run(acqGait,
                         str(MAIN_PATH + gaitFilename),
                         exportSetUp=False)

        # -------- NEW MOTION FILTER ON IK MARKERS ------------------

        modMotion_ik = modelFilters.ModelMotionFilter(
            scp,
            acqIK,
            model,
            pyCGM2Enums.motionMethod.Sodervisk,
            useForMotionTest=True)
        modMotion_ik.compute()

        finalJcs = modelFilters.ModelJCSFilter(model, acqIK)
        finalJcs.setFilterBool(False)
        finalJcs.compute(description="ik", pointLabelSuffix="2_ik")  #

        btkTools.smartWriter(acqIK, "cgm24e_fullIK.c3d")
示例#19
0
def calibration2Dof(model, DATA_PATH, reconstructFilenameLabelled, translators,
                    side, beginFrame, endFrame, jointRange, **kwargs):

    # --- btk acquisition ----
    if "forceBtkAcq" in kwargs.keys():
        acqFunc = kwargs["forceBtkAcq"]
    else:
        acqFunc = btkTools.smartReader(
            (DATA_PATH + reconstructFilenameLabelled))

    btkTools.checkMultipleSubject(acqFunc)
    acqFunc = btkTools.applyTranslators(acqFunc, translators)

    # filtering
    # -----------------------
    if "fc_lowPass_marker" in kwargs.keys(
    ) and kwargs["fc_lowPass_marker"] != 0:
        trackingMarkers = model.getTrackingMarkers(acqFunc)
        fc = kwargs["fc_lowPass_marker"]
        order = 4
        if "order_lowPass_marker" in kwargs.keys():
            order = kwargs["order_lowPass_marker"]
        signal_processing.markerFiltering(acqFunc,
                                          trackingMarkers,
                                          order=order,
                                          fc=fc)

    #---get frame range of interest---
    ff = acqFunc.GetFirstFrame()
    lf = acqFunc.GetLastFrame()

    # motion
    if side is None:
        side = detectSide(acqFunc, "LANK", "RANK")
        LOGGER.logger.info("Detected motion side : %s" % (side))

    start, end = btkTools.getStartEndEvents(acqFunc, side)

    if start is not None:
        LOGGER.logger.info("Start event detected")
        initFrame = start
    else:
        initFrame = beginFrame if beginFrame is not None else ff

    if end is not None:
        LOGGER.logger.info("End event detected")
        endFrame = end
    else:
        endFrame = endFrame if endFrame is not None else lf

    iff = initFrame - ff
    ilf = endFrame - ff

    if model.version in ["CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2"]:
        validFrames, vff, vlf = btkTools.findValidFrames(
            acqFunc, cgm.CGM1.LOWERLIMB_TRACKING_MARKERS)

    # --------------------------RESET OF THE STATIC File---------
    # load btkAcq from static file
    staticFilename = model.m_staticFilename
    acqStatic = btkTools.smartReader((DATA_PATH + staticFilename))
    btkTools.checkMultipleSubject(acqStatic)
    acqStatic = btkTools.applyTranslators(acqStatic, translators)

    # initial calibration ( i.e calibration from Calibration operation)
    leftFlatFoot = model.m_properties["CalibrationParameters"]["leftFlatFoot"]
    rightFlatFoot = model.m_properties["CalibrationParameters"][
        "rightFlatFoot"]
    headFlat = model.m_properties["CalibrationParameters"]["headFlat"]

    markerDiameter = model.m_properties["CalibrationParameters"][
        "markerDiameter"]

    if side == "Left":
        # remove other functional calibration
        model.mp_computed["LeftKneeFuncCalibrationOffset"] = 0

    if side == "Right":
        # remove other functional calibration
        model.mp_computed["RightKneeFuncCalibrationOffset"] = 0

    # no rotation on both thigh - re init anatonical frame
    scp = modelFilters.StaticCalibrationProcedure(model)
    modelFilters.ModelCalibrationFilter(
        scp,
        acqStatic,
        model,
        leftFlatFoot=leftFlatFoot,
        rightFlatFoot=rightFlatFoot,
        headFlat=headFlat,
        markerDiameter=markerDiameter).compute()

    if model.version in ["CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2"]:

        modMotion = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Determinist)
        modMotion.compute()

    elif model.version in ["CGM2.3", "CGM2.4", "CGM2.5"]:
        if side == "Left":
            thigh_markers = model.getSegment("Left Thigh").m_tracking_markers
            shank_markers = model.getSegment("Left Shank").m_tracking_markers

        elif side == "Right":
            thigh_markers = model.getSegment("Right Thigh").m_tracking_markers
            shank_markers = model.getSegment("Right Shank").m_tracking_markers

        validFrames, vff, vlf = btkTools.findValidFrames(
            acqFunc, thigh_markers + shank_markers)

        proximalSegmentLabel = (side + " Thigh")
        distalSegmentLabel = (side + " Shank")

        # Motion
        modMotion = modelFilters.ModelMotionFilter(
            scp, acqFunc, model, enums.motionMethod.Sodervisk)
        modMotion.segmentalCompute([proximalSegmentLabel, distalSegmentLabel])

    # calibration decorators
    modelDecorator.KneeCalibrationDecorator(model).calibrate2dof(
        side, indexFirstFrame=iff, indexLastFrame=ilf, jointRange=jointRange)

    # --------------------------FINAL CALIBRATION OF THE STATIC File---------

    # ----  Calibration
    modelFilters.ModelCalibrationFilter(
        scp,
        acqStatic,
        model,
        leftFlatFoot=leftFlatFoot,
        rightFlatFoot=rightFlatFoot,
        headFlat=headFlat,
        markerDiameter=markerDiameter).compute()

    return model, acqFunc, side
示例#20
0
    if FP2 == 'right':
        plateforme_mpa += 'R'
    elif FP2 == 'left':
        plateforme_mpa += 'L'
    else:
        plateforme_mpa += 'X'

    reconstructFilenameLabelled = os.path.split(filename)[1]
    # Fitting
    # Pour le premier fichier on 'décore' le modèle pour pouvoir faire
    # la méthode de dynakad (il faut que le modele ait été utilisé en dynamique)
    if ind_file == 1:
        acqGait = cgm2_1.fitting(model, DATA_PATH, reconstructFilenameLabelled,
                                 translators, markerDiameter, pointSuffix,
                                 plateforme_mpa, momentProjection)
        modelDecorator.KneeCalibrationDecorator(model).calibrate2dof('Left')
        modelDecorator.KneeCalibrationDecorator(model).calibrate2dof('Right')
    acqGait = cgm2_1.fitting(model, DATA_PATH, reconstructFilenameLabelled,
                             translators, markerDiameter, pointSuffix,
                             plateforme_mpa, momentProjection)
    # writer
    if fileSuffix is not None:
        c3dFilename = str(reconstructFilenameLabelled[:-4] + "-modelled-" +
                          fileSuffix + ".c3d")
    else:
        c3dFilename = str(reconstructFilenameLabelled)

    btkTools.smartWriter(acqGait, str(DATA_PATH_OUT + c3dFilename))
    logging.info("c3d file (%s) generated" % (c3dFilename))
示例#21
0
def applyBasicDecorators(dcm,
                         model,
                         acqStatic,
                         optional_mp,
                         markerDiameter,
                         cgm1only=False):
    if model.getBodyPart() != enums.BodyPart.UpperLimb:
        # native but thighRotation altered in mp
        if dcm["Left Knee"] == enums.JointCalibrationMethod.Basic and dcm[
                "Left Ankle"] == enums.JointCalibrationMethod.Basic and optional_mp[
                    "LeftThighRotation"] != 0:
            logging.warning(
                "CASE FOUND ===> Left Side = NATIVE CGM1 + manual Thigh  ")
            modelDecorator.Cgm1ManualOffsets(model).compute(
                acqStatic, "left", optional_mp["LeftThighRotation"],
                markerDiameter, optional_mp["LeftTibialTorsion"],
                optional_mp["LeftShankRotation"])

        if dcm["Right Knee"] == enums.JointCalibrationMethod.Basic and dcm[
                "Right Ankle"] == enums.JointCalibrationMethod.Basic and optional_mp[
                    "RightThighRotation"] != 0:
            logging.warning(
                "CASE FOUND ===> Right Side = NATIVE CGM1 + manual Thigh  ")
            modelDecorator.Cgm1ManualOffsets(model).compute(
                acqStatic, "right", optional_mp["RightThighRotation"],
                markerDiameter, optional_mp["RightTibialTorsion"],
                optional_mp["RightShankRotation"])

        # KAD - and Kadmed
        if dcm["Left Knee"] == enums.JointCalibrationMethod.KAD:
            logging.warning("CASE FOUND ===> Left Side = Knee-KAD")
            modelDecorator.Kad(model, acqStatic).compute(
                markerDiameter=markerDiameter, side="left")
            if dcm["Left Ankle"] == enums.JointCalibrationMethod.Medial:
                logging.warning("CASE FOUND ===> Left Side = Ankle-Med")
                modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
                    acqStatic, markerDiameter=markerDiameter, side="left")

        if dcm["Right Knee"] == enums.JointCalibrationMethod.KAD:
            logging.warning("CASE FOUND ===> Right Side = Knee-KAD")
            modelDecorator.Kad(model, acqStatic).compute(
                markerDiameter=markerDiameter, side="right")
            if dcm["Right Ankle"] == enums.JointCalibrationMethod.Medial:
                logging.warning("CASE FOUND ===> Right Side = Ankle-Med")
                modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
                    acqStatic, markerDiameter=markerDiameter, side="right")

    if not cgm1only:

        if model.getBodyPart() != enums.BodyPart.UpperLimb:
            #Kad-like (KneeMed)
            if dcm["Left Knee"] == enums.JointCalibrationMethod.Medial and dcm[
                    "Left Ankle"] == enums.JointCalibrationMethod.Basic:
                modelDecorator.KneeCalibrationDecorator(model).midCondyles_KAD(
                    acqStatic, markerDiameter=markerDiameter, side="left")
            if dcm["Right Knee"] == enums.JointCalibrationMethod.Medial and dcm[
                    "Right Ankle"] == enums.JointCalibrationMethod.Basic:
                modelDecorator.KneeCalibrationDecorator(model).midCondyles_KAD(
                    acqStatic, markerDiameter=markerDiameter, side="right")

            #knee and ankle Med
            if dcm["Left Knee"] == enums.JointCalibrationMethod.Medial and dcm[
                    "Left Ankle"] == enums.JointCalibrationMethod.Medial:
                logging.info(
                    "[pyCGM2] Left Knee : Medial - Left Ankle : Medial")
                modelDecorator.KneeCalibrationDecorator(model).midCondyles(
                    acqStatic, markerDiameter=markerDiameter, side="left")
                modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
                    acqStatic, markerDiameter=markerDiameter, side="left")

            if dcm["Right Knee"] == enums.JointCalibrationMethod.Medial and dcm[
                    "Right Ankle"] == enums.JointCalibrationMethod.Medial:
                logging.info(
                    "[pyCGM2] Right Knee : Medial - Right Ankle : Medial")
                modelDecorator.KneeCalibrationDecorator(model).midCondyles(
                    acqStatic, markerDiameter=markerDiameter, side="right")
                modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(
                    acqStatic, markerDiameter=markerDiameter, side="right")
示例#22
0
def applyDecorators_CGM(smc, model,acqStatic,optional_mp,markerDiameter):

    # native but thighRotation altered in mp
    if smc["left"] == enums.CgmStaticMarkerConfig.Native and optional_mp["LeftThighRotation"] !=0:
        logging.warning("CASE FOUND ===> Left Side = NATIVE CGM1 + manual Thigh  ")
        modelDecorator.Cgm1ManualOffsets(model).compute(acqStatic,"left",optional_mp["LeftThighRotation"],
            markerDiameter, optional_mp["LeftTibialTorsion"], optional_mp["LeftShankRotation"])

    if smc["right"] == enums.CgmStaticMarkerConfig.Native and optional_mp["RightThighRotation"] !=0:
        logging.warning("CASE FOUND ===> Right Side = NATIVE CGM1 + manual Thigh  ")
        modelDecorator.Cgm1ManualOffsets(model).compute(acqStatic,"right",optional_mp["RightThighRotation"],
            markerDiameter,optional_mp["RightTibialTorsion"],optional_mp["RightShankRotation"])

    # KAD
    if smc["left"] == enums.CgmStaticMarkerConfig.KAD:
        logging.warning("CASE FOUND ===> Left Side = KAD")
        modelDecorator.Kad(model,acqStatic).compute(markerDiameter=markerDiameter, side="left")

    if smc["right"] == enums.CgmStaticMarkerConfig.KAD:
        logging.warning("CASE FOUND ===> Right Side = KAD")
        modelDecorator.Kad(model,acqStatic).compute(markerDiameter=markerDiameter, side="right")

    # KADmed
    if smc["left"] == enums.CgmStaticMarkerConfig.KADmed:
        logging.warning("CASE FOUND ===> Left Side = KAD+med")
        modelDecorator.Kad(model,acqStatic).compute(markerDiameter=markerDiameter, side="left")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="left")

    if smc["right"] == enums.CgmStaticMarkerConfig.KADmed:
        logging.warning("CASE FOUND ===> Right Side = KAD+med")
        modelDecorator.Kad(model,acqStatic).compute(markerDiameter=markerDiameter, side="right")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="right")

    # KneeMed
    if smc["left"] == enums.CgmStaticMarkerConfig.KneeMed:
        logging.warning("CASE FOUND ===> Left Side = KneeMed -  ankle for KJC")
        modelDecorator.KneeCalibrationDecorator(model).midCondyles_KAD(acqStatic, markerDiameter=markerDiameter, side="left")

    if smc["right"] == enums.CgmStaticMarkerConfig.KneeMed:
        logging.warning("CASE FOUND ===> Right Side = KneeMed -  ankle for KJC")
        modelDecorator.KneeCalibrationDecorator(model).midCondyles_KAD(acqStatic, markerDiameter=markerDiameter, side="right")

    # KneeAnkleMed
    if smc["left"] == enums.CgmStaticMarkerConfig.KneeAnkleMed:
        logging.warning("CASE FOUND ===> Left Side = Knee and Ankle Medial")
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(acqStatic, markerDiameter=markerDiameter, side="left")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="left")

    if smc["right"] == enums.CgmStaticMarkerConfig.KneeAnkleMed:
        logging.warning("CASE FOUND ===> Right Side = Knee and Ankle Medial")
        modelDecorator.KneeCalibrationDecorator(model).midCondyles(acqStatic, markerDiameter=markerDiameter, side="right")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="right")

    # AnkleMed
    if smc["left"] == enums.CgmStaticMarkerConfig.AnkleMed:
        logging.warning("CASE FOUND ===> Left Side = Ankle Medial")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="left")

    if smc["right"] == enums.CgmStaticMarkerConfig.AnkleMed:
        logging.warning("CASE FOUND ===> Right Side = Ankle Medial")
        modelDecorator.AnkleCalibrationDecorator(model).midMaleolus(acqStatic, markerDiameter=markerDiameter, side="right")