Beispiel #1
0
    def generate(self, c3dManager, spatioTempFlag, kinematicFlag, kineticFlag,
                 emgFlag):

        #---spatioTemporalTrials
        if spatioTempFlag:
            c3dManager.spatioTemporal["Trials"], c3dManager.spatioTemporal[
                "Filenames"] = trialTools.buildTrials(self.m_data_path,
                                                      self.m_files_stp)

        # ----kinematic trials---
        if kinematicFlag:
            c3dManager.kinematic["Trials"], c3dManager.kinematic[
                "Filenames"], = trialTools.buildTrials(self.m_data_path,
                                                       self.m_files_kinematic)

        #---kinetic Trials--- ( check if kinetic events)
        if kineticFlag:
            c3dManager.kinetic["Trials"], c3dManager.kinetic[
                "Filenames"], C3dManager.kineticFlag = trialTools.automaticKineticDetection(
                    self.m_data_path, self.m_files_kinetic)

        #----emgTrials
        if emgFlag:
            c3dManager.emg["Trials"], c3dManager.emg[
                "Filenames"], = trialTools.buildTrials(self.m_data_path,
                                                       self.m_files_emg)
Beispiel #2
0
    def twoPF_FP1left_FP2right(cls):

        MAIN_PATH = pyCGM2.TEST_DATA_PATH + "operations\\forceplates\\FootAssignementAutoamticGeneralEvent\\"

        # --- Motion 1
        gaitFilename = "MRI-US-01, 2008-08-08, 3DGA 13.c3d"
        acqGait = btkTools.smartReader(str(MAIN_PATH + gaitFilename))
        #forceplates.appendForcePlateCornerAsMarker(acqGait)
        mappedForcePlate = forceplates.matchingFootSideOnForceplate(acqGait)
        forceplates.addForcePlateGeneralEvents(acqGait, "LR")

        btkTools.smartWriter(acqGait,
                             str(MAIN_PATH + "twoPF_FP1left_FP2right.c3d"))

        modelledFilenames = ["twoPF_FP1left_FP2right.c3d"]

        #---- GAIT CYCLES FILTER PRELIMARIES
        #--------------------------------------------------------------------------
        # distinguishing trials for kinematic and kinetic processing

        # - kinematic Trials
        kinematicTrials = []
        kinematicFilenames = []
        for kinematicFilename in modelledFilenames:
            kinematicFileNode = ma.io.read(str(MAIN_PATH + kinematicFilename))
            kinematicTrial = kinematicFileNode.findChild(ma.T_Trial)
            trialTools.sortedEvents(kinematicTrial)

            longitudinalAxis, forwardProgression, globalFrame = trialTools.findProgression(
                kinematicTrial, "LHEE")

            kinematicTrials.append(kinematicTrial)
            kinematicFilenames.append(kinematicFilename)

        # - kinetic Trials ( check if kinetic events)
        kineticTrials, kineticFilenames, flag_kinetics = trialTools.automaticKineticDetection(
            MAIN_PATH, modelledFilenames)

        #---- GAIT CYCLES FILTER
        #--------------------------------------------------------------------------
        cycleBuilder = cycle.GaitCyclesBuilder(
            spatioTemporalTrials=kinematicTrials,
            kinematicTrials=kinematicTrials,
            kineticTrials=kineticTrials,
            emgTrials=None)

        cyclefilter = cycle.CyclesFilter()
        cyclefilter.setBuilder(cycleBuilder)
        cycles = cyclefilter.build()

        # TESTING

        np.testing.assert_equal(len(cycles.kineticCycles), 2)
        np.testing.assert_equal(cycles.kineticCycles[0].context, "Left")
        np.testing.assert_equal(cycles.kineticCycles[0].begin, 253)
        np.testing.assert_equal(cycles.kineticCycles[1].context, "Right")
        np.testing.assert_equal(cycles.kineticCycles[1].begin, 201)