Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6a5c06f
AI roi masks fix
jonathanoesterle Apr 12, 2026
0831458
AI improve ROI canvas
jonathanoesterle Apr 12, 2026
fc6a76a
Fix correlation calculation and ROI mask shifting in compute_corr_map…
jonathanoesterle Apr 12, 2026
53cf8bc
AI fix corr_roi_mask
jonathanoesterle Apr 12, 2026
57783fd
add verbose for check_filesystem_consistency
jonathanoesterle Apr 14, 2026
0b2077f
undo change to _compute_traces
jonathanoesterle Apr 14, 2026
08d713b
fix correlation masks
jonathanoesterle Apr 14, 2026
bc71e16
improve roi mask scanning
jonathanoesterle Apr 14, 2026
e475b6e
improve color noise processing
jonathanoesterle Apr 14, 2026
d02be0b
fix default frame rate to 60 (not 1/60)
jonathanoesterle Apr 14, 2026
34ccb13
improve FastSTA
jonathanoesterle Apr 23, 2026
01ecac9
update trigger upsampling in noise preprocessing
jonathanoesterle Apr 28, 2026
5a7c228
fix QDSpy log reader
jonathanoesterle May 11, 2026
f0a9fcb
add PresentationLogTemplate
jonathanoesterle May 11, 2026
6d3eb0f
improve log matching
jonathanoesterle May 11, 2026
8dd7456
add time matching for stim logs
jonathanoesterle May 11, 2026
5c55398
fix
jonathanoesterle May 11, 2026
f45cb72
fix preslogs defintion
jonathanoesterle May 11, 2026
b270abf
improve STA and cascade tables
jonathanoesterle May 29, 2026
e9699da
use numpy files for ROI masks
jonathanoesterle May 29, 2026
5acb51c
improve type hints
jonathanoesterle Jun 1, 2026
74ad9e2
allow ROI mask scanning from different sources
jonathanoesterle Jun 1, 2026
ef608a4
Github workflow, djimaging integration test using mysql 8
thomasZen Jul 30, 2026
5855ee6
Better tests
thomasZen Jul 31, 2026
1d84227
local testing instructions, review feedback
thomasZen Jul 31, 2026
880c56f
Test against py3.12, and djimaging 2.0 (should fail)
thomasZen Jul 31, 2026
02e2b1a
Run again against dj 0.14, test python 3.12 until 3.14 in normal tests
thomasZen Jul 31, 2026
7d9a345
Datajoint v2 version
thomasZen Aug 5, 2026
f14fd6b
merge with main
thomasZen Aug 5, 2026
48b8f2a
merge with branch fix/roimasks
thomasZen Aug 5, 2026
409df31
get rid of migration script
thomasZen Aug 5, 2026
a7146c7
Suggestions from codex review
thomasZen Aug 5, 2026
e3ab909
djconfig template update
thomasZen Aug 5, 2026
56b440d
Use load_array consistently
thomasZen Aug 5, 2026
d53993d
Only one reference folder, use file paths against that reference folder
thomasZen Aug 6, 2026
b98d547
Use blob for smaller data sizes
thomasZen Sep 7, 2026
66068cc
Merge branch 'master' into migration/datajointv2
thomasZen Sep 7, 2026
3803c56
Deps updates
thomasZen Sep 7, 2026
4d04904
readd concurrency for traces in example notebook
thomasZen Sep 7, 2026
e301b23
Import Classifier tables
thomasZen Sep 10, 2026
70070d5
More blobs
thomasZen Sep 10, 2026
dc2ca3a
Datajoint interface changes for celltype assignment
thomasZen Sep 10, 2026
ef09010
Use classifier for scikit-learn v1.7
thomasZen Sep 10, 2026
fbffb53
Minimum version requirements for some packages (e.g. numpy)
thomasZen Sep 10, 2026
42ed142
Tested autorois: fixed restricting on string file path bug and openin…
SamuelSuhai Sep 10, 2026
c8a252d
Merge branch 'migration/datajointv2' of github.com:eulerlab/djimaging…
SamuelSuhai Sep 10, 2026
fe666ef
fixed a minor bug that tried to store a tupple in a field that requir…
SamuelSuhai Sep 10, 2026
40c4fdd
Fix typo: bic -> aic
thomasZen Sep 11, 2026
6c67303
Fixed FastSta restriction bug: self.params_table.stimulus_table has a…
SamuelSuhai Sep 11, 2026
05c49ef
Merge branch 'migration/datajointv2' of github.com:eulerlab/djimaging…
SamuelSuhai Sep 11, 2026
d196967
Fix test with update in testing code
thomasZen Sep 14, 2026
d308d21
Remove deprecated/v1 and duplicate code
thomasZen Sep 14, 2026
cd28d76
A bit more cleanup
thomasZen Sep 14, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/mysql-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python-version: "3.12"

- name: Install dependencies
run: uv pip install --system pytest "setuptools<81" "datajoint==0.14.7" -e .
run: uv pip install --system pytest "setuptools<81" -e .

- name: Run MySQL integration tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
uv pip install --system flake8 pytest
uv pip install --system "setuptools<81" "datajoint==0.14.7" -e .
uv pip install --system "setuptools<81" -e .

- name: Lint with flake8
run: |
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ e.g. based on the template <code>djimaging/djconfig/djconf_template.json</code>.
Fill out the missing values; if you don't know how, ask someone in your group.
> ❗ Never upload this personal config file to GitHub.

DataJoint 2 requires MySQL 8 with `utf8mb4`/`utf8mb4_bin` and named stores.
The template uses a reference-only DataJoint store rooted at
`/gpfs01/euler/data` for externally managed acquisition, stimulus, and model
files. DataJoint does not write `<filepath>` values, although filesystem tools
such as ROI-mask editors may still require write access to adjacent folders.
Traces, snippets, response vectors, field/presentation channel averages, ROI masks,
and small analysis arrays/objects use `<blob>` and are stored directly in the
database. Large stimulus and population matrices, full spatiotemporal receptive
fields, high-resolution channel averages, correlation maps, and model objects
use `<npy@processed>` or `<blob@processed>` in the separate writable
`processed` store. Paths inserted into `<filepath@reference>` fields must be
relative to the common reference root.
JSON does not support comments, so these store roles are documented here rather
than inside the config template.

### Create a user folder

Inside the root folder <code>djimaging</code> (not in <code>djimaging/djimaging</code>)
Expand All @@ -70,10 +85,10 @@ calling <code>schema.drop()</code> and confirm by entering <code>yes</code>.

## Local testing

Install the test environment with DataJoint 0.14.7:
Install the test environment with DataJoint 2.3.x:

```bash
uv pip install pytest "setuptools<81" "datajoint==0.14.7" -e .
uv pip install pytest "setuptools<81" -e .
```

Run unit tests:
Expand All @@ -87,7 +102,8 @@ Run integration tests against a temporary MySQL 8.0.43 server:
```bash
docker run --rm --name djimaging-mysql-test \
-e MYSQL_ROOT_PASSWORD=datajoint -e MYSQL_ROOT_HOST=% \
-p 3307:3306 -d mysql:8.0.43
-p 3307:3306 -d mysql:8.0.43 \
--character-set-server=utf8mb4 --collation-server=utf8mb4_bin
until docker exec djimaging-mysql-test mysqladmin ping -h 127.0.0.1 -pdatajoint; do sleep 1; done

DJ_TEST_MYSQL=1 DJ_HOST=127.0.0.1 DJ_PORT=3307 \
Expand Down
16 changes: 10 additions & 6 deletions djimaging/autorois/autoshift_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,18 @@ def compute_corr_map_match_indexes(
# Iterate over all possible shifts in both x and y directions within the range [-ShiftMax, ShiftMax]
for i, (dx, dy) in enumerate(dx_dy_pairs, start=1):
# Crop the shifted_video and stack_corr images to the same size
cropped = corr_map[max(0, -dx):min(ref_corr_map.shape[0], ref_corr_map.shape[0] - dx),
max(0, -dy):min(ref_corr_map.shape[1], ref_corr_map.shape[1] - dy)]
cropped = corr_map[max(0, -dx):min(corr_map.shape[0], corr_map.shape[0] - dx),
max(0, -dy):min(corr_map.shape[1], corr_map.shape[1] - dy)]

ref_cropped = ref_corr_map[max(0, dx):min(ref_corr_map.shape[0], ref_corr_map.shape[0] + dx),
max(0, dy):min(ref_corr_map.shape[1], ref_corr_map.shape[1] + dy)]

# Calculate the correlation coefficient between the cropped images
if metric == 'corr':
score = np.corrcoef(cropped.flatten(), ref_cropped.flatten())[0, 1]
a = cropped.ravel() - cropped.mean()
b = ref_cropped.ravel() - ref_cropped.mean()
denom = np.linalg.norm(a) * np.linalg.norm(b)
score = np.dot(a, b) / denom if denom > 0 else 0.0
elif metric == 'mse':
score = -np.mean((cropped - ref_cropped) ** 2)
else:
Expand All @@ -165,6 +168,7 @@ def compute_corr_map_match_indexes(
ax2.imshow(cropped)

plt.show()
plt.close(fig)

# Store the correlation coefficient in the cross-correlation matrix
match_indexes[dx + shift_max, dy + shift_max] = score
Expand All @@ -176,9 +180,9 @@ def compute_corr_map_match_indexes(
v_max = np.max(match_indexes)
v_max_row_loc, v_max_col_loc = np.unravel_index(np.argmax(match_indexes), match_indexes.shape)

# Shift the ROI mask
x_shift = v_max_row_loc - shift_max
y_shift = v_max_col_loc - shift_max
# Recover the shift: dx stored at index dx+shift_max, so dx = index-shift_max
x_shift = shift_max - v_max_row_loc
y_shift = shift_max - v_max_col_loc

if verbose:
print("ROI mask shifted by", x_shift, "pixels in x and", y_shift, "pixels in y")
Expand Down
4 changes: 2 additions & 2 deletions djimaging/autorois/cellpose_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, init_kwargs: dict, eval_kwargs: dict) -> None:

from cellpose import models, io
io.logger_setup()
self.model = models.Cellpose(**self.init_kwargs)
self.model = models.CellposeModel(**self.init_kwargs)

@staticmethod
def stack_to_image(stack: np.ndarray, n_artifact: int) -> np.ndarray:
Expand Down Expand Up @@ -139,7 +139,7 @@ def create_mask_from_data(
if multiple_stacks and 'stitch_threshold' not in eval_kwargs:
eval_kwargs['stitch_threshold'] = 1e-9 # Stitch everything together

masks, flows, styles, diams = self.model.eval(imgs, do_3D=do_3D, **eval_kwargs)
masks, flows, *_ = self.model.eval(imgs, do_3D=do_3D, **eval_kwargs)

if plot:
self.plot_results(imgs, masks, flows)
Expand Down
Loading
Loading