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

First working implementation of the derotation package #2

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
e3be111
Find optimal threshold for frames
lauraporta Jun 20, 2023
2cf3636
Assign correct sign for rotation
lauraporta Jun 20, 2023
4f2a0e3
Get the rotation angle per tick
lauraporta Jun 20, 2023
52bea43
Add draft logic to fit the rotation degree changes to curve [not work…
lauraporta Jun 20, 2023
9708a17
Linting
lauraporta Jun 20, 2023
8c843f6
Add working logic to calculate the rotation degree for each frame
lauraporta Jun 22, 2023
2c42d39
Visualize effects of derotation and correct some errors
lauraporta Jun 22, 2023
0bac20f
Add draft pipeline to find centroid
lauraporta Jun 23, 2023
7b4748e
Add libraries to pyproject.toml
lauraporta Jun 26, 2023
510db18
Clean up
lauraporta Jun 26, 2023
6c0e0ca
Improve plots
lauraporta Jun 26, 2023
5c73d88
Optimization v1
lauraporta Jun 26, 2023
3c63528
Add changes to gitignore
lauraporta Jun 28, 2023
2776f7c
Add functioning algorithm to optimize rotation degrees
lauraporta Jun 28, 2023
0be6a4b
Add improvements in the optimization algorithms for centroid location…
lauraporta Jun 29, 2023
a233b24
Add new plotting of centroids
lauraporta Jul 10, 2023
cd4d14f
Move part of the analysis code in methods in other files - analog pre…
lauraporta Jul 10, 2023
4b8596f
Update pyproject.toml
lauraporta Jul 10, 2023
dd681ce
Refactor plots and other methods
lauraporta Jul 10, 2023
b23c008
dummy napari plotting widget
alessandrofelder Jul 10, 2023
50af5aa
Merge branch 'derotation-01' into napari-matplotlib
lauraporta Jul 10, 2023
6c75b50
make a napari-MPL widget
alessandrofelder Jul 10, 2023
b5a6acb
Add functioning napari plugin
lauraporta Jul 10, 2023
ce21d4a
Add dependencies
lauraporta Jul 11, 2023
2ea7dd1
Use unique configs and make path relative
lauraporta Jul 11, 2023
5ceebd8
Big refactoring
lauraporta Jul 11, 2023
3faeff0
Remove curve fitting
lauraporta Jul 11, 2023
e413509
Clean up gitignore
lauraporta Jul 11, 2023
2242c30
Move code to find best centroid
lauraporta Jul 11, 2023
ef07dd4
Rename method
lauraporta Jul 11, 2023
6ee191c
Use pipeline in old script
lauraporta Jul 11, 2023
de727b5
Add new strategy for derotation
lauraporta Jul 11, 2023
e91716e
Small edits
lauraporta Jul 11, 2023
51a59f6
Visualize labels
lauraporta Jul 13, 2023
0e18811
Use pilot data
lauraporta Jul 13, 2023
040c546
Fix imports and attributes
lauraporta Jul 13, 2023
97bf38c
Add less permissive angle
lauraporta Jul 14, 2023
1a46ec4
Rename files
lauraporta Jul 14, 2023
b2a636c
Load grid data
lauraporta Aug 1, 2023
b7227ee
More workarounds to play with grid data 🥲
lauraporta Aug 1, 2023
021ded8
Renaming functions to make them generic and add WORKING DEROTATION BY…
lauraporta Aug 2, 2023
6e2c106
Further refinement and changes in napari and debugging script
lauraporta Aug 2, 2023
bd9fc9d
Improve the algorithm for end of rotation
lauraporta Aug 3, 2023
aa50d66
Improve naming of conditions
lauraporta Aug 3, 2023
ddd1627
Remove bugs for negative rotations
lauraporta Aug 3, 2023
a2a94f7
Handle rotation ticks missing better
lauraporta Aug 3, 2023
b476547
Add script to visualize how different params of scipy.rotate affect t…
lauraporta Aug 3, 2023
9ddd29e
Handle better initialization of original image at the beginning and a…
lauraporta Aug 4, 2023
78380b1
Choose data
lauraporta Aug 4, 2023
c902611
Improve plotting and image handling in script
lauraporta Aug 4, 2023
20f03b4
Add two images regarding scipy rotate params exploration
lauraporta Aug 7, 2023
f45fd98
Fix error in detection of false rotations
lauraporta Aug 7, 2023
26a2aba
Workaround for suboptimal threshold identification
lauraporta Aug 7, 2023
62ac2b5
Clean up napari script
lauraporta Aug 7, 2023
31b9c65
Temporary adjustament of rotation algorithm
lauraporta Aug 7, 2023
6b5226d
Include other datasets
lauraporta Aug 7, 2023
efb478c
Complete pipeline including masking and saving of tif file
lauraporta Aug 7, 2023
d285ba6
Renaming file
lauraporta Aug 9, 2023
45a5caa
Refactoring, move modules in different folders
lauraporta Aug 9, 2023
106e0b8
More refactoring and deletion of unused methods
lauraporta Aug 9, 2023
a3ce9db
More refactoring
lauraporta Aug 9, 2023
7e54f6b
More refactoring related to data in input, changes in the config files
lauraporta Aug 10, 2023
aa0355d
Add readme
lauraporta Aug 10, 2023
1e96559
Renaming
lauraporta Aug 10, 2023
67c2c49
Change dependencies
lauraporta Aug 10, 2023
abfa65c
Add logging
lauraporta Aug 10, 2023
017a7a7
Fix small import bug and change order of rotate method
lauraporta Aug 10, 2023
0a9ec55
Upadate readme
lauraporta Aug 10, 2023
a8746ee
Fix wrong log name
lauraporta Aug 10, 2023
9cc123a
Edits to the readme
lauraporta Aug 10, 2023
2ce5b0b
Add extra method (draft)
lauraporta Sep 10, 2023
17a9bb7
Add script to saved tifs for unique rotations
lauraporta Sep 10, 2023
f84a43b
Add script to correct an artefact
lauraporta Oct 4, 2023
b650c36
Add script to remove rotations for completed tif file
lauraporta Oct 4, 2023
82f7bf3
Move script to isolate rotations
lauraporta Oct 4, 2023
6e13a10
Add other plotting scripts
lauraporta Oct 10, 2023
7d3e35c
Get data retreives file name
lauraporta Oct 10, 2023
eed8414
Plots are not saved here anymore
lauraporta Oct 10, 2023
90d47b4
Improve rotation by line and add fileter for incremental rotation
lauraporta Oct 10, 2023
ff391de
Add further plots
lauraporta Oct 18, 2023
4e32594
Add locally working plots
lauraporta Oct 18, 2023
7c48234
Improve mask generation
lauraporta Oct 19, 2023
247fe6d
Add script to add masks on top
lauraporta Oct 19, 2023
9ced29f
Add angles to csv table
lauraporta Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ venv/

# written by setuptools_scm
**/_version.py

.conda/
derotation/figures/*
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ repos:
- id: mypy
additional_dependencies:
- types-setuptools
- types-PyYAML
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# derotation
# Derotation
Rotate line by line images from 2- and 3-photon calcium imaging experiments.

## Installation
Create your environment and install the package from the branch `napari-matplotlib`:
```shell
conda create -n derotation python=3.10
conda activate derotation
git clone git+https://github.com/neuroinformatics-unit/derotation
cd derotation
git checkout napari-matplotlib
pip install -e .
```
## Edit configuration file
The configuration file is located in `derotation/config.yaml`.
In there you can specify the path in which to find the `tif` file, the `aux_stim` file and the `stumulus_randperm.mat` file, and most importantly your `dataset-folder` path.
The derotated tiffs will be saved as `{dataset-folder}/derotated/masked.tif`.

## Run with a script
`python3 derotation/derotate.py`` will run the derotation based on the configuration file.

## Run with Napari
In your conda environment, run `napari`.

In the GUI, click on `Plugins` and then `NIU derotation plotting`.
The data will be automatically loaded based on the configuration file.
On the right you will see three buttons:
- `Run analysis`: to run the pre-processing of the analog signal. After pressing this button the plot underneath will display the calculated derotation angles. If you navigate the video using the slider on the bottom, the vertical red line will show you where in the angle trace you are.
- `Rotate by line`: to rotate the video by line. This will take a long while. Check the console to know at which frame did the computation arrive.
- `Save`: will apply a circular mask to the derotated video and save it in `{dataset-folder}/derotated/masked.tif`.
-
Loading
Loading