def gaitTrialProgressionY_forward_lateralX(cls): """ """ MAIN_PATH = pyCGM2.TEST_DATA_PATH + "operations\\progression\\" gaitFilename = "gait_Y_forward.c3d" acq = btkTools.smartReader(str(MAIN_PATH + gaitFilename)) valSACR = (acq.GetPoint("LPSI").GetValues() + acq.GetPoint("RPSI").GetValues()) / 2.0 btkTools.smartAppendPoint(acq, "SACR", valSACR, desc="") valMidAsis = (acq.GetPoint("LASI").GetValues() + acq.GetPoint("RASI").GetValues()) / 2.0 btkTools.smartAppendPoint(acq, "midASIS", valMidAsis, desc="") validFrames, vff, vlf = btkTools.findValidFrames( acq, ["LPSI", "LASI", "RPSI"]) longitudinalAxis, forwardProgression, globalFrame = btkTools.findProgression( acq, "LASI") np.testing.assert_equal(longitudinalAxis, "Y") np.testing.assert_equal(forwardProgression, True) np.testing.assert_equal(globalFrame, "YXZ")
def gaitTrialGarches(cls): """ """ MAIN_PATH = pyCGM2.TEST_DATA_PATH + "operations\\progression\\" translators = { "LASI":"L.ASIS", "RASI":"R.ASIS", "LPSI":"L.PSIS", "RPSI":"R.PSIS", "RTHI":"R.Thigh", "RKNE":"R.Knee", "RTHAP":"R.THAP", "RTHAD":"R.THAD", "RTIB":"R.Shank", "RANK":"R.Ankle", "RTIAP":"R.TIAP", "RTIAD":"R.TIAD", "RHEE":"R.Heel", "RSMH":"R.SMH", "RTOE":"R.Toe", "RFMH":"R.FMH", "RVMH":"R.VMH", "LTHI":"L.Thigh", "LKNE":"L.Knee", "LTHAP":"L.THAP", "LTHAD":"L.THAD", "LTIB":"L.Shank", "LANK":"L.Ankle", "LTIAP":"L.TIAP", "LTIAD":"L.TIAD", "LHEE":"L.Heel", "LSMH":"L.SMH", "LTOE":"L.Toe", "LFMH":"L.FMH", "LVMH":"L.VMH", "RKNM":"R.Knee.Medial", "LKNM":"L.Knee.Medial", "RMED":"R.Ankle.Medial", "LMED":"L.Ankle.Medial" } gaitFilename="gait_garches_issue.c3d" acq = btkTools.smartReader(str(MAIN_PATH + gaitFilename),translators =translators ) valSACR=(acq.GetPoint("RPSI").GetValues() + acq.GetPoint("LPSI").GetValues()) / 2.0 btkTools.smartAppendPoint(acq,"SACR",valSACR,desc="") valMidAsis=(acq.GetPoint("RASI").GetValues() + acq.GetPoint("LASI").GetValues()) / 2.0 btkTools.smartAppendPoint(acq,"midASIS",valMidAsis,desc="") longitudinalAxis,forwardProgression,globalFrame = btkTools.findProgression(acq,"LASI") longitudinalAxis2,forwardProgression2,globalFrame2 = btkTools.findProgressionAxisFromPelvicMarkers(acq,["LASI","LPSI","RASI","RPSI"]) np.testing.assert_equal( longitudinalAxis,"Y") np.testing.assert_equal( longitudinalAxis2,"Y")
def detect(self, acq): """ """ ff = acq.GetFirstFrame() progressionAxis, forwardProgression, globalFrame = btkTools.findProgression( acq, "LANK") longAxisIndex = 0 if progressionAxis == "X" else 1 sacrum = (acq.GetPoint("LPSI").GetValues() + acq.GetPoint("RPSI").GetValues()) / 2.0 #Left heel_left = acq.GetPoint("LHEE").GetValues() toe_left = acq.GetPoint("LTOE").GetValues() diffHeel_left = heel_left - sacrum diffToe_left = toe_left - sacrum #Right heel_right = acq.GetPoint("RHEE").GetValues() toe_right = acq.GetPoint("RTOE").GetValues() diffHeel_right = heel_right - sacrum diffToe_right = toe_right - sacrum if forwardProgression: indexes_fs_left = detect_peaks.detect_peaks( diffHeel_left[:, longAxisIndex]) + ff indexes_fo_left = detect_peaks.detect_peaks( -diffToe_left[:, longAxisIndex]) + ff else: indexes_fs_left = detect_peaks.detect_peaks( -diffHeel_left[:, longAxisIndex]) + ff indexes_fo_left = detect_peaks.detect_peaks( diffToe_left[:, longAxisIndex]) + ff if forwardProgression: indexes_fs_right = detect_peaks.detect_peaks( diffHeel_right[:, longAxisIndex]) + ff indexes_fo_right = detect_peaks.detect_peaks( -diffToe_right[:, longAxisIndex]) + ff else: indexes_fs_right = detect_peaks.detect_peaks( -diffHeel_right[:, longAxisIndex]) + ff indexes_fo_right = detect_peaks.detect_peaks( diffToe_right[:, longAxisIndex]) + ff print indexes_fs_left print indexes_fs_left + self.footStrikeOffset return indexes_fs_left + self.footStrikeOffset, indexes_fo_left + self.footOffOffset, indexes_fs_right + self.footStrikeOffset, indexes_fo_right + self.footOffOffset