+ Reply to Thread
Results 1 to 2 of 2

Thread: External Apps: Curve Radius, Constant Velocity, Knowledge of Results, ...

  1. Join Date
    Nov 2003
    Posts
    3,352

    External Apps: Curve Radius, Constant Velocity, Knowledge of Results, ...

    Here is MovALyzeR Export File of Experiment AFD containing an External App for Curvature,m Curve Radius, and Angular Velocity: AFD.MEF.

    To test: Download and import (File >Import) the file into MovAlyzeR. Process all trials, double-click a trial, and click the down arrow ta walk through all charts.

    To view the External App: Rightclick Experiment AFD >Properties >Processing >External Apps and view the properties of the CurveRadius.Bat file. It calls the executable CurveRadius.exe (CurveRadius.exe).

    CurveRadius.exe calculates:
    o Curvature (in 1/cm) as a function of time (instead of xJerk)
    o Curve Radius (in cm) as a function of time (instead of yJerk)
    o Angular Velocity (in radians/s) as a function of time (instead of Absolute Jerk)
    for any sampled handwriting movement.

    CurveRadius.exe can also calculate (optional):
    o Surface Of Pie swiped by the radius (in cm2) as a function of time (instead of xJerk)
    o x Evolute (in cm) as a function of time (instead of yJerk)
    o y Evolute (in cm) as a function of time (instead of Absolute Jerk)
    The x and y Evolute are the x and y of the center of the circle touching the handwriting curve.

    EXAMPLE: For a constant-velocity circle, all these curves are constant, except the Surface Of Pie is linearly increasing.

    These calculated curves are written to the processed data Time Function (.TF) file and replaces the xjerk, yjerk, and the absolute jerk

    Inserting the External App in your MovAlyzeR experiment:

    1. Start MovAlyzeR

    2. Rightclick your experiment >Properties >Processing >External Apps Cancel checking that Matlab is installed)

    3. Under TF: Post-Time-Function, Pre-Segmentation:
    -- Select Application=Batch
    -- Edit Script. Insert the contents of Attachment 1540
    This is a generic script where %prg% is a variable referring to CurveRadius.exe including the path to this executable
    %pth% (user's data path), %exp% (experiment), %grp%, %sub%, %con%, %trl% are set by MovAlyzeR
    %sam% is the sampling rate of the data
    %res% is the resolution of the data
    -- Save as CurveRadius
    -- Script=CurveRadius.bat (glitch: Not done automatically)

    4. Save the executable:CurveRadius.exe into this Scripts\ folder of the user's data path (Settings >User> Path)

    5. Reprocess all trials

    6. Double-click on a trial to chart the processed data. Select
    -- X Jerk vs Time
    -- Y Jerk vs Time
    -- Abs Jerk vs Time
    to view these curves including segmentation.

    EXAMPLES
    Movalyzer image files are produced by:
    o Double-click on trial which opens the Processed Data Chart.
    o Rightclick in chart >Export Dialog >Check PNG >Export.
    The default size is 1000 px x 577 px which is on the large side.
    Better sizes are 600 px x 350 px or 360 px x 200 px.
    Dynamic features vary in concert static features:
    o Absolute pen speed varies with Curve Radius.
    o Angular velocity varies with Curvature.

    Ink trace scanned in 256 bits gray scale
    Name:  eul-grayscale.png
Views: 348
Size:  40.1 KB

    Pen movement recorded using a pen tablet and an inking pen. Blue means faster upward. Red means faster downward.
    Name:  eul.png
Views: 383
Size:  39.3 KB

    Absolute Velocity of the pen over the paper (cm/s)
    Name:  eul-AbsoluteVelocity.png
Views: 349
Size:  40.7 KB

    Curve Radius (cm) (Vertical Axis lists Y Jerk)
    Name:  eul-Curvature.png
Views: 341
Size:  38.9 KB

    Curvature (1/cm) (Vertical Axis lists X Jerk)
    Name:  eul-CurveRadius.png
Views: 340
Size:  15.2 KB

    Curvature (1/cm) clipped at 50/cm (Vertical Axis lists Y Jerk)
    Name:  eul-CurveRadius50.png
Views: 322
Size:  35.6 KB

    Angular Velocity (rad/cm) (Vertical Axis lists Absolute Jerk)
    Name:  eul-AngularVelocity.png
Views: 337
Size:  19.4 KB

    Angular Velocity (rad/s) clipped at 100 rad/cm (Vertical Axis lists Absolute Jerk)
    Name:  eul-AngularVelocity100.png
Views: 339
Size:  37.4 KB
    Company http://www.neuroscript.net and work http://www.neuroscript.net/hans_leo_teulings.php on handwriting and drawing movement recording and processing.

  2. Join Date
    Nov 2003
    Posts
    3,352

    External App producing Knowledge Of Results

    Previous posting's MovAlyzeR Export File contains also HWRmod.bat which modifies the raw handwriting data into a Constant Velocity movement.

    The present posting contains, in addition, a "poor-man's" Knowledge of Results (KR) External App. Import this MEF file into MovAlyzeR and run the experiment EEE: EEE.MEF

    View the External app vie Rightclicking Experiment EEE >Properties >Processing >External Apps.
    There you can see that the KR consists of a particular feature extracted from the EXT file of the current trial (only for a particular trial nr).

    The programming environment is called AWK. See awkhelp.txt in the folder eee\scripts.

    Additional executables

    AWK.exe

    Unix/Linux/MSwindows AWK.exe for 32-bit and 64-bit operating systems.
    See http://www.manpagez.com/man/1/awk/

    WaitASecond.exe

    Does just that. The WaitASecond.exe used is not so nice it has a random wait between 0.9 and 1.1 s. There are different alternative solutions if needed. The delay should be less than 5 s because then impatient MovAlyzeR asks whether you need more time.

    Executables and sources compiled using MS Visual Studio 2008

    CurveRadius.bat, .exe, .cpp

    Calculates angular velocity, curvature, curve radius.
    The executable is build it using MS Visual Studio 2008.

    HWRmod.bat, .exe, .cpp

    Resamples an HWR pattern of varying speeds into a constant-speed pattern with the same number of samples.
    The output is written to a HWR file under another condition (specified by Argument 10 in the batch job)
    Output file out.xls (actually a CVS file) shows how the new samples are spaced numerically.

    Batch job implemented in this experiment EEE

    ShowKR.bat

    The source of the batch job is meant to demo several options, including all parameters passed on by MovAlyzeR.
    @echo off
    REM The above statement needs disable to show more

    rem !!!!!!!!!!!!!!!!!!!!!DO NOT CHANGE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    rem Root path of file being processed
    set rootpath=%1

    rem Device name(drive letter) of the file path
    set devicename=%rootpath:~1,2%

    rem Change active directory to c drive, d drive etc
    %devicename%

    rem Extract path to /Scripts folder from File path
    set scriptdir=%rootpath:~1,-13%\\scripts
    cd "%scriptdir%"
    rem !!!!!!!!!!!!!!!!!!!!!END OF DO NOT CHANGE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!

    set prg=%0
    set pth=%1
    set exp=%2
    set grp=%3
    set sub=%4
    set con=%5
    set trl=%6
    set frq=%7
    set res=%8

    rem These are all arguments. There is no Argument9: %9
    rem *****************************END SETTINGS**********************************

    Rem Strip initial zero in %trl%
    set /a trlsearch=%trl%
    set trlshow=2
    set seg=2
    set col=4

    REM Show input arguments and calculated arguments
    REM Program=%0
    REM Datapath=%pth%
    REM Experiment=%exp%
    REM Group=%grp%
    REM Subject%sub%
    REM Condition=%con%
    REM Trial=%trl%
    REM SamplingFrequency=%frq%
    REM Resolution=%res%
    REM TrialSearch=%trlsearch%
    REM TrialShow=%trlshow%
    REM Segment=%seg%
    REM Column=%col%

    echo Show KR when trialsearch=%trlsearch% equals triallshow=%trlshow%
    if "%trlsearch%"=="%trlshow%" goto showkr
    goto end

    :showkr

    echo.
    echo. KR consists of specific lines and columns of the EXT file
    echo ________________________________________
    rem Show Columns 1, 2, %col% of Line 1 and the Line starting with %trlsearch% %seg%
    awk "{if(NR==1)print $1,$2,$%col%}/^%trlsearch% %seg%/{print $1,$2,$%col%}" %pth%\%exp%%grp%%sub%%con%.ext
    echo ________________________________________

    echo.
    WaitASecond.exe
    echo waited 1 second

    WaitASecond.exe
    echo waited 1 second

    WaitASecond.exe
    echo waited 1 second

    :end
    IF %ERRORLEVEL% NEQ 0 echo %ERRORLEVEL%
    IF %ERRORLEVEL% NEQ 0 pause

    echo.
    echo Pause to show what this procedure is doing
    echo If you let the procedure wait more than a few seconds
    echo it will ask you whether you wish to continue waiting.
    echo Click No.

    echo.
    pause
    Company http://www.neuroscript.net and work http://www.neuroscript.net/hans_leo_teulings.php on handwriting and drawing movement recording and processing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts