def getMarkersPerFrame(self, acq, markerList, frame): a = [] for marker in markerList: if qtools.isPointExist(acq, marker): b = self.getMarkerCoordinates(acq, marker, frame) b = b.tolist() a.append(b) return a
def combineCardanSeqPerFrame(self, acq, segmentRotList, frame): out = [] for segRot in segmentRotList: segRotO = segRot + 'O' segRotA = segRot + 'A' segRotP = segRot + 'P' if qtools.isPointExist(acq, segRotO): out.append( self.getSegmentCardanSeqPerFrame(acq, segRotO, segRotA, segRotP, frame)) return out
def bones(self, acq): if qtools.isPointExist(acq, 'SACR'): bonesLB = [["LTOE", "LANK"], ["LANK", "LTIB"], ["LTIB", "LKNE"], ["LKNE", "LTHI"], ["LTHI", "LASI"], ["LASI", "SACR"], ["RASI", "SACR"], ["RASI", "RTHI"], ["RTHI", "RKNE"], ["RKNE", "RTIB"], ["RTIB", "RANK"], ["RANK", "RTOE"]] if qtools.isPointExist(acq, 'LPSI'): bonesLB = [["LTOE", "LANK"], ["LANK", "LTIB"], ["LTIB", "LKNE"], ["LKNE", "LTHI"], ["LTHI", "LASI"], ["LASI", "LPSI"], ["LPSI", "RPSI"], ["RASI", "RPSI"], ["RASI", "RTHI"], ["RTHI", "RKNE"], ["RKNE", "RTIB"], ["RTIB", "RANK"], ["RANK", "RTOE"]] bonesUB = [['LFHD', 'LBHD'], ['LBHD', 'RBHD'], ['RBHD', 'RFHD'], ['LSHO', 'RSHO'], ['LSHO', 'LELB'], ['LELB', 'LWRB'], ['RSHO', 'RELB'], ['RELB', 'RWRB'], ['C7', 'T10'], ['C7', 'CLAV'], ['CLAV', 'STRN']] if qtools.isPointExist(acq, 'LSHO'): bones = bonesLB + bonesUB else: bones = bonesLB return bones
def getSegAngles(self): for filename in self.fileNames: measurementName = os.path.basename(filename) measurementName = measurementName.replace('.c3d', '') if '1' in measurementName: #temporaty acq = qtools.fileOpen(filename) noFrames = acq.GetLastFrame() - acq.GetFirstFrame() sig = {} for sigName in self.segmentRotList: if qtools.isPointExist(acq, sigName + 'O'): sig[sigName] = np.array([0, 0, 0]) for frame in range(noFrames): sig[sigName] = np.vstack( (sig[sigName], self.combineCardanSeqPerFrame( acq, sigName.split(), frame))) return sig
def segments(self, acq): segments = [{ "name": "Pelvis", "length": self.getSegmentLength(acq, 'RASI', 'LASI') }, { "name": "RThigh", "length": self.getSegmentLength(acq, 'RFEP', 'RFEO') }, { "name": "RLeg", "length": self.getSegmentLength(acq, 'RFEO', 'RTIO') }, { "name": "RFoot", "length": self.getSegmentLength(acq, 'RTIO', 'RTOE') }, { "name": "LThigh", "length": self.getSegmentLength(acq, 'LFEP', 'LFEO') }, { "name": "LLeg", "length": self.getSegmentLength(acq, 'LFEO', 'LTIO') }, { "name": "LFoot", "length": self.getSegmentLength(acq, 'LTIO', 'LTOE') }] if qtools.isPointExist(acq, 'LSHO') and qtools.isPointExist( acq, 'RSHO'): segments.append({ "name": "Thorax", "length": self.getSegmentLength(acq, 'LSHO', 'RSHO') }) if qtools.isPointExist(acq, 'RSHO') and qtools.isPointExist( acq, 'RELB'): segments.append({ "name": "RArm", "length": self.getSegmentLength(acq, 'RSHO', 'RELB') }) if qtools.isPointExist(acq, 'RELB') and qtools.isPointExist( acq, 'RWRB'): segments.append({ "name": "RForearm", "length": self.getSegmentLength(acq, 'RELB', 'RWRB') }) if qtools.isPointExist(acq, 'RWRB') and qtools.isPointExist( acq, 'RFIN'): segments.append({ "name": "RHand", "length": self.getSegmentLength(acq, 'RWRB', 'RFIN') }) if qtools.isPointExist(acq, 'LSHO') and qtools.isPointExist( acq, 'LELB'): segments.append({ "name": "LArm", "length": self.getSegmentLength(acq, 'LSHO', 'LELB') }) if qtools.isPointExist(acq, 'LELB') and qtools.isPointExist( acq, 'LWRB'): segments.append({ "name": "LForearm", "length": self.getSegmentLength(acq, 'LELB', 'LWRB') }) if qtools.isPointExist(acq, 'LWRB') and qtools.isPointExist( acq, 'LFIN'): segments.append({ "name": "LHand", "length": self.getSegmentLength(acq, 'LWRB', 'LFIN') }) if qtools.isPointExist(acq, 'LFHD') and qtools.isPointExist( acq, 'RFHD'): segments.append({ "name": "Head", "length": self.getSegmentLength(acq, 'RFHD', 'LFHD') * 2 }) return segments
def labels(self, acq, markerList): out = [] for marker in markerList: if qtools.isPointExist(acq, marker): out.append({"name": marker}) return out