Exemplo n.º 1
0
def smartReader(filename, translators=None):
    """
        Convenient function to read a c3d with Btk

        :Parameters:
            - `filename` (str) - path and filename of the c3d
            - `translators` (str) - marker translators
    """
    reader = btk.btkAcquisitionFileReader()
    reader.SetFilename(filename)
    reader.Update()
    acq = reader.GetOutput()
    if translators is not None:
        acq = applyTranslators(acq, translators)

    # management force plate type 5
    if checkForcePlateExist(acq):
        if "5" in smartGetMetadata(acq, "FORCE_PLATFORM", "TYPE"):
            LOGGER.logger.warning(
                "[pyCGM2] Type 5 Force plate detected. Due to a BTK known-issue,  type 5 force plate has been corrected as type 2"
            )
            from pyCGM2.ForcePlates import forceplates  # inelegant code but avoir circular import !!
            forceplates.correctForcePlateType5(acq)

    # sort events
    sortedEvents(acq)

    return acq
Exemplo n.º 2
0
def smartReader(filename,translators=None):
    """
        Convenient function to read a c3d with Btk

        :Parameters:
            - `filename` (str) - path and filename of the c3d
            - `translators` (str) - marker translators
    """
    reader = btk.btkAcquisitionFileReader()
    reader.SetFilename(filename)
    reader.Update()
    acq=reader.GetOutput()
    if translators is not None:
        acq =  applyTranslators(acq,translators)
    return acq
Exemplo n.º 3
0
def fileOpen(filename):
    reader = btk.btkAcquisitionFileReader()  # build a btk reader object
    reader.SetFilename(filename)  # set a filename to the reader
    reader.Update()
    acq = reader.GetOutput()  # acq is the btk aquisition object
    return acq