### Setup Vicon Nexus Packages Source: https://pycgm2.netlify.app/installation/pycgm2_installation Executes setup scripts for Vicon Nexus integration. The first command installs Python packages into Nexus, and the second generates a ready-to-use pipeline. ```bash pyCGM2-setup_NexusPackages.exe ``` ```bash pyCGM2-generate_pyCGM2_Nexus.exe ``` -------------------------------- ### Example CGM Settings Configuration Source: https://pycgm2.netlify.app/faq/4.cgmdefaultsettings This is an example of how to configure settings within the CGM settings file, such as disabling flat foot options. ```ini Calibration: HJC: Left: Hara #[string](choice: Hara only) Right: Hara Left flat foot: 0 #[integer](choice: 0 or 1) Right flat foot: 0 Head flat : 0 ``` -------------------------------- ### Install Vicon Nexus API and Utils Source: https://pycgm2.netlify.app/installation/known-issues Run these batch commands in the Miniconda prompt (as administrator) after activating your environment and navigating to the SDK folder to fix 'viconnexusapi' installation failures. ```batch install_vicon_nexus_api.bat ``` ```batch install_vicon_nexus_utils.bat ``` -------------------------------- ### Example EMG Configuration Snippet Source: https://pycgm2.netlify.app/faq/5.emgsettings This is an example of how to modify the emg.settings file to change muscle assignments for EMG channels. Adjust the 'Muscle' and 'Context' fields as needed. ```ini CHANNELS: Voltage.EMG1 : Muscle : GLUMED Context : Left NormalActivity : GLUMED Voltage.EMG2 : Muscle : GLUMED Context : Right NormalActivity : GLUMED ``` -------------------------------- ### CGM2 Modelling via Start Processing Menu Source: https://pycgm2.netlify.app/nexusqualisys/qtm-apps Applies a specific CGM#i model to trials by selecting the 'CGM2 modelling' command from the QTM Start processing menu and choosing the desired CGM model. ```bash CGM2 modelling ``` -------------------------------- ### Install Package with Pip Trusted Hosts Source: https://pycgm2.netlify.app/installation/known-issues When installing a package with pip under a secure proxy, add these arguments to bypass SSL warnings. ```bash pip install . --trusted-host pypi.org --trusted-host files.pythonhosted.org ``` -------------------------------- ### Get Conda Installation Path Source: https://pycgm2.netlify.app/faq/2.condapath Open a Conda console and execute 'conda info' to display details about your Conda installation, including its path. ```bash conda info copy ``` -------------------------------- ### CGM2 Processing via Start Processing Menu Source: https://pycgm2.netlify.app/nexusqualisys/qtm-apps Finalizes the analysis by running 'CGM2 processing' from the QTM Start processing menu. This processes model outputs, generates a PDF report, and exports time-normalized data. ```bash CGM2 processing ``` -------------------------------- ### Install pyCGM2 from Conda Channel Source: https://pycgm2.netlify.app/installation/pycgm2_installation Installs pyCGM2 and its dependencies from the official pyCGM2 conda channel. This is the standard installation method for users. ```bash conda install -c pycgm2 pycgm2 ``` -------------------------------- ### Processing Specific Model Outputs Source: https://pycgm2.netlify.app/api/gait-applications/gaitprocessing This example demonstrates how to process only specific kinematic or kinetic parameters by providing dictionaries that map labels to desired outputs. This allows for time-normalization of selected CGM outputs based on gait events. ```python analysisInstance = analysis.makeAnalysis(DATA_PATH, modelledFilenames, kinematicLabelsDict = {"Left":["LHipAngles","LKneeAngles"],"Right":["RHipAngles","RKneeAngles"]}, kineticLabelsDict = {"Left":["LHipMoment","LKneePower"],"Right":["RHipMoment","RKneePower"]}, emgChannels = None, subjectInfo={"Name":"Hannibal"}, experimentalInfo={"Context":"Post-Toxin"}, modelInfo={"model":"CGM"}, ) ``` -------------------------------- ### Create Conda Environment from YAML Source: https://pycgm2.netlify.app/installation/pycgm2_installation Creates a conda environment based on the 'environment.yml' file, typically used for developer installations. An optional name can be specified. ```bash conda env create -f environment.yml ``` ```bash conda env create -f environment.yml -n newName ``` -------------------------------- ### Navigate to pyCGM2 Folder Source: https://pycgm2.netlify.app/installation/pycgm2_installation Changes the current directory to the pyCGM2 source code folder. This is required for developer mode installation. ```bash cd path/to/my/pycgm2/folder ``` -------------------------------- ### Get Help for Specific Gait Plot Command Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/gait-plots Use this command to view detailed input arguments and options for a specific plot command, such as plotting normalized kinematics. Refer to the API documentation for further details. ```bash pycgm2.exe NEXUS Plots Kinematics Normalized -h ``` -------------------------------- ### Run Kalman Gap Filling Method Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/gaps Load your gait trial data and then execute the pyCGM2 command to perform gap filling using the Kalman method. Use the `-h` flag for input arguments or consult the API documentation. ```bash pyCGM2.exe NEXUS Gaps Kalman ``` -------------------------------- ### Run Gloersen Gap Filling Method Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/gaps Load your gait trial data and then execute the pyCGM2 command to perform gap filling using the Gloersen method. Use the `-h` flag for input arguments or consult the API documentation. ```bash pyCGM2.exe NEXUS Gaps Gloersen ``` -------------------------------- ### Calibrate Static Trial with CGM1.0 Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines Use this command to perform calibration on a static trial using the CGM1.0 model within Nexus. Ensure Nexus is open and the static file is loaded. ```bash pyCGM2.exe NEXUS CGM1.0 Calibration ``` -------------------------------- ### Install pyCGM2 in Editable Mode Source: https://pycgm2.netlify.app/installation/pycgm2_installation Installs pyCGM2 in 'editable' mode using pip. This allows changes in the source code to be immediately reflected without reinstallation, ideal for developers. ```bash pip install -e . ``` -------------------------------- ### Activate Conda Environment Source: https://pycgm2.netlify.app/installation/pycgm2_installation Activates the specified conda environment. This command is used in both user and developer installation modes. ```bash conda activate pycgm310 ``` -------------------------------- ### Display pyCGM2 Nexus Commands Help Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines Run this command to view all available pyCGM2 commands for interacting with Nexus, including options for CGM models, event detection, data gap filling, plotting, and system information. ```bash pycgm2.exe NEXUS -h ``` -------------------------------- ### Run Zeni Gait Event Detection Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/events Use this command to detect gait events using the Zeni et al 2008 algorithm. This method requires pelvic and foot markers. ```bash pyCGM2.exe NEXUS Events Zeni ``` -------------------------------- ### Fit Gait Trial and Plot Kinematics Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines Execute these commands sequentially to fit a gait trial using CGM1.0 and then generate time-normalized kinematics plots. This is typically done after calibration. ```bash pyCGM2.exe NEXUS CGM1.0 Fitting ``` ```bash pyCGM2.exe NEXUS Plots Kinematics Normalized ``` -------------------------------- ### Getting Help for CGM Commands Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/cgm To view the input arguments for any CGM command, append the '-h' flag to the command. This is useful for understanding and modifying default settings. ```bash pycgm2.exe NEXUS CGM1.0 Calibration -h ``` ```bash pycgm2.exe NEXUS CGM1.0 Fitting -h ``` -------------------------------- ### Run CGM Commands with Input Arguments Source: https://pycgm2.netlify.app/faq/4.cgmdefaultsettings Use these commands to run CGM2.3 calibration or fitting directly by specifying input arguments. ```bash pycgm2.exe NEXUS CGM2.3 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.3 Fitting ``` -------------------------------- ### Create Python 3.10 Conda Environment Source: https://pycgm2.netlify.app/installation/pycgm2_installation Creates a new conda environment named 'pycgm310' with Python 3.10. This is a prerequisite for installing pyCGM2 in user mode. ```bash conda create --name pycgm310 python=3.10 ``` -------------------------------- ### Create Environment Activation Script Source: https://pycgm2.netlify.app/faq/3.nexusoperationpipeline This batch script activates a Conda virtual environment. Ensure 'CONDA_PATH' and 'ENV_NAME' are set to your specific Miniconda installation and environment name. ```batch @echo off rem Set the path to your Miniconda installation directory set "CONDA_PATH=C:\Users\fleboeuf\Miniconda3" rem Set the name of your virtual environment set "ENV_NAME=pycgm39" call "%CONDA_PATH%\Scripts\activate.bat" %ENV_NAME% ``` -------------------------------- ### CGM Calibration Commands (1.0-2.5) Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/cgm Use these commands to calibrate static files for CGM models from version 1.0 to 2.5. Ensure your virtual Python environment is activated before running. Note that the calibration process does not accept gaps; crop or fill gaps in your trial data. ```bash pycgm2.exe NEXUS CGM1.0 Calibration ``` ```bash pycgm2.exe NEXUS CGM1.1 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.1 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.2 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.3 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.4 Calibration ``` ```bash pycgm2.exe NEXUS CGM2.5 Calibration ``` -------------------------------- ### List Available Gait Plot Commands Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/gait-plots Run this command to see all available plot commands and their options. Ensure your virtual Python environment is activated before execution. ```bash pycgm2.exe NEXUS Plots -h ``` -------------------------------- ### Generate Session in QTM Source: https://pycgm2.netlify.app/nexusqualisys/qtm-apps Initiates a new session in QTM, creating the settings.xml file and exporting C3D files for selected trials. ```bash generate session ``` -------------------------------- ### Basic Gait Data Processing and Reporting Source: https://pycgm2.netlify.app/api/gait-applications/gaitprocessing This snippet demonstrates the fundamental process of creating an analysis instance from C3D files, generating descriptive kinematic and kinetic plots, spatio-temporal parameter plots, and exporting the results to a spreadsheet. It requires specifying the data path and filenames. ```python import pyCGM2 from pyCGM2.Report import normativeDatasets from pyCGM2.Lib import analysis from pyCGM2.Lib import plot # data DATA_PATH = "c:\\pathTomydata\\" modelledFilenames = ["gait Trial 01.c3d", "gait Trial 02.c3d"] # two gait trials with both gait event and CGMi model ouptuts analysisInstance = analysis.makeAnalysis(DATA_PATH, modelledFilenames, emgChannels=None) # construction of the analysis instance. normativeDataset = normativeDatasets.NormativeData("Schwartz2008","Free") # selected normative dataset # plots plot.plot_DescriptiveKinematic(DATA_PATH,analysisInstance,"LowerLimb",normativeDataset) plot.plot_DescriptiveKinetic(DATA_PATH,analysisInstance,"LowerLimb",normativeDataset) plot.plot_spatioTemporal(DATA_PATH,analysisInstance) # export as spreadsheet analysis.exportAnalysis(analysisInstance,DATA_PATH,"spreadsheet") ``` -------------------------------- ### CGM Fitting Commands (1.0-2.5) Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/cgm Execute these commands to fit CGM models to gait trials for versions 1.0 through 2.5. The projection of joint moments differs between CGM1.0 and later versions (1.1-2.5). ```bash pycgm2.exe NEXUS CGM1.0 Fitting ``` ```bash pycgm2.exe NEXUS CGM1.1 Fitting ``` ```bash pycgm2.exe NEXUS CGM2.1 Fitting ``` ```bash pycgm2.exe NEXUS CGM2.2 Fitting ``` ```bash pycgm2.exe NEXUS CGM2.3 Fitting ``` ```bash pycgm2.exe NEXUS CGM2.4 Fitting ``` ```bash pycgm2.exe NEXUS CGM2.5 Fitting ``` -------------------------------- ### Run Intellevent Gait Event Detection Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/events Use this command to detect gait events using the Intellevent algorithm (Dumphart et al 2023). This deep learning-based method requires foot markers. ```bash pyCGM2.exe NEXUS Events Intellevent ``` -------------------------------- ### CGM1.0 Fitting with Custom Options Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/3argumentreferences Configure CGM1.0 fitting with a specific marker diameter, projection method, and output suffix. ```bash pycgm2.exe NEXUS CGM1.0 Fitting -md 16 --proj Proximal --pointSuffix test copy ``` -------------------------------- ### CGM1.0 Calibration with Short Options Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/3argumentreferences Use short options for CGM1.0 calibration, specifying left and right flat foot, marker diameter, and enabling a check. ```bash pycgm2.exe NEXUS CGM1.0 Calibration -l 0 -r 1 -md 16 --check copy ``` -------------------------------- ### Generate Kinematics Time-Normalized Panel Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/3argumentreferences Creates a time-normalized kinematics panel that displays all cycles rather than the average and standard deviation corridor. It uses model outputs suffixed with '_test_' and incorporates a specific modality from a normative dataset. ```bash pycgm2.exe NEXUS Plots Kinematics Normalized --consistency -ps test -nd Schwartz2008 -ndm VerySlow ``` -------------------------------- ### Apply CGM2.1 to C3D Trials Source: https://pycgm2.netlify.app/api/gait-applications/gaitmodelling This code demonstrates how to apply the CGM2.1 model to C3D files for gait analysis. It includes steps for calibration and fitting, using settings from a configuration file. Ensure the necessary C3D files and settings are accessible. ```python # -*- coding: utf-8 -*- import os import pyCGM2 from pyCGM2.Utils import files from pyCGM2.Tools import btkTools from pyCGM2.ForcePlates import forceplates from pyCGM2 import enums from pyCGM2.Lib.CGM import cgm2_1 LOGGER = pyCGM2.LOGGER # data DATA_PATH = "C:\\myPATH\\" staticFile ="03367_05136_20200604-SBNNN-VDEF-02.c3d" # static trial trialName = "03367_05136_20200604-GBNNN-VDEF-01.c3d" # gait trial # setting settings = files.loadModelSettings(DATA_PATH,"CGM2_1-pyCGM2.settings") # CGM2.1 CALIBRATION #------------------- acqStatic = btkTools.smartReader(DATA_PATH+staticFile) # construct the btk.Acquisition instance # calibration options from settings leftFlatFoot = settings["Calibration"]["Left flat foot"] rightFlatFoot= settings["Calibration"]["Right flat foot"] headFlat= settings["Calibration"]["Head flat"] translators = settings["Translators"] markerDiameter = settings["Global"]["Marker diameter"] HJC = settings["Calibration"]["HJC"] pointSuffix = settings["Global"]["Point suffix"] # anthropometric parameters required_mp = dict() required_mp["Bodymass"] = 75.0 required_mp["Height"]= 1750 required_mp["LeftLegLength"] = 800 required_mp["LeftKneeWidth"] = 90 required_mp["RightLegLength"] = 800 required_mp["RightKneeWidth"] = 90 required_mp["LeftAnkleWidth"] = 60 required_mp["RightAnkleWidth"] = 60 required_mp["LeftSoleDelta"] = 0 required_mp["RightSoleDelta"] = 0 required_mp["LeftShoulderOffset"] = 0 required_mp["LeftElbowWidth"] = 0 required_mp["LeftWristWidth"] = 0 required_mp["LeftHandThickness"] = 0 required_mp["RightShoulderOffset"] = 0 required_mp["RightElbowWidth"] = 0 required_mp["RightWristWidth"] = 0 required_mp["RightHandThickness"]= 0 optional_mp = dict() optional_mp["InterAsisDistance"]= 0 optional_mp["LeftAsisTrocanterDistance"]= 0 optional_mp["LeftTibialTorsion"]= 0 optional_mp["LeftThighRotation"]= 0 optional_mp["LeftShankRotation"]= 0 optional_mp["RightAsisTrocanterDistance"]= 0 optional_mp["RightTibialTorsion"]= 0 optional_mp["RightThighRotation"]= 0 optional_mp["RightShankRotation"]= 0 # calibrate function model,finalAcqStatic,error = cgm2_1.calibrate(DATA_PATH, staticFile, translators, required_mp, optional_mp, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, HJC, pointSuffix) # CGM2.1 FITTING #---------------- # fitting options from settings momentProjection = enums.enumFromtext(settings["Fitting"]["Moment Projection"],enums.MomentProjection) pointSuffix = settings["Global"]["Point suffix"] # force plate assignement acq = btkTools.smartReader(DATA_PATH+trialName) # btk.Acquisition instance графии = forceplates.matchingFootSideOnForceplate(acq) #detect correct foot contact with a force plate # fitting function acqGait,detectAnomaly = cgm2_1.fitting(model,DATA_PATH, trialName, translators, markerDiameter, pointSuffix, mfpa, momentProjection, frameInit= None, frameEnd= None )# acqGait updated with CGM2.1 ouputs ( kinematics and kinetics) # EXPORT # ------- btkTools.smartWriter(acqGait, DATA_PATH+trialName[:-4]+"-modelled.c3d") # save the btk.Acquisition instance as a new c3d with the suffix "-modelled" copy ``` -------------------------------- ### View EMG Plot Commands Help Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/emg To discover available EMG plot commands and their options, execute this command in your activated virtual Python environment. ```bash pycgm2.exe NEXUS Plots EMG -h copy ``` -------------------------------- ### Detect Gait Events using Zeni Method Source: https://pycgm2.netlify.app/api/gait-applications/gaitevent Load a C3D file, detect gait events using the Zeni method, and save the modified file. Ensure the DATA_PATH is correctly set to your trial directory. ```python import pyCGM2 from pyCGM2.Lib import eventDetector from pyCGM2.Tools import btkTools DATA_PATH = "C:\\myPATH\\" # data trialName = "03367_05136_20200604-GBNNN-VDEF-01.c3d" acqGait = btkTools.smartReader(DATA_PATH+trialName) # function eventDetector.zeni(acqGait) btkTools.smartWriter(acqGait, DATA_PATH+trialName[:-4]+"-event.c3d") copy ``` -------------------------------- ### View Normalized EMG Command Arguments Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/emg To understand the specific input arguments required for normalized EMG commands, use this command. Ensure gait events are identified beforehand for most commands. ```bash pycgm2.exe NEXUS Plots EMG Normalized -h copy ``` -------------------------------- ### Generate Kinematics Comparison Panel Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/3argumentreferences Generates a kinematics comparison panel showing all cycles. This command utilizes model outputs suffixed with '_test_' and references a specific modality from a normative dataset. ```bash pycgm2.exe NEXUS Plots Kinematics Comparison --consistency -ps test -nd Schwartz2008 -ndm VerySlow ``` -------------------------------- ### Run Oconnor Gait Event Detection Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/events Use this command to detect gait events using the Oconnor et al 2007 algorithm. This method requires foot markers. ```bash pyCGM2.exe NEXUS Events Oconnor ``` -------------------------------- ### Zeni et al 2008 Gait Event Detection with Offset Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/3argumentreferences Apply a systematic offset to all detected foot strikes using the Zeni et al 2008 method for gait event detection. ```bash pycgm2.exe NEXUS Events Zeni -fso 5 copy ``` -------------------------------- ### Adding Metadata to Analysis Instance Source: https://pycgm2.netlify.app/api/gait-applications/gaitprocessing This snippet shows how to include subject, experimental, and model metadata when creating the analysis instance. This information will be included as columns in the exported spreadsheet. ```python analysisInstance = analysis.makeAnalysis(DATA_PATH, modelledFilenames, emgChannels= None, subjectInfo={"Name":"Hannibal"}, experimentalInfo={"Context":"Post-Toxin"}, modelInfo={"model":"CGM"}, ) ``` -------------------------------- ### Edit EMG Settings via Command Line Source: https://pycgm2.netlify.app/faq/5.emgsettings Use this command to edit the emg.settings file from your data folder. Ensure your virtual environment is activated and you are in the correct directory. ```bash pycgm2.exe SETTINGS Edit -e ``` ```bash pycgm2.exe SETTINGS Edit --emg ``` -------------------------------- ### CGM1.0 to CGM2.5 Calibration Commands Source: https://pycgm2.netlify.app/nexusqualisys/vicon-apps/2commandlines/cgm These commands are used to calibrate the CGM model. Note that the calibration process does not accept gaps, so trials must be cropped or gaps filled beforehand. Default settings include aligning the longitudinal foot axis with the ground, aligning the head's medio-lateral axis, and considering a 14mm marker diameter. These defaults can be altered using input arguments (type -h for help) or by manipulating setting files. ```APIDOC ## CGM1.0 to CGM2.5 Calibration ### Description Calibrates the CGM model. Requires trials without gaps. ### Commands ``` pycgm2.exe NEXUS CGM1.0 Calibration pycgm2.exe NEXUS CGM1.1 Calibration pycgm2.exe NEXUS CGM2.1 Calibration pycgm2.exe NEXUS CGM2.2 Calibration pycgm2.exe NEXUS CGM2.3 Calibration pycgm2.exe NEXUS CGM2.4 Calibration pycgm2.exe NEXUS CGM2.5 Calibration ``` ### Default Settings - Align longitudinal foot axis with the ground (flat foot option). - Align medio-lateral axis of the head (head flat option). - Consider 14mm marker diameter. ### Customization - Use input arguments: `pycgm2.exe NEXUS CGM1.0 Calibration -h` (or any CGM version). - Manipulate setting files (see FAQ). ``` -------------------------------- ### Run CGM2 Modelling via Command Line Source: https://pycgm2.netlify.app/nexusqualisys/qtm-apps Executes the CGM2 modelling process using the pycgm2.exe command in a conda console. Ensure your virtual environment is activated. ```bash pycgm2.exe QTM Modelling ```