Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add video preprocessing (denoising) feature #83

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

t-sasatani
Copy link
Collaborator

@t-sasatani t-sasatani commented Dec 7, 2024

[STILL DRAFT. Could also be a different package because this isn't really "I/O"] This PR adds a denoising module for neural recording videos. It can be used offline and I think we can also use this in real-time with the streamDaq too.

Processing features

  • Detect broken buffers by comparing buffers with the same position buffer in the previous frame (I'm only doing mean error now, but we can also add more stastistic functions).
  • Remove broken buffers by copying in the same position buffer in the previous frame.
  • Spatial frequency-based filtering.
  • Generate the minimum projection out of a stack of frames.

Following is an example frame that detects noisy regions and patches it with the prior frame buffer:
image

Interface

You can run this with mio process denoise using an example video.
The denoising parameters and export settings can be defined with a YAML file.

mio process denoise -i .\user_dir\test.avi -c .\miniscope_io\data\config\process\denoise_example.yml

Minor changes

  • Moved VideoWriter to io module because it's pretty generic, and I wanted to use it for the denoising.
  • Added a user_dir for keeping user data.

To do/considerations

  • Finish writing the modules. Add more processing modules.
  • Organize.
  • Write tests.
  • The config interface feels pretty redundant...

📚 Documentation preview 📚: https://miniscope-io--83.org.readthedocs.build/en/83/

@coveralls
Copy link
Collaborator

coveralls commented Dec 7, 2024

Pull Request Test Coverage Report for Build 12208523886

Details

  • 17 of 346 (4.91%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-14.7%) to 62.478%

Changes Missing Coverage Covered Lines Changed/Added Lines %
miniscope_io/cli/main.py 0 2 0.0%
miniscope_io/cli/process.py 0 12 0.0%
miniscope_io/io.py 15 32 46.88%
miniscope_io/models/process.py 0 32 0.0%
miniscope_io/models/frames.py 0 52 0.0%
miniscope_io/plots/video.py 0 59 0.0%
miniscope_io/process/video.py 0 155 0.0%
Totals Coverage Status
Change from base Build 12208310258: -14.7%
Covered Lines: 1069
Relevant Lines: 1711

💛 - Coveralls

@t-sasatani t-sasatani force-pushed the feat-preprocess branch 3 times, most recently from 1385223 to bc9a268 Compare December 7, 2024 01:05
@sneakers-the-rat
Copy link
Collaborator

omfg you already did it!?!??!?!?! u are so fast. cant wait to check this out!!!!!

@coveralls
Copy link
Collaborator

coveralls commented Dec 11, 2024

Coverage Status

coverage: 65.465% (-13.6%) from 79.112%
when pulling 9cd2bc3 on feat-preprocess
into 920d795 on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants