Giter VIP home page Giter VIP logo

scottres / castoffreconstruction Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 5.2 MB

This repository contains a method to reconstruct the motion, or swing, of cast-off spatter patterns. The method is based on stain inspection and Euclidean geometry. The reconstructed swing is represented as a three-dimensional region of statistical likelihood. See the README.md for instructions to install and run the repository scripts.

Home Page: https://doi.org/10.1016/j.forsciint.2020.110628

MATLAB 99.95% M 0.05%
cast-off bloodstain spatter reconstruction bpa euclidean-algorithm statistical-models likelihood

castoffreconstruction's Introduction

MATLAB/Octave Cast-off Reconstruction

Reconstructs stains from cast-off event to reproduce the motion of cast-off.

Scott McCleary
Email: [email protected] | [email protected]
Phone: (515) 975-5544
Spatter Stains to Cast-off Reconstruction
Center for Statistics and Applications in Forensic Evidence
Department of Mechanical Engineering - Attinger Lab
Iowa State University

Last Updated 01/06/2024 🎉

Note to user:

Surface and Stain Orientation Definitions:

image

image

  • Surface Tangential Vector (t̂) :
    • Definition : vector tangential to a surface aligned in the direction of gravity (**-**z-direction) for all non-horizonal surfaces
      • for perfectly horizontal surfaces, e.g. upward surface (ceiling) and downward surface (floor), the -z-direction aligns with the Surface Normal Vector. In these instances, the Surface Tangential Vector (t̂) is defined in the **+**x-direction
  • Surface Normal Vector (n̂) :
    • Definition : vector normal to a surface pointing outside the room
  • Gamma (γ) : stain directional angle (relative to impacted surface):
    • Definition : stain glancing angle between the projected trajectory vector onto the impacted surface and the tangent vector to the surface
  • Alpha (α) : stain impact angle
    • Definition : stain impact angle between the trajectory vector and the impacted surface

Required Repository Files to run the code:

  • Spatter Measurement Data, e.g. Ink_Trial_INPUT.csv, Swineblood_Trial_INPUT.csv

  • Castoff_Reconstruction_DRIVER.m

  • DRIVER.csv produces DRIVER.mat required for Castoff_Reconstruction_MAIN.m

  • Castoff_Reconstruction_MAIN.m

  • Castoff_Reconstruction_FUNC.m

  • lineSegmentIntersect.m

  • meshVolume.m

  • point_to_line.m

  • gauss_distribution.m

  • CircleFitByPratt.m

  • Castoff_Reconstruction_POST.m

  • combvec2.m

  • inpolyhedron.m

  • triangulateFaces.m

  • linecirc.m

  • generate_input.m

    • linecirc.m
    • plane_line_intersect.m
    • rotate_3D.m
    • triangulateFaces.m

    Licenses:

    All licenses for third party scripts are included and must be kept with provided scripts. If third party materials were not cited within the repository Licenses folder, this was not intentional by the author.

Required Installation for GNU Octave Compatibility: (Suggested Installation Order)

  • Updated GNU Octave (written and tested with 5.2.0)
  • Updated Java
  • Psychtoolbox-3 Requirements install prior to Psychtoolbox download
  • Download Psychtoolbox Toolbox Version 3 (PTB-3)
    • Unzip download in new folder C:\toolbox
    • Open Octave, copy and paste the following script to the command window to install Psychtoolbox:

      cd C:\toolbox DownloadPsychtoolbox C:\toolbox

  • Follow command window prompts to finish installation.
  • Prior to running Castoff_Recosntruction_DRIVER.m or Castoff_Reconstruction_MAIN.m the io and signal packages need to be loaded.
    • Load packages on an as needed basis by copying and pasting the following script to the command window:

      pkg load io pkg load signal

    • Required packages for download.
    • Automatically load packages at Octave startup with the following:
      • Go to C:\Octave\Octave-5.2.0\mingw64\share\octave\site\m\startup
      • Open octaverc with a text editor.
      • Copy and paste the following lines to the end of the document:

      pkg load io pkg load signal

  • Save file.
    • If octaverc does not exist, copy, paste, and save the following to a text file and save to the directory (C:\Octave\Octave-5.2.0\mingw64\share\octave\site\m\startup):

      pkg load io pkg load signal

Instructions to Run a first spatter pattern example (Ink_Trial_INPUT.csv), with stains measured by hand or with Hemospat:

  1. Make sure you have Matlab or Octave installed as per the installation instructions above
  2. Save all files included in the distribution to the same directory.
  3. Run (F5) the DRIVER (Castoff_Reconstruction_DRIVER.m).
  4. Check that the data name line 64 in the MAIN (Castoff_Reconstruction_MAIN.m) reads INK_Trial_INPUT_DRIVER.mat
  5. Run (F5) the MAIN (Castoff_Reconstruction_MAIN.m); producing figure(3) and figure(4+) which simulate Figures 5 and 7 of McCleary et al FSI 2021, respectively.
  6. Maximize figure 4 to observe the reconstructed swing regions in blue, green and red
  7. MAIN also outputs the Total Elapsed Cluster Analysis Time:, in seconds (s), with the total program run time excluding any variable time from user input. See User Inputs: (DRIVER) res for estimated runtimes.
  8. MAIN also save the Resultant Variables as a .mat file denoted by Castoff_Reconstruction.mat
  9. MAIN and Output the Cast-off Reconstruction Results with warnings as a txt-file denoted by Castoff_Reconstruction_OUTPUT.txt displayed in Figures(4+) (figure number is dependent on clustering method). Figure(1) shows the Pratt fit automated reference point. Figure(3) outputs each clustered cast-off reconstructed arc.
  10. Run again after changing the Stain Width Measurement Uncertainty (mm) or Cast-off Reconstruction Resolution (cm) in the input file Ink_Trial_INPUT.csv

Instructions to Run a second spatter pattern example (FARO_Trial_10_INPUT.csv), with stains measured with FARO:

  1. Make sure you have Matlab or Octave installed as per the installation instructions above
  2. Save all files included in the distribution to the same directory.
  3. Modify the data name line 64 in the MAIN (Castoff_Reconstruction_MAIN.m) to FARO_Trial_10_INPUT_DRIVER.mat
  4. Run (F5) the DRIVER (Castoff_Reconstruction_DRIVER_FARO.m).
  5. Run (F5) the MAIN (Castoff_Reconstruction_MAIN.m); producing figure(3) and figure(4+) which simulate Figures 5 and 6 of McCleary et al FSI 2021, respectively.
  6. Maximize figure 4 to observe the reconstructed swing regions in blue, green and red
  7. MAIN also outputs the Total Elapsed Cluster Analysis Time:, in seconds (s), with the total program run time excluding any variable time from user input. See User Inputs: (DRIVER) res for estimated runtimes.
  8. MAIN also save the Resultant Variables as a .mat file denoted by Castoff_Reconstruction.mat
  9. MAIN and Output the Cast-off Reconstruction Results with warnings as a txt-file denoted by Castoff_Reconstruction_OUTPUT.txt displayed in Figures(4+) (figure number is dependent on clustering method). Figure(1) shows the Pratt fit automated reference point. Figure(3) outputs each clustered cast-off reconstructed arc.
  10. Run again after changing the Stain Width Measurement Uncertainty (mm) or Cast-off Reconstruction Resolution (cm) in the input file Ink_Trial_INPUT.csv

Instructions to Run your own data:

  1. Make sure you have Matlab or Octave installed as per the installation instructions above

  2. Enter spatter pattern information in an input _INPUT.csv file with same format as either of the examples above - image

  3. Modify the data name line 64 in the MAIN (Castoff_Reconstruction_MAIN.m) to input_DRIVER.mat

  4. Follow same instructions (4-10) as either examples above.

Expected Outputs : Castoff_Reconstruction_DRIVER.m

  • creates a _DRIVER.mat file as input for Castoff_Reconstruction_MAIN.m
    • image

Expected Outputs : Castoff_Reconstruction_MAIN.m

Figures:

  • figure(2)

    • inputs overview : an initial look at the inputted room dimensions, stain impact locations, stain trajectories, automated reference point, and best fit plane
    • image
  • figure(3)

    • reconstruction overview : an active display of clustered stains & trajectories and clustered planes with projected stains reference during spatter reconstruction
    • image
  • figure(4)

    • reconstruction results : inputs overview overlaid with user-defined three-dimensional region of statistical likelihood
    • image

Files:

  • saved simulation workspace and textual overview of INPUTS (resolution, user preferences, inputed stain details) and Cast-off Reconstruction Results: (High, Medium, and Low Percentile reconstructed XYZ-Vertices & Faces)
    • image

Note: If actual cast-off motion is known (for research purposes only):

  • Enter known cast-off motion path x, y, and z-coordinates into _MOTION.csv with same format as Ink_Trial_MOTION.csv
  • Follow same instructions (4-10) as either examples above.
  • Run (F5) the Post-processor (Castoff_Reconstruction_POST.m)

Figure Displaying:

  • Show and hide legends from resultant figures using:

    legend show legend hide

  • Rotate, zoom in/out, and pan figure controls are located on the top of the figures to allow for other viewing angles. Also, for all figures besides Figure(1), view(az,el) can be used for precise three-dimensional viewing angles where az is the azimuth angle (in degrees) and el is the polar (or elevation) angle (in degrees).

castoffreconstruction's People

Contributors

scottres avatar

Stargazers

 avatar

Watchers

 avatar  avatar

castoffreconstruction's Issues

README-to-md

convert README to GitHub .md file format

  • rename file to README.md
    • update formatting to align with GitHub markdown
    • add documentation to detail Gamma bloodstain orientation angle
      • include images for clarity
    • include expected outputs within README.md
      • DRIVER mat-file output
      • MAIN figures, txt-file, and mat-file outputs

doc_software revision compatibility

software revision compatibility

  • update software compatibility with latest software releases
    • test compatibility with latest software releases
    • are all Required Installation for GNU Octave Compatibility: (Suggested Installation Order) software/steps still required?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.