User Tools

Site Tools


visual3d:documentation:pipeline:file_commands:export_data_to_ascii_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:pipeline:file_commands:export_data_to_ascii_file [2024/07/17 15:22] sgrangervisual3d:documentation:pipeline:file_commands:export_data_to_ascii_file [2024/11/15 16:55] (current) sgranger
Line 1: Line 1:
-====== Export Data To ASCII File ======+===== Export Data To ASCII File =====
  
-NOTE: This command requires the active files (to pull data frombe set first.+This pipeline command converts data from the [[visual3d:documentation:visual3d_signal_types:data_tree|Data Tree]] into ASCII (plain text) data in one of 2 formatted data files ([[visual3d:documentation:definitions:file_formats:visual3d_ascii_format|Visual3D ASCII]] and [[visual3d:documentation:definitions:file_formats:p2d_format|P2D]]and saves the result to disk.
  
-The Visual3D pipeline command Export Data To ASCII File exports ASCII data to one of 2 formatted data files (Visual3D default and P2D). +**NOTE**: This command pulls data from the [[visual3d:documentation:definitions:active_files|active files]] in the workspaceMake sure you have set the correct files to be active using the graphical interface or the [[visual3d:documentation:pipeline:file_commands:select_active_file|Select_Active_File]] pipeline command.
- +
-==== Reserved Signal Names ==== +
- +
-Visual3D reserves the signal names ORIGIN, ROTATION and QUATERNION for exporting the pose of a segmentDo not use these names for any signal definition other than the RESERVED intention. +
- +
-==== Normalization ==== +
- +
-Data can be exported to a normalized ASCII output. The user can select the number of points to output (i.e. 51 points or 101 points). If Normalization is selected in the command by setting the parameter **/NORMALIZE_DATA= TRUE**, the signal is interpolated using cubic spline.+
  
 ==== Pipeline Command ==== ==== Pipeline Command ====
- 
-The command parameter details follow: 
  
 |**Export_Data_To_Ascii_File**              |                                                                                                                                                  | |**Export_Data_To_Ascii_File**              |                                                                                                                                                  |
-|/FILE_NAME=C:\demo files\Example1\test.txt |The filename (Including Path) for the exported data                                                                                               |+|/FILE_NAME=C:\demo files\Example1\test.txt |The filename (Including path) for the exported data                                                                                               |
 |/SIGNAL_TYPES=ANALOG                       |Signal Type                                                                                                                                       | |/SIGNAL_TYPES=ANALOG                       |Signal Type                                                                                                                                       |
 |! /SIGNAL_FOLDER=ORIGINAL                  |Signal Folder                                                                                                                                     | |! /SIGNAL_FOLDER=ORIGINAL                  |Signal Folder                                                                                                                                     |
Line 44: Line 34:
 |**;**                                      |                                                                                                                                                  | |**;**                                      |                                                                                                                                                  |
  
 +==== Dialog ====
 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. 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}} {{:exportascii.png}}
 +
 +==== Important Notes ====
 +
 +Visual3D reserves the signal names ORIGIN, ROTATION and QUATERNION for exporting the pose of a segment. Do not use these names for any signal definition other than the RESERVED intention.
 +
 +If you choose to normalize the data for the ASCII output, by setting the parameter **/NORMALIZE_DATA= TRUE**, then the number of points to output is specified by the **/NORMALIZE_POINTS** parameter (with a default of 101 points) and the signal will be interpolated using a cubic spline.
  
 ==== Examples ==== ==== Examples ====
  
-We have listed a few examples for your review.+We have listed a few examples of how this pipeline command can be used.
  
-=== Example 1: File Export of multiple files ===+=== Example 1: Exporting multiple files ===
  
 Using [[#Export_Data_to_ASCII_File|Export_Data_to_ASCII_File]] to export data from individual C3D files to unique text files. Using [[#Export_Data_to_ASCII_File|Export_Data_to_ASCII_File]] to export data from individual C3D files to unique text files.
Line 58: Line 55:
 Assuming: Assuming:
  
-  - the cmo file is already open+  - the CMZ file is already open
   - you want to export data from each C3D file to a txt of the same name (or prefix).   - you want to export data from each C3D file to a txt of the same name (or prefix).
   - you want to be prompted to select the FOLDER for the exported files. (If you want, you can hard code this)   - you want to be prompted to select the FOLDER for the exported files. (If you want, you can hard code this)
  
-The Following Pipeline commands can be saved to a .v3s file.+The following pipeline commands can be saved to a .v3s file.
  
 <code> <code>
Line 112: Line 109:
 </code> </code>
  
-=== Example 2: File Export of multiple files ===+=== Example 2: Exporting multiple files with extension update ===
  
-In this example, the output filesnames will be changed by concatenating the C3D filename with a .txt extension. This is done with the [[Visual3D:Documentation:Pipeline:Pipeline_Commands:Set_Pipeline_Parameter|Set_Pipeline_Parameter]] command that will search and replace the extension. The exported data in this example is between two events and is normalized.+In this example, the output files' names will be changed by concatenating the C3D filename with a .txt extension. This is done with the [[Visual3D:Documentation:Pipeline:Pipeline_Commands:Set_Pipeline_Parameter|Set_Pipeline_Parameter]] command that will search and replace the extension. The exported data in this example is between two events and is normalized.
  
-The pipline commands are listed below:+The pipeline commands are listed below:
  
 <code> <code>
Line 178: Line 175:
 </code> </code>
  
-=== Example 3 : Export selected ranges ===+=== Example 3 : Export selected ranges from files ===
  
-One can export ASCII data for selected ranges. In this example, there are two options for accomplishing this task.+One can export ASCII data for selected ranges. In this example, there are two options for accomplishing this task.
  
-== Option 1: Selected Range ==+== Option 1: Exporting All Ranges ==
  
-Given a file with many occurrences of the range RHS it is possible to export all ranges using the command.+Given a file with many occurrences of the event sequence RHS+RHS it is possible to export all of these ranges using the command below.
  
 <code> <code>
Line 253: Line 250:
 </code> </code>
  
-=== Example 4: Export a MODEL metric from Several CMO files ===+=== Example 4: Export a MODEL metric from several CMX files ===
  
-Given a set of cmo files, open each cmo file and export one or more METRICS from the MODEL. In this example, the Pelvis segment mass will be exported into an ASCII file with the same name as the cmo file.+Given a set of CMZ files, we will open each CMZ file and export one or more METRICS from the MODEL. In this example, the Pelvis segment'mass will be exported into an ASCII file with the same name as the CMZ file.
  
 <code> <code>
-! Prompt the user for the Folder containing the cmo files. In this case Sub Folders will+! Prompt the user for the Folder containing the CMZfiles. In this case sub-folders will
 ! be searched as well ! be searched as well
 Set_Pipeline_Parameter_To_Folder_Path Set_Pipeline_Parameter_To_Folder_Path
Line 265: Line 262:
 ; ;
  
-! Set Pipeline Parameter to all cmo files in the FOLDER and SUBFOLDERS+! Set Pipeline Parameter to all CMZ files in the FOLDER and SUBFOLDERS
 Set_Pipeline_Parameter_To_List_Of_Files Set_Pipeline_Parameter_To_List_Of_Files
-/PARAMETER_NAME=CMO_FILES+/PARAMETER_NAME=CMZ_FILES
 /FOLDER=::FOLDER /FOLDER=::FOLDER
 /SEARCH_SUBFOLDERS=TRUE /SEARCH_SUBFOLDERS=TRUE
-/FILE_MASK=*.cmo+/FILE_MASK=*.cmz
 ; ;
  
-! Loop over all cmo files+! Loop over all CMZfiles
 For_Each For_Each
 /ITERATION_PARAMETER_NAME=INDEX /ITERATION_PARAMETER_NAME=INDEX
-/ITEMS=::CMO_FILES+/ITEMS=::CMZ_FILES
 ; ;
  
-! Create a pipeline parameter containing the name of the cmo file +! Create a pipeline parameter containing the name of the CMZ file 
-! but replace the extension .cmo with the extension .txt which+! but replace the extension .cmz with the extension .txt which
 ! will be used for the exported file. ! will be used for the exported file.
 Set_Pipeline_Parameter Set_Pipeline_Parameter
 /PARAMETER_NAME=TXT_FILE /PARAMETER_NAME=TXT_FILE
 /PARAMETER_VALUE=::INDEX /PARAMETER_VALUE=::INDEX
-/PARAMETER_VALUE_SEARCH_FOR=.cmo+/PARAMETER_VALUE_SEARCH_FOR=.cmz
 /PARAMETER_VALUE_REPLACE_WITH=.txt /PARAMETER_VALUE_REPLACE_WITH=.txt
 ! /PARAMETER_VALUE_PREFIX= ! /PARAMETER_VALUE_PREFIX=
Line 291: Line 288:
 ; ;
  
-! Open the cmo file+! Open the CMZ file
 File_Open File_Open
 /FILE_NAME=::INDEX /FILE_NAME=::INDEX
 ; ;
  
-! Assuming one model in the cmo file, store the MASS+! Assuming one model in the CMZ file, store the MASS
 ! of the pelvis segment in a signal in the GLOBAL Workspace ! of the pelvis segment in a signal in the GLOBAL Workspace
 Evaluate_Expression Evaluate_Expression
Line 331: Line 328:
 ; ;
  
-! Clear the workspace in preparation for the next cmo file.+! Clear the workspace in preparation for the next CMZ file.
 File_New File_New
 ; ;
Line 340: Line 337:
 </code> </code>
  
-=== Example 5: Export Events ===+=== Example 5: Export Events from Files ===
  
-This example will export Events in frames to ASCII. The Events are labeled LHS1, LHS2, LHS3, RHS1, RHS2 and were created using the Number_Events_Sequentially.v3m meta-command.+This example will export all Event occurrences in terms of frame numbers to ASCII. In this example the events are labeled LHS1, LHS2, LHS3, RHS1, RHS2 and were created using the Number_Events_Sequentially.v3m meta-command.
  
 <code> <code>
Line 418: Line 415:
 </code> </code>
  
-=== Example 6: Export Concatenated Metric Signals ===+=== Example 6: Export Concatenated Signals ===
  
 All signals are exported to separate columns in the exported file. For metric signals (e.g. signals with only one or two entries/frames) this can be inconvenient. It is not possible to concatenate the signals in the command, but it is possible to concatenate the signals explicitly before export. All signals are exported to separate columns in the exported file. For metric signals (e.g. signals with only one or two entries/frames) this can be inconvenient. It is not possible to concatenate the signals in the command, but it is possible to concatenate the signals explicitly before export.
Line 425: Line 422:
  
 {{:ExportMetric1.jpg}} {{:ExportMetric1.jpg}}
 +
 <code> <code>
 Metric_Signal_Value_At_Event Metric_Signal_Value_At_Event
Line 530: Line 528:
 The last command of the above script will export to ASCII. The image below will show how it looks in the Export_to_ASCII_file command. The last command of the above script will export to ASCII. The image below will show how it looks in the Export_to_ASCII_file command.
  
-{{:ExportMetric5.jpg}}+{{:ExportMetric5.jpg}} \\
 The resulting output file contains: The resulting output file contains:
  
-{{:ExportMetric6.jpg}} +{{:ExportMetric6.jpg}} \\ 
-In very old versions of Visual3D (ex. v4), the Merge_Data command did not provide this functionality, so a workaround was required. [[https://www.has-motion.com/download/examples/Concatenate_OLD.v3s|This script]] provides a workaround for very old versions of Visual3D.+In versions of Visual3D prior to version 5, the Merge_Data command did not provide this functionality, so a workaround was required. [[https://www.has-motion.com/download/examples/Concatenate_OLD.v3s|This script]] provides a workaround for very old versions of Visual3D.
  
-\\ 
 [[Visual3D:Documentation:Pipeline:General_Information:Pipeline_Commands_Reference|Back to Pipeline Commands Reference]] [[Visual3D:Documentation:Pipeline:General_Information:Pipeline_Commands_Reference|Back to Pipeline Commands Reference]]
  
  
  
visual3d/documentation/pipeline/file_commands/export_data_to_ascii_file.1721229778.txt.gz · Last modified: 2024/07/17 15:22 by sgranger