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/06/19 12:50] sgrangervisual3d:documentation:pipeline:file_commands:export_data_to_ascii_file [2024/11/15 16:55] (current) sgranger
Line 1: Line 1:
-{{{{{{{{{{{{{{note: this command requires the active files (to pull data from) be set first.+===== Export Data To ASCII File =====
  
-the visual3d pipeline command export data to ascii file exports ascii data to one of 2 formatted data files (visual3d default and p2d).+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.
  
-===== reserved signal names =====+**NOTE**: This command pulls data from the [[visual3d:documentation:definitions:active_files|active files]] in the workspace. Make 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.
  
-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.+==== Pipeline Command ====
  
-===== normalization =====+|**Export_Data_To_Ascii_File**              |                                                                                                                                                  | 
 +|/FILE_NAME=C:\demo files\Example1\test.txt |The filename (Including path) for the exported data                                                                                               | 
 +|/SIGNAL_TYPES=ANALOG                       |Signal Type                                                                                                                                       | 
 +|! /SIGNAL_FOLDER=ORIGINAL                  |Signal Folder                                                                                                                                     | 
 +|/SIGNAL_NAMES=EMG8                         |Signal Names                                                                                                                                      | 
 +|! /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                                                                                                  | 
 +|! /EXPORT_MEAN_AND_STD_DEV_FOR_METRIC=FALSE|Option to Export the Mean and Standard Deviation for Metric signals                                                                               | 
 +|! /USE_P2D_FORMAT=FALSE                    |See the Description of P2D Files in the documentation.                                                                                            | 
 +|! /USE_XML_FORMAT=FALSE                    |                                                                                                                                                  | 
 +|! /USE_JSON_FORMAT=FALSE                   |See the description on [[Visual3D:Documentation:Visual_3D_Formating:JSON_Formats|JSON Formats]] in the documentation.                             | 
 +|! /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.                          | 
 +|! /EXPORT_NAN=FALSE                        |export NAN to represent NO_DATA                                                                                                                   | 
 +|! /USE_SCIENTIFIC_NOTATION=FALSE                                                                                                                                                            | 
 +|**;**                                      |                                                                                                                                                  |
  
-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.+==== 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.
  
-===== pipeline command =====+{{:exportascii.png}}
  
-the command parameter details follow: +==== Important Notes ====
- +
-|**export_data_to_ascii_file**              |                                                                                                                                                  | +
-|/file_name=c:\demo files\example1\test.txt |the filename (including path) for the exported data                                                                                               | +
-|/signal_types=analog                       |signal type                                                                                                                                       | +
-|! /signal_folder=original                  |signal folder                                                                                                                                     | +
-|/signal_names=emg8                         |signal names                                                                                                                                      | +
-|! /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                                                                                                  | +
-|! /export_mean_and_std_dev_for_metric=false|option to export the mean and standard deviation for metric signals                                                                               | +
-|! /use_p2d_format=false                    |see the description of p2d files in the documentation.                                                                                            | +
-|! /use_xml_format=false                    |                                                                                                                                                  | +
-|! /use_json_format=false                   |see the description on [[visual3d:documentation:visual_3d_formating:json_formats|json formats]] in the documentation.                             | +
-|! /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.                          | +
-|! /export_nan=false                        |export nan to represent no_data                                                                                                                   | +
-|! /use_scientific_notation=false                                                                                                                                                            | +
-|**;**                                      |                                                                                                                                                  |+
  
-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.+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.
  
-exportascii.png+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.
  
-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>
-!prompt for the folder  +!Prompt for the folder  
-set_pipeline_parameter_to_folder_path +Set_Pipeline_Parameter_To_Folder_Path 
-/parameter_name=folder +/PARAMETER_NAME=FOLDER 
-/parameter_value=+/PARAMETER_VALUE=
  
  
-get the list of files from the workspace and do not retain the path name for each file  +Get the list of files from the workspace and do not retain the path name for each file  
-set_pipeline_parameter_to_list_of_tagged_files +Set_Pipeline_Parameter_To_List_Of_Tagged_Files 
-/parameter_name=files +/PARAMETER_NAME=FILES 
-/tag_name=all_files +/TAG_NAME=ALL_FILES 
-! /get_current_selected_files=false +! /GET_CURRENT_SELECTED_FILES=FALSE 
-/use_short_filenames=true+/USE_SHORT_FILENAMES=TRUE
  
  
-loop through the files and export the data +Loop through the files and export the data 
-for_each +For_Each 
-/iteration_parameter_name=index +/ITERATION_PARAMETER_NAME=INDEX 
-/items=::files+/ITEMS=::FILES
  
  
-  select_active_file  +  Select_Active_File  
-  /file_name=*&::index  +  /FILE_NAME=*&::INDEX  
-  ! /query+  ! /QUERY
   ;   ;
  
-  export_data_to_ascii_file  +  Export_Data_To_Ascii_File  
-  /file_name=::folder&::index&.txt  +  /FILE_NAME=::FOLDER&::INDEX&.txt  
-  /signal_types=link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based  +  /SIGNAL_TYPES=LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED  
-  /signal_names=rknee_angle+rknee_moment+rknee_moment+rhip_angle+rhip_moment+rhip_moment+rankle_angle+rankle_moment  +  /SIGNAL_NAMES=RKNEE_ANGLE+RKNEE_MOMENT+RKNEE_MOMENT+RHIP_ANGLE+RHIP_MOMENT+RHIP_MOMENT+RANKLE_ANGLE+RANKLE_MOMENT  
-  /signal_folder=processed  +  /SIGNAL_FOLDER=PROCESSED  
-  /signal_components=x,x,x,x,x,x,x, +  /SIGNAL_COMPONENTS=X,X,X,X,X,X,X, 
-  ! /start_label=  +  ! /START_LABEL=  
-  ! /end_label=  +  ! /END_LABEL=  
-  /event_sequence=ron+roff  +  /Event_Sequence=RON+ROFF  
-  ! /exclude_events=  +  ! /Exclude_Events=  
-  ! /use_point_rate=false  +  ! /USE_POINT_RATE=FALSE  
-  /normalize_data=true  +  /NORMALIZE_DATA=TRUE  
-  ! /normalize_points=101  +  ! /NORMALIZE_POINTS=101  
-  ! /export_mean_and_std_dev=false  +  ! /EXPORT_MEAN_AND_STD_DEV=FALSE  
-  ! /use_p2d_format=false +  ! /USE_P2D_FORMAT=FALSE 
   ;    ; 
  
-end_for_each  +End_For_Each  
-/iteration_parameter_name=index+/ITERATION_PARAMETER_NAME=INDEX
 ; ;
 </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>
-prompt the user for the folder  +Prompt the user for the folder  
-set_pipeline_parameter_to_folder_path  +Set_Pipeline_Parameter_To_Folder_Path  
-/parameter_name=folder  +/PARAMETER_NAME=FOLDER  
-/parameter_value+/PARAMETER_VALUE
  
  
-get the list of files from the workspace and do not retain the path name for each file  +Get the list of files from the workspace and do not retain the path name for each file  
-set_pipeline_parameter_to_list_of_tagged_files +Set_Pipeline_Parameter_To_List_Of_Tagged_Files 
-/parameter_name=files +/PARAMETER_NAME=FILES 
-/tag_name=all_files +/TAG_NAME=ALL_FILES 
-! /get_current_selected_files=false  +! /GET_CURRENT_SELECTED_FILES=FALSE  
-/use_short_filenames=true +/USE_SHORT_FILENAMES=TRUE 
  
  
-loop through the files and export the data +Loop through the files and export the data 
-for_each +For_Each 
-/iteration_parameter_name=index +/ITERATION_PARAMETER_NAME=INDEX 
-/items=::files+/ITEMS=::FILES
  
  
-  ! set a pipeline parameter new_index that searcher and replaces the filename with *.c3d to *.txt +  ! Set a pipeline parameter NEW_INDEX that searcher and replaces the filename with *.c3d to *.txt 
-  set_pipeline_parameter  +  Set_Pipeline_Parameter  
-  /parameter_name=new_index  +  /PARAMETER_NAME=NEW_INDEX  
-  /parameter_value=::index  +  /PARAMETER_VALUE=::INDEX  
-  /parameter_value_search_for=.c3d  +  /PARAMETER_VALUE_SEARCH_FOR=.c3d  
-  /parameter_value_replace_with=.txt  +  /PARAMETER_VALUE_REPLACE_WITH=.txt  
-  ! /parameter_value_prefix=  +  ! /PARAMETER_VALUE_PREFIX=  
-  ! /parameter_value_append+  ! /PARAMETER_VALUE_APPEND
   ;   ;
  
-  select_active_file  +  Select_Active_File  
-  /file_name=*&::index  +  /FILE_NAME=*&::INDEX  
-  ! /query=+  ! /QUERY=
   ;   ;
  
-  ! export to ascii with the filename new_index +  ! Export to ASCII with the filename NEW_INDEX 
-  ! the output is between ron and roff and is normalized to 101 points +  ! The output is between RON and ROFF and is normalized to 101 points 
-  export_data_to_ascii_file  +  Export_Data_To_Ascii_File  
-  /file_name=::folder&::new_index  +  /FILE_NAME=::FOLDER&::NEW_INDEX  
-  /signal_types=link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based+link_model_based  +  /SIGNAL_TYPES=LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED+LINK_MODEL_BASED  
-  /signal_names=rknee_angle+rknee_moment+rknee_moment+rhip_angle+rhip_moment+rhip_moment+rankle_angle+rankle_moment  +  /SIGNAL_NAMES=RKNEE_ANGLE+RKNEE_MOMENT+RKNEE_MOMENT+RHIP_ANGLE+RHIP_MOMENT+RHIP_MOMENT+RANKLE_ANGLE+RANKLE_MOMENT  
-  /signal_folder=processed  +  /SIGNAL_FOLDER=PROCESSED  
-  /signal_components=x,x,x,x,x,x,x, +  /SIGNAL_COMPONENTS=X,X,X,X,X,X,X, 
-  ! /start_label=  +  ! /START_LABEL=  
-  ! /end_label=  +  ! /END_LABEL=  
-  /event_sequence=ron+roff  +  /EVENT_SEQUENCE=RON+ROFF  
-  ! /exclude_events=  +  ! /EXCLUDE_EVENTS=  
-  ! /use_point_rate=false  +  ! /USE_POINT_RATE=FALSE  
-  /normalize_data=true  +  /NORMALIZE_DATA=TRUE  
-  ! /normalize_points=101  +  ! /NORMALIZE_POINTS=101  
-  ! /export_mean_and_std_dev=false  +  ! /EXPORT_MEAN_AND_STD_DEV=FALSE  
-  ! /use_p2d_format=false +  ! /USE_P2D_FORMAT=FALSE 
   ;    ; 
  
-end_for_each +End_For_Each 
-/iteration_parameter_name=index+/ITERATION_PARAMETER_NAME=INDEX
 ; ;
 </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>
-export ascii data for all ranges of rhsthe output is normalized. +Export ASCII data for all ranges of RHSThe output is normalized. 
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-/file_name+/FILE_NAME
-/signal_types=link_model_based +/SIGNAL_TYPES=LINK_MODEL_BASED 
-/signal_names=thoraxseg+pelvisseg +/SIGNAL_NAMES=ThoraxSeg+PelvisSeg 
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-! /signal_components+! /SIGNAL_COMPONENTS
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-/event_sequence=rhs+rhs +/Event_Sequence=RHS+RHS 
-! /exclude_events+! /Exclude_Events
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-/normalize_data=true +/NORMALIZE_DATA=TRUE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
 </code> </code>
  
-=== option 2: subset of selected range (workaround) ===+== Option 2: Subset of selected range (workaround) ==
  
-it isn't possible to directly export a subset of these ranges, so the following work around can be used.+It isn't possible to directly export a subset of these ranges, so the following work around can be used.
  
-  * first, set a start and stop event before and after the ranges that should be exported. this can be done manually because it doesn't need to be precise. +  * First, set a START and STOP event before and after the ranges that should be exported. This can be done manually because it doesn't need to be precise. 
-  * second, create events within the ranges from start to stop +  * Second, create events within the ranges from START to STOP 
-  * third, modify the event_sequence to include the export event and add an [[visual3d:documentation:c3d_signal_types:event_label_data_type#exclude_event|exclude_event]] to ignore the last range+  * Third, modify the Event_Sequence to include the EXPORT event and add an [[Visual3D:Documentation:C3D_Signal_Types:EVENT_LABEL_Data_Type#Exclude_Event|Exclude_Event]] to ignore the last range
  
 <code> <code>
-this script assumes that a start and stop event have already been created+This script assumes that a START and STOP event have already been created
  
-create an event called export which is a copy of the rhs event that is between +Create an event called EXPORT which is a copy of the RHS event that is between 
-start and stop and offset by 2 frames  +START and STOP and offset by 2 frames  
-event_copy +Event_Copy 
-/event_name=rhs +/EVENT_NAME=RHS 
-/new_event_name=export +/NEW_EVENT_NAME=EXPORT 
-/frame_offset=2 +/FRAME_OFFSET=2 
-! /event_instance=0 +! /EVENT_INSTANCE=0 
-! /range_instance=0 +! /RANGE_INSTANCE=0 
-/event_sequence=start+stop +/EVENT_SEQUENCE=START+STOP 
-! /exclude_events+! /EXCLUDE_EVENTS
-! /start_at_event+! /START_AT_EVENT
-! /end_at_event=+! /END_AT_EVENT=
 ; ;
  
-modify the event+sequence to include the export event and add stop to +Modify the Event+Sequence to include the EXPORT event and add STOP to 
-exclude_event to ignore the last range +Exclude_Event to ignore the last range 
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-/file_name+/FILE_NAME
-/signal_types=link_model_based +/SIGNAL_TYPES=LINK_MODEL_BASED 
-/signal_names=thoraxseg+pelvisseg +/SIGNAL_NAMES=ThoraxSeg+PelvisSeg 
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-! /signal_components+! /SIGNAL_COMPONENTS
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-/event_sequence=rhs+export+rhs +/Event_Sequence=RHS+EXPORT+RHS 
-! /exclude_events=stop +! /Exclude_Events=STOP 
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-/normalize_data=true +/NORMALIZE_DATA=TRUE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
 </code> </code>
  
-==== example 4: export model metric from several cmo files ====+=== Example 4: Export MODEL metric from several CMX files ===
  
-given a set of cmo files, open each cmo file and export one or more metrics from the modelin 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 MODELIn 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 filesin this case sub folders will+Prompt the user for the Folder containing the CMZfilesIn 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 
-/parameter_name=folder +/PARAMETER_NAME=FOLDER 
-/parameter_value=+/PARAMETER_VALUE=
 ; ;
  
-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
-! /parameter_value_append=+! /PARAMETER_VALUE_APPEND=
 ; ;
  
-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 
-/expression=model::segment::rpv::mass +/EXPRESSION=MODEL::SEGMENT::RPV::MASS 
-/result_name=global::pelvis_mass +/RESULT_NAME=GLOBAL::PELVIS_MASS 
-/result_type=metric +/RESULT_TYPE=METRIC 
-/result_folder=export+/RESULT_FOLDER=EXPORT
 ; ;
  
-add any other pipeline commands here +Add any other pipeline commands here 
-make the global workspace active, so we can export a global signal +Make the GLOBAL Workspace active, so we can export a GLOBAL signal 
-select_active_file +Select_Active_File 
-/file_name=global +/FILE_NAME=GLOBAL 
-! /query=+! /QUERY=
 ; ;
  
-export the signal +Export the signal 
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-/file_name=::txt_file +/FILE_NAME=::TXT_FILE 
-/signal_types=metric +/SIGNAL_TYPES=METRIC 
-/signal_names=pelvis_mass +/SIGNAL_NAMES=PELVIS_MASS 
-/signal_folder=export +/SIGNAL_FOLDER=EXPORT 
-! /signal_components+! /SIGNAL_COMPONENTS
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-! /event_sequence+! /EVENT_SEQUENCE
-! /exclude_events+! /EXCLUDE_EVENTS
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-! /normalize_data=false +! /NORMALIZE_DATA=FALSE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
  
-clear the workspace in preparation for the next cmo file. +Clear the workspace in preparation for the next CMZ file. 
-file_new+File_New
 ; ;
  
-end_for_each +End_For_Each 
-/iteration_parameter_name=index+/ITERATION_PARAMETER_NAME=INDEX
 ; ;
 </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 lhs1lhs2lhs3rhs1rhs2 and were created using the number_events_sequentially.v3m meta-command.+This example will export all Event occurrences in terms of frame numbers to ASCIIIn this example the events are labeled LHS1LHS2LHS3RHS1RHS2 and were created using the Number_Events_Sequentially.v3m meta-command.
  
 <code> <code>
-get the names of all files in the workspace +Get the names of all files in the workspace 
-set_pipeline_parameter_to_list_of_tagged_files +Set_Pipeline_Parameter_To_List_Of_Tagged_Files 
-/parameter_name=files +/PARAMETER_NAME=FILES 
-/tag_name=all_files +/TAG_NAME=ALL_FILES 
-! /get_current_selected_files=false +! /GET_CURRENT_SELECTED_FILES=false 
-! /use_short_filenames=false+! /USE_SHORT_FILENAMES=false
 ; ;
  
-loop through each file +Loop through each file 
-for_each +For_Each 
-/iteration_parameter_name=file +/ITERATION_PARAMETER_NAME=FILE 
-/items=::files+/ITEMS=::FILES
 ; ;
  
-create a pipeline parameter containing the name of the c3d file+Create a pipeline parameter containing the name of the c3d file
 ! but replace the extension .c3d with the extension .txt which ! but replace the extension .c3d 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=::file +/PARAMETER_VALUE=::FILE 
-/parameter_value_search_for=.c3d +/PARAMETER_VALUE_SEARCH_FOR=.c3d 
-/parameter_value_replace_with=.txt +/PARAMETER_VALUE_REPLACE_WITH=.txt 
-! /parameter_value_prefix+! /PARAMETER_VALUE_PREFIX
-! /parameter_value_append=+! /PARAMETER_VALUE_APPEND=
 ; ;
  
-select active file +Select active file 
-select_active_file  +Select_Active_File  
-/file_name=::file +/FILE_NAME=::FILE 
-! /query+! /QUERY
 ; ;
  
-loop to convert events from time to frames for 4 hs reps +Loop to convert events from time to frames for 4 HS reps 
-for_each +For_Each 
-/iteration_parameter_name=index +/ITERATION_PARAMETER_NAME=INDEX 
-/items=lhs1+lhs2+lhs3+rhs1+rhs2+/ITEMS=LHS1+LHS2+LHS3+RHS1+RHS2
 ; ;
  
-expression to convert events wrt frames +Expression to convert events wrt frames 
-evaluate_expression  +Evaluate_Expression  
-/expression=event_label::original&:&:&::index&*parameters::point::rate+1 +/EXPRESSION=EVENT_LABEL::ORIGINAL&:&:&::INDEX&*PARAMETERS::POINT::RATE+1 
-/result_name=::index  +/RESULT_NAME=::INDEX  
-/result_type=metric +/RESULT_TYPE=METRIC 
-/result_folder=event_export +/RESULT_FOLDER=EVENT_EXPORT 
 ; ;
  
-end_for_each +End_For_Each 
-/iteration_parameter_name=index+/ITERATION_PARAMETER_NAME=INDEX
 ; ;
  
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-/file_name=::txt_file +/FILE_NAME=::TXT_FILE 
-/signal_types=metric +/SIGNAL_TYPES=METRIC 
-! /signal_names+! /SIGNAL_NAMES
-/signal_folder=event_export +/SIGNAL_FOLDER=EVENT_EXPORT 
-! /signal_components+! /SIGNAL_COMPONENTS
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-! /event_sequence+! /EVENT_SEQUENCE
-! /exclude_events+! /EXCLUDE_EVENTS
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-! /normalize_data=false +! /NORMALIZE_DATA=FALSE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
  
-end_for_each +End_For_Each 
-/iteration_parameter_name=file+/ITERATION_PARAMETER_NAME=FILE
 ; ;
 </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.
  
-consider a metric signal created as follows:+Consider a metric signal created as follows: 
 + 
 +{{:ExportMetric1.jpg}}
  
-exportmetric1.jpg 
 <code> <code>
-metric_signal_value_at_event +Metric_Signal_Value_At_Event 
-/result_metric_name=rknee_angle_at_ron +/RESULT_METRIC_NAME=RKNEE_ANGLE_AT_RON 
-! /result_metric_folder=processed +! /RESULT_METRIC_FOLDER=PROCESSED 
-/signal_types=link_model_based +/SIGNAL_TYPES=LINK_MODEL_BASED 
-/signal_names=rknee_angle +/SIGNAL_NAMES=RKNEE_ANGLE 
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-/event_name=ron +/EVENT_NAME=RON 
-/generate_mean_and_stddev=false +/GENERATE_MEAN_AND_STDDEV=FALSE 
-! /append_to_existing_values=false +! /APPEND_TO_EXISTING_VALUES=FALSE 
-! /generate_vector_length_metric=false +! /GENERATE_VECTOR_LENGTH_METRIC=FALSE 
-! /retain_no_data_values=false+! /RETAIN_NO_DATA_VALUES=FALSE
 ; ;
 </code> </code>
  
-in the test file used for this example, this resulted in a metric with two metric values for two signals.+In the test file used for this example, this resulted in a metric with two metric values for two signals.
  
-exportmetric2.jpg +{{:ExportMetric2.jpg}} 
-if the signal were exported as follows:+If the signal were exported as follows:
  
-exportmetric3.jpg+{{:ExportMetric3.jpg}}
 <code> <code>
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-! /file_name+! /FILE_NAME
-/signal_types=metric +/SIGNAL_TYPES=METRIC 
-/signal_names=rknee_angle_at_ron+rknee_angle_at_ron+rknee_angle_at_ron +/SIGNAL_NAMES=RKNEE_ANGLE_AT_RON+RKNEE_ANGLE_AT_RON+RKNEE_ANGLE_AT_RON 
-/signal_folder=processed +/SIGNAL_FOLDER=PROCESSED 
-/signal_components=x,y,z +/SIGNAL_COMPONENTS=X,Y,Z 
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-/event_sequence=, ,  +/EVENT_SEQUENCE=, ,  
-/exclude_events=, ,  +/EXCLUDE_EVENTS=, ,  
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-! /normalize_data=false +! /NORMALIZE_DATA=FALSE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
 </code> </code>
  
-the resulting file would contain 6 columns of data (3 for each file).+The resulting file would contain 6 columns of data (3 for each file).
  
-exportmetric4.jpg+{{:ExportMetric4.jpg}}
  
-the signals could be concatenated using the following pipeline:+The signals could be concatenated using the following pipeline:
  
 <code> <code>
-select_active_file +Select_Active_File 
-/file_name=all_files +/FILE_NAME=ALL_FILES 
-! /query=+! /QUERY=
 ; ;
  
-metric_signal_value_at_event +Metric_Signal_Value_At_Event 
-/result_metric_name=rknee_angle_at_ron +/RESULT_METRIC_NAME=RKnee_Angle_at_RON 
-! /result_metric_folder=processed +! /RESULT_METRIC_FOLDER=PROCESSED 
-/signal_types=link_model_based +/SIGNAL_TYPES=LINK_MODEL_BASED 
-/signal_names=rkneeangle +/SIGNAL_NAMES=RKneeAngle 
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-/event_name=ron +/EVENT_NAME=RON 
-/generate_mean_and_stddev=false +/GENERATE_MEAN_AND_STDDEV=FALSE 
-! /append_to_existing_values=false +! /APPEND_TO_EXISTING_VALUES=FALSE 
-! /generate_vector_length_metric=false +! /GENERATE_VECTOR_LENGTH_METRIC=FALSE 
-! /retain_no_data_values=false+! /RETAIN_NO_DATA_VALUES=FALSE
 ; ;
  
-merge_data +Merge_Data 
-/signal_types=metric +/SIGNAL_TYPES=METRIC 
-/signal_folder=for_export+processed +/SIGNAL_FOLDER=For_Export+PROCESSED 
-/signal_names=global::rknee_angle_at_ron+rknee_angle_at_ron +/SIGNAL_NAMES=GLOBAL::RKnee_Angle_at_RON+RKnee_Angle_at_RON 
-! /component_sequence+! /COMPONENT_SEQUENCE
-/result_types=metric +/RESULT_TYPES=METRIC 
-/result_folders=for_export +/RESULT_FOLDERS=For_Export 
-/result_name=global::rknee_angle_at_ron +/RESULT_NAME=GLOBAL::RKnee_Angle_at_RON 
-! /merge_type=append_to_end +! /MERGE_TYPE=APPEND_TO_END 
-/ignore_missing_signals=false +/IGNORE_MISSING_SIGNALS=FALSE 
-/pre_clear_result_signal=true+/PRE_CLEAR_RESULT_SIGNAL=TRUE
 ; ;
  
-select_active_file +Select_Active_File 
-/file_name=global +/FILE_NAME=GLOBAL 
-! /query=+! /QUERY=
 ; ;
  
-export_data_to_ascii_file +Export_Data_To_Ascii_File 
-! /file_name+! /FILE_NAME
-/signal_types=metric +/SIGNAL_TYPES=METRIC 
-/signal_names=rknee_angle_at_ron +/SIGNAL_NAMES=RKnee_Angle_at_RON 
-/signal_folder=for_export +/SIGNAL_FOLDER=FOR_EXPORT 
-! /signal_components+! /SIGNAL_COMPONENTS
-! /start_label+! /START_LABEL
-! /end_label+! /END_LABEL
-! /event_sequence+! /EVENT_SEQUENCE
-! /exclude_events+! /EXCLUDE_EVENTS
-! /use_point_rate=false +! /USE_POINT_RATE=FALSE 
-! /normalize_data=false +! /NORMALIZE_DATA=FALSE 
-! /normalize_points=101 +! /NORMALIZE_POINTS=101 
-! /export_mean_and_std_dev=false +! /EXPORT_MEAN_AND_STD_DEV=FALSE 
-! /use_p2d_format=false +! /USE_P2D_FORMAT=FALSE 
-! /use_short_filename=false+! /USE_SHORT_FILENAME=FALSE
 ; ;
 </code> </code>
  
-the last command of the above script will export to asciithe image below will show how it looks in the export_to_ascii_file command.+The last command of the above script will export to ASCIIThe image below will show how it looks in the Export_to_ASCII_file command. 
 + 
 +{{:ExportMetric5.jpg}} \\ 
 +The resulting output file contains:
  
-exportmetric5.jpg +{{:ExportMetric6.jpg}} \\ 
-the resulting output file contains:+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.
  
-exportmetric6.jpg +[[Visual3D:Documentation:Pipeline:General_Information:Pipeline_Commands_Reference|Back to Pipeline Commands Reference]]
-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.+
  
-\\ 
-[[visual3d:documentation:pipeline:general_information:pipeline_commands_reference|back to pipeline commands reference]] 
  
  
-}}}}}}}}}}}}}} 
visual3d/documentation/pipeline/file_commands/export_data_to_ascii_file.1718801409.txt.gz · Last modified: 2024/06/19 12:50 by sgranger