Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Automated video analysis tool for mouse behavioral experiments (Open Field, Social Avoidance, Forced Swim Tests).

License

Notifications You must be signed in to change notification settings

dwojf/OFT-FST-SAT-analysis-tool

Repository files navigation

OFT-FST-SAT-analysis-tool

A comprehensive Python program for analyzing mouse behavior in behavioral experiments. Supports three major experimental paradigms: Open Field Test (OFT), Social Avoidance Test (SAT), and Forced Swim Test (FST).

Features

Supported Experiments

  • Open Field Test (OFT): Analyzes center zone time, locomotor activity, and exploratory behavior
  • Social Avoidance Test (SAT): Measures interaction zone time and avoidance behavior
  • Forced Swim Test (FST): Detects and quantifies immobility periods

Advanced Image Processing

  • Lens distortion correction
  • Perspective transformation for accurate measurements
  • Real-time tracking visualization
  • Automated mouse detection and tracking

Comprehensive Output

  • Excel summaries with statistical analysis
  • CSV trajectory data export
  • Graphical visualization of results
  • Heatmaps and movement plots

Requirements

  • Python 3.7 or higher
  • OpenCV (cv2)
  • NumPy
  • Matplotlib
  • openpyxl
  • tkinter
  • scipy

Usage

  1. Run the main program:
python main.py
  1. Follow the GUI workflow:
    • Select experiment type (OFT/SAT/FST)
    • Choose video file
    • Set analysis frame range
    • Configure perspective transformation
    • Adjust detection parameters
    • Run tracking and analysis

File Structure

├── main.py                    # Main program entry point
├── config.py                  # Configuration constants
├── file_selector.py           # File selection GUI
├── frame_selector.py          # Frame range selection
├── transform_setup.py         # Perspective transformation setup
├── tracking.py                # Basic tracking functions
├── tracking_visualization.py  # Real-time tracking display
├── oft_analyzer.py            # Open Field Test analysis
├── sat_analyzer.py            # Social Avoidance Test analysis
├── fst_analyzer.py            # Forced Swim Test analysis
├── fst_tracking.py            # FST-specific tracking
├── visualization.py           # Result visualization
├── csv_exporter.py            # CSV data export
├── excel_exporter.py          # Excel report generation
└── __init__.py                # Package initialization

Analysis Parameters

Open Field Test (OFT)

  • Center zone time (25%, 33% area ratios)
  • Corner zone time
  • Total distance traveled
  • Average and maximum speed
  • Zone entry frequency

Social Avoidance Test (SAT)

  • Interaction zone dwelling time
  • Corner zone avoidance
  • Movement patterns
  • Social approach/avoidance metrics

Forced Swim Test (FST)

  • Immobility detection threshold (customizable)
  • Minimum immobility duration
  • Total immobility time and percentage
  • Number of immobility episodes

Output Files

The program generates timestamped output files in the results/YYYYMMDD/ directory:

  • Excel Summary: {ExperimentType}summary_analyzed_at_{timestamp}.xlsx
  • CSV Trajectory: {ExperimentType}_{sampleID}_trajectory_{timestamp}.csv
  • Visualization: {sampleID}_tracking_plot_{timestamp}.png

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Developed with support from Claude (Anthropic AI Assistant).

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Automated video analysis tool for mouse behavioral experiments (Open Field, Social Avoidance, Forced Swim Tests).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages