MOdular Unsupervised poSe Estimation and TRacking with behavioral Annotation and Prediction (MOUSE‑TRAP)
MOUSE‑TRAP is an application for:
-
Converting files (videos, images, PDFs, DOCX, TXT) with live progress.
-
Clipping videos to the exact frames you mark in a built-in annotator.
-
Launching SLEAP Label or running SLEAP batch inference without the command line.
This package can be installed with:
pip install -e .Then run the app from anywhere:
mouse-trapOpen the documentation with:
start docs/_build/html/index.html # MacOS: open docs/_build/html/index.htmlDeveloped for the Neurobehavioral Circuits Group (NBCG) under the guidance of Dr. Julieta Lischinsky. The NBCG studies the developmental and circuit mechanisms underlying social behaviors.
-
File Converter (GUI)
- Video: convert between
.mp4,.avi,.mov,.mkv,.gif; transcode.seq → .mp4/.avi. - Image: convert common raster formats (
.jpg,.png,.tiff,.bmp), and image → PDF. - Documents: PDF ↔ DOCX/TXT via Pandoc; DOCX → PDF via
docx2pdf. - Batching: select multiple files or whole folders (with optional recursion + extension filter).
- Progress & logs: live progress bar and streaming console output.
- Video: convert between
-
Annotation‑based Video Clipping
- Built‑in Video Annotation dialog to mark enter/exit frames per “intruder”.
- Exports one clip per intruder (
<stem>_<Name>intruder.<ext>), validates overlaps and order. - CSV import of annotations:
file_name+ any number of<name>_in/<name>_outcolumns.
-
SLEAP Integration (optional)
- Launch SLEAP Label from inside the app.
- Batch inference helper for
sleap-nn trackwith a guided form, logging, and “Skip OK” re‑runs.
- Python: 3.13+
- Python deps: installed automatically via
pip install -e .
(PyQt6,opencv-python,Pillow,pdf2image,pypandoc,docx2pdf) - External tools:
- FFmpeg (required for most video conversions).
- Pandoc (required for PDF/DOCX/TXT conversions via
pypandoc). - Poppler (required by
pdf2imagefor PDF → image). - Microsoft Word (Windows/macOS) if you want DOCX → PDF via
docx2pdf.
- Optional (for SLEAP features):
- A Conda env (e.g.,
sleap) withsleap-labeland/orsleap-nnavailable on yourPATH.
- A Conda env (e.g.,
Tip: If a conversion fails with an FFmpeg error, ensure
ffmpegruns in a terminal (ffmpeg -version).
# optional, but recommended
python -m venv .venv
.venv\Scripts\activate # MacOS: source .venv/bin/activate
pip install -e ".[dev,docs]"Launch the GUI:
mouse-trapTypical workflows:
- Convert files: Select one or many files (or folders), choose Output Format, press Convert.
- Clip by annotations: Select a video, tick Clip, Convert, mark Enter/Exit in the dialog, Done.
- SLEAP: Use Launch SLEAP or Run SLEAP Inference to open the labeler or configure a batch
sleap-nn trackrun.
For step‑by‑step instructions, screenshots, and CSV examples, see
docs/usage.rst.
Run tests and linters:
pytest -q
ruff check .
black .Build the docs:
sphinx-build -b html docs docs/_build/html├── src/
│ └── mouse_trap/
│ ├── __init__.py
│ ├── __main__.py # entry point (installed script: `mouse-trap`)
│ ├── gui.py # main window and workflows
│ ├── conversion.py # conversions & worker thread
│ ├── annotation.py # video annotation dialog
│ └── sleap_cli.py # SLEAP batch dialog and helpers
├── docs/
└── tests/
- Riley Harper, National Institute of Environmental Health Sciences