====== ASCII Format ====== Visual3D reads and writes the C3D data file format developed by Andrew Dainis and Doug McGuire in 1987. The C3D formatted file is a compact binary data file used as a convenient and efficient means for storing 3D coordinate and analog data, with all associated parameters, for a single measurement trial. The [[Visual3D:Documentation:C3D_Signal_Types:C3D_Format#C3D_Parameter_Format|C3D Format]] is a publicly defined format and is currently implemented by most motion capture vendors. Data file stored in formats other than the C3D format must be translated into the C3D Format. C-Motion provides several plugin for translating data files. There are a wide variety of ASCII formatted Data files. Visual3D will load many of these files into Visual3D; translating them into C3D format in the process. It is quite a challenge to read all varieties of ASCII formatted files, but we do our best to accommodate data that our users collect. If Visual3D does not import your formatted files, contact support@c-motion.com and request that we implement your format. We recognize that the first task to analyze your data is to be able to load the files, so we try hard to make sure that users have their data. ASCII files that can be imported. Users that create their own custom file formats may be able to adapt their own file format fairly simply. If a user has an ASCII file format that Visual3D does not currently import, please contact support@c-motion.com and we will either create a file importer for you, or provide you with an SDK to create your own Visual3D plugin. A universal ASCII file converter may be downloaded from the [[https://www.c-motion.com/products/free-downloads/|C-Motion Free Downloads]] page. Documentation for the ASCII file converter may be found on the [[index.php?title=File_Converter&action=edit&redlink=1|File Converter]] wiki page. === P2D_Format === The P2D file format was part of the origin MOVE3D software written by Tom Kepple in Dr. Steven Stanhope’s Laboratory at the United States National Institutes of Health (NIH) (http://pdb.cc.nih.gov). Visual3D was the result of the technology transfer of the MOVE3D software. === Visual3D_ASCII_Format === Visual3D ASCII file format for importing and exporting signals Visual3D exports data into several file formats. The simplest and default file format for data export to ASCII files is the following: This data file can be exported from Visual3D using the pipeline command [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File|Export_Data_To_ASCII_File]] This data file can be imported to Visual3D using the pipeline command [[Visual3D:Documentation:Pipeline:File_Commands:Import_Data_From_ASCII_File|Import_Data_From_ASCII_File]] Report data can be exported from the report tab [[#Export_Data_From_Report_Dialog|as described here]]. === FSV_Format === The **Import_Fsv_Files** Visual3D plugin is a fairly general ASCII file format translater to c3d, that may be suitable for a variety of ASCII files. The FSV/TSV file formats were originally developed by Manfred Berger from Innovision Systems and are currently used by Qualisys and Innovision. === JSON_Format === Signal data can be exported to JSON format (Javascript Object Notation) using the [[index.php?title=Export_Data_To_ASCII&action=edit&redlink=1|Export_Data_To_ASCII]] pipeline command. Data from a report graph can be exported in JSON format using the [[#Export_Data_From_Report_Dialog|Export Data From Report Dialog]] option in the report tab. See also [[Visual3D:Documentation:Visual_3D_Formating:JSON_Formats|JSON Formats]]. === Kinemetrix === The Import_Kinemetrix_Files Visual3D plugin is an ASCII file format translator to c3d. These files are produced by Kinemetrics. This is a preliminary importer because we had only one example file to work with. ;-) ==== Opening a text file ==== A visual3D ASCII file can be opened in the Visual3D workspace directly using the FILE OPEN menu option or the FILE_OPEN command. In order for Visual3D to interpret this standalone file correctly, it is important that a signal be included specifying the time. |- |C:\ExampleData\ExampleWalk.c3d|C:\ExampleData\ExampleWalk.c3d|Filename from which the data came.\\ e.g. Filename withing the Visual3D Workspace| |- |ANALOGTIME |EMG9 |Signal Name | |- |FRAME_NUMBERS |ANALOG |Signal Type | |- |ORIGINAL |ORIGINAL |Signal Folder (e.g. ORIGINAL, PROCESSED, etc.) | |ITEM|0 |X |Component. (ANALOG signals have channel 0 or channel X | |1 |0.01 |23.0 |- | |2 |0.02 |22.5 |- | |3 |0.03 |23.0 |- | |4 |0.04 |22.0 |- | |5 |0.05 |21.0 |- | ==== Importing data from an ASCII file ==== Visual3D currently imports signals from an ASCII file. [[Visual3D:Documentation:Pipeline:File_Commands:Import_Data_From_ASCII_File|Import_Data_From_ASCII_File]] **/FILE_NAME=**c:\exampleData\Test Command Input Signals\testInputData.txt\\ **;** Visual3D allows the importing of data to a C3D file from an ASCII file. See the description of the default ASCII file format for Visual3D. One of the constraints on the file import is that the first line of the signal column must match an open C3D file. This allows Visual3D to recognize which file to add the data to. For ANALOG and TARGET (POINT) data the following rules apply: If there are more frames of data in the ASCII file than there are in the C3D file, the ASCII signal is truncated. If there are fewer frames of data in the ASCII file than there are in the C3D file, the signal is padded with frames of data containing DATA_NOT_FOUND. NOTE: For DERIVED signals all rows are added to the data file within Visual3D without truncation or padding. This is partly because DERIVED signals cannot be exported to the C3D file at this point, so there is no conflict with the C3D file format. === Import ASCII signals adds the signals to the DERIVED folder in the data tree === I would like these signals added to the ANALOG folder because I would like to export the c3d file with all of the data combined.==== There are two flavours of importing signals from an ASCII file. The first uses the import ASCII signals command in the pipeline. This is a legacy command that is used to import signals that have been processed by an external executable (e.g. matlab). These data are always imported as DERIVED signals. The second uses custom import commands to merge the ANALGO signals with the Motion Capture signals. There are many varieties of file formats that can be imported, but ASCII files are pretty fragile (meaning they can cause system crashes quite easily). If you have signals that you need merged, please contact support@c-motion.com to confirm that your files can be imported. If not, we usually write new filters for importing data at no cost to our customers. ==== Export Signals to an ASCII file Using Data Tree ==== {{:DataTreeExportASCII.gif}}\\ Select one of the signals in the data tree using a click of the Left Mouse Button. A dialog appears that contains two tabs. One tab is a graph of the signal, the other tab is a list of the data values. Selecting the Export ASCII button causes a browse window to appear to save the data to a Visual3D ASCII formatted data file. == Pipeline Command for Exporting Signals to an ASCII File == The Visual3D pipeline command exports ASCII data to one of 2 formatted data files (Visual3D default and P2D). For Example: |**[[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File|Export_Data_To_ASCII_File]]**| | |/SIGNAL_TYPES=ANALOG |Signal Type | |! /SIGNAL_FOLDER=ORIGINAL |Signal Folder | |/SIGNAL_NAMES=EMG8 |Signal Names | |/FILE_NAME=C:\demo files\Example1\test.txt |The filename (Including Path) for the exported data | |! /SIGNAL_COMPONENTS= |Signal Component. This is a legacy parameter, if using version 5 or later, please use COMPONENT_SEQUENCE. | |/COMPONENT_SEQUENCE=X |Signal Component | |! /SIGNAL_PRECISION= |Indicates the number of decimal places | |! /START_LABEL= |Event Label indicating the first frame of data to be exported. This is a legacy parameter, if using version 4 or later, please use EVENT_SEQUENCE.| |! /END_LABEL= |Event Label indicating the last frame of data to be exported. This is a legacy parameter, if using version 4 or later, please use EVENT_SEQUENCE. | |! /EVENT_SEQUENCE= |Event sequence the signals should be exported between (ex. LHS+LHS,RHS+RHS) | |! /EXCLUDE_EVENTS= |If an event sequence contains one of the events listed in this parameter (ex. BAD,BAD) the event sequence will not be exported. | |! /USE_POINT_RATE=FALSE |ANALOG signals can be exported at either the ANALOG rate or the POINT rate | |! /NORMALIZE_DATA=FALSE |Option to Time Normalize the data | |! /NORMALIZE_POINTS=101 |Number of Output Points from the Time Normalization | |! /EXPORT_MEAN_AND_STD_DEV=FALSE |Option to Export the Mean and Standard Deviation | |! /USE_P2D_FORMAT=FALSE |See the Description of P2D Files in the documentation. | |! /USE_XML_FORMAT=FALSE | | |! /USE_JSON_FORMAT=FALSE | | |! /USE_SHORT_FILENAME=FALSE |The file path for each C3D file will not be exported when set to TRUE | |! /EXPORT_EMPTY_SIGNALS=FALSE | | |! /EXPORT_WITHOUT_HEADER=FALSE |The headers (FILENAME, SIGNAL TYPE, SIGNAL FOLDER, SIGNAL NAME, SIGNAL COMPONENT) will not be exported when set to TRUE. | |**;** | | The following dialog appears when the EXPORT_DATA_TO_ASCII_FILE command has been added to the pipeline and the user double-clicks with the Left Mouse Button on the command. {{:exportascii.png}} \\ ==== Export Data From Report Dialog ==== Select one of the graphs in the edit report dialog. A button will appear below the graph list box titled ”Export Selected”. Selecting this button will pop up a dialog for exporting the data from the graph to an ASCII file; either a Visual3D ASCII formatted file or a P2D formatted file. The options exist to save the raw data (e.g. frame by frame) or to save time normalized data (e.g. a specified number of frames) using the properties of the graph template (e.g. start frame and end frame). The picture below shows a highlighted graph and selecting a [[Visual3D:Documentation:Visual_3D_Formating:JSON_Formats|JSON output format]]. {{:exportreport.png}} ==== Export 6 degree of freedom data ==== It is possible to export 6 degree of freedom data to an ASCII format as either an ORIGIN and QUATERNION or as an ORIGIN and 3x3 ROTATION MATRIX. Exporting the position and orientation of segment RFT as an ORIGIN and Quaternion \\ [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File|Export_Data_To_ASCII_File]] ! /FILE_NAME= /SIGNAL_TYPES=FRAME_NUMBERS+LINK_MODEL_BASED+LINK_MODEL_BASED /SIGNAL_NAMES=TIME+ORIGIN+QUATERNION /SIGNAL_FOLDER=ORIGINAL+RFT+RFT ! /START_LABEL= ! /END_LABEL= ! /USE_POINT_RATE=FALSE ! /NORMALIZE_DATA=FALSE ! /NORMALIZE_POINTS=101 ! /EXPORT_MEAN_AND_STD_DEV=FALSE ! /USE_P2D_FORMAT=FALSE ; \\ Exporting the position and orientation of segment RFT as an ORIGIN and ROTATION matrix. Visual3D exports the following rotation matrix [[Visual3D:Documentation:Kinematics_and_Kinetics:Six_Degrees_of_Freedom#6_DOF_Tracking|[ XYZ local ] = [R2] [XYZ global]]] \\ [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File|Export_Data_To_ASCII_File]] ! /FILE_NAME= /SIGNAL_TYPES=FRAME_NUMBERS+LINK_MODEL_BASED+LINK_MODEL_BASED /SIGNAL_NAMES=TIME+ORIGIN+ROTATION /SIGNAL_FOLDER=ORIGINAL+RFT+RFT ! /START_LABEL= ! /END_LABEL= ! /USE_POINT_RATE=FALSE ! /NORMALIZE_DATA=FALSE ! /NORMALIZE_POINTS=101 ! /EXPORT_MEAN_AND_STD_DEV=FALSE ! /USE_P2D_FORMAT=FALSE ; === 6 DOF ASCII FORMAT === This example file contains the ORIGIN and ROTATION matrix for the [[Visual3D:Documentation:Modeling:Segments:Segment_Overview#Default_Segment_Names|RSK segment]] at the first 5 frames of data. Note that the elements are TAB delimited. | |c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d| | |ORIGIN |ORIGIN |ORIGIN |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION | | |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC |KINETIC_KINEMATIC | | |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK | |ITEM|X |Y |Z |0 |1 |2 |3 |4 |5 |6 |7 |8 | |1 |0.37046 |0.00863 |0.40545 |0.96567 |0.21640 |-0.14375 |-0.24416 |0.56693 |-0.78675 |-0.08876 |0.79483 |0.60030 | |2 |0.35441 |0.05135 |0.41706 |0.97954 |0.19208 |-0.05999 |-0.16101 |0.56933 |-0.80619 |-0.12070 |0.79935 |0.58861 | |3 |0.35060 |0.08595 |0.43204 |0.99376 |0.11142 |0.00542 |-0.06290 |0.59975 |-0.79771 |-0.09213 |0.79239 |0.60301 | |4 |0.35067 |0.11824 |0.44677 |0.99773 |0.06720 |0.00507 |-0.03870 |0.63296 |-0.77322 |-0.05516 |0.77126 |0.63412 | |5 |0.35359 |0.14253 |0.46174 |0.99978 |0.01001 |0.01839 |0.00611 |0.70059 |-0.71353 |-0.02002 |0.71349 |0.70038 | Or in the following format > | |c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d|c:\Data\mvc002.c3d| | |ORIGIN |ORIGIN |ORIGIN |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION |ROTATION | | |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED |LINK_MODEL_BASED | | | | | |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK |LSK | |ITEM|X |Y |Z |0 |1 |2 |3 |4 |5 |6 |7 |8 | |1 |0.37046 |0.00863 |0.40545 |0.96567 |0.21640 |-0.14375 |-0.24416 |0.56693 |-0.78675 |-0.08876 |0.79483 |0.60030 | |2 |0.35441 |0.05135 |0.41706 |0.97954 |0.19208 |-0.05999 |-0.16101 |0.56933 |-0.80619 |-0.12070 |0.79935 |0.58861 | |3 |0.35060 |0.08595 |0.43204 |0.99376 |0.11142 |0.00542 |-0.06290 |0.59975 |-0.79771 |-0.09213 |0.79239 |0.60301 | |4 |0.35067 |0.11824 |0.44677 |0.99773 |0.06720 |0.00507 |-0.03870 |0.63296 |-0.77322 |-0.05516 |0.77126 |0.63412 | |5 |0.35359 |0.14253 |0.46174 |0.99978 |0.01001 |0.01839 |0.00611 |0.70059 |-0.71353 |-0.02002 |0.71349 |0.70038 | ==== Other ASCII Formats ==== The following ASCII commands read slightly different flavors of ASCII signals. The names are derived from the customers that have requested the importer. If C-Motion provided you with information on the command, you can make the call using the command name you were givin; even though you may not see the command listed in the pipeline. \\ **Import_Frappier_Analog_Signals**\\ **Import_NTNU_AnalogSignals**\\ **Import_Cresswell_AnalogSignals**\\ **Import_Natick_AnalogSignals** \\ This command was written for Frappier Acceleration products but has been modified to accomodate many different flavors of ASCII files from our customers. The command has several aliases as you can see from the list. As of Visual3D Version 3.20, all of these commands are hidden in the pipeline, until we have a convenient way in our licensing scheme to make it visible only to a specific user with a specific name. Each command is slightly different, but the differences are recognized automatically. This may not alway be the case, so we have given each lab their own command name, that would allow us to modify the processing if necesary. The name of the ASCII file containing the ANALOG signals is expected to have the same name as the C3D file; eg. trial1.c3d and trial1.anc The basic format of the file is: \\ |File_Type: |Analog | | | | | | |Board_Type:|PCI-MIO-64E| | | | | | |Trial_Name:|Test |#Channels:|6 | | | | |Name |Fx1 |Fy1 |Fz1 |Mx1 |My1 |Mz1 | |Rate |1000 |1000 |1000|1000|1000|1000| |0.000 |1003 |997 |1009|1009|1006|1023| |0.001 |1003 |997 |1009|1009|1006|1023| [[ ==== Example ==== Specifying a ROOT FOLDER and a list of subject folders. Each subject folder contains a set of C3D files. For example, Subject1 Trial16.c3d Subject2 Trial16.c3d Subject3 Trial16.c3d And so on ... Open each C3D file and export a signal to a filename whose prefix is the same as the C3D file.