Skip to content

Commit e720550

Browse files
committed
Merge branch 'dev' into review/pr-120
2 parents 940b923 + a01ccce commit e720550

169 files changed

Lines changed: 27079 additions & 9098 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
10+
os: [ubuntu-latest, macos-14, macos-latest, windows-latest]
1111
runs-on: ${{ matrix.os }}
1212
defaults:
1313
run:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ src/cedalion/_version.py
169169
docs/examples/*.ipynb
170170
docs/examples/*/*.ipynb
171171

172+
# example plots
173+
examples/*/*.png
174+
examples/*/*.gif
175+
172176
# API documentation from sphinx-apidoc
173177
docs/api/*
174178
_autosummary*/

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2024 The Cedalion Developers
1+
Copyright 2024-2025 The Cedalion Developers
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this
44
software and associated documentation files (the “Software”), to deal in the Software

README.md

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,42 @@
1+
# Cedalion - fNIRS analysis toolbox
2+
3+
A python-based framework for the data-driven analysis of multimodal fNIRS and DOT in naturalistic environments. Developed by the [Intelligent Biomedical Sensing (IBS) Lab](https://ibs-lab.com/) with and for the community.
4+
15
<p align="center">
2-
<img src="docs/img/IBS_clr_small.png" />
6+
<img src="docs/img/cedalion_frontpage.png" />
37
</p>
48

5-
# cedalion - fNIRS analysis toolbox
6-
7-
To avoid misinterpretations and to facilitate studies in naturalistic environments, fNIRS measurements will increasingly be combined with recordings from physiological sensors and other neuroimaging modalities.
8-
The aim of this toolbox is to facilitate this kind of analyses, i.e. it should allow the easy integration of machine learning techniques and provide unsupervised decomposition techniques for
9-
multimodal fNIRS signals.
109

1110
## Documentation
1211

1312
The [documentation](https://doc.ibs.tu-berlin.de/cedalion/doc/dev) contains
14-
[installation instructions](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/getting_started/installation.html) as
15-
well as several [example notebooks](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/examples.html)
16-
that illustrate the functionality of the toolbox.
17-
For discussions and help you can visit the [cedalion forum on openfnirs.org](https://openfnirs.org/community/cedalion/)
18-
19-
20-
## Development environment
21-
22-
To create a conda environment with the necessary dependencies run:
23-
24-
```
25-
$ conda env create -n cedalion -f environment_dev.yml
26-
```
27-
28-
Afterwards activate the environment and add an editable install of `cedalion` to it:
29-
```
30-
$ conda activate cedalion
31-
$ pip install -e .
32-
$ bash install_nirfaster.sh CPU # or GPU
33-
```
34-
35-
This will also install Jupyter Notebook to run the example notebooks.
36-
37-
If conda is too slow consider using the faster drop-in replacement [mamba](https://mamba.readthedocs.io/en/latest/).
38-
If you have Miniconda or Anaconda you can install mamba with:
39-
'''
40-
$ conda install mamba -c conda-forge
41-
'''
42-
and then create the environment with
43-
```
44-
$ mamba env create -n cedalion -f environment_dev.yml
45-
```
46-
Please note: If this does not socceed there is another route to go:
47-
Install the libmamba solver
48-
'''
49-
$ conda install -n base conda-libmamba-solver
50-
'''
51-
and then build the environment with the --solver=libmamba
52-
```
53-
$ conda env create -n cedalion -f environment_dev.yml --solver=libmamba
54-
```
13+
[installation instructions](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/getting_started/installation.html), an [API reference](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/api/modules.html) as
14+
well as many [example notebooks](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/examples.html) that illustrate the functionality of the toolbox.
15+
16+
17+
18+
## Installation
19+
20+
Please refer to the [installation instructions](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/getting_started/installation.html) in the documentation for installing Cedalion
21+
on you computer.
22+
23+
To test the [example notebooks](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/examples.html) without installing Cedalion locally, you can also [run the notebooks on Google Colab](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/getting_started/colab_setup.html).
24+
25+
## Versions
26+
The `main` branch acts as a relase branch, i.e. the latest commit there is the most
27+
current release. Development happens in the `dev` branch. Please refer to the [CHANGELOG](https://doc.ibs.tu-berlin.de/cedalion/doc/dev/CHANGELOG.html) for a release
28+
history and current differences between the `dev` and `main` branches.
29+
30+
31+
## Forum
32+
33+
For discussions and help please visit the [Cedalion forum on openfnirs.org](https://openfnirs.org/community/cedalion/)
34+
5535

5636
## How to cite Cedalion
5737
A paper for the toolbox is currently in the making. If you use this toolbox for a publication in the meantime, please cite us using GitHub's "Cite this repository" feature in the "About" section. If you want to contact us or learn more about the IBS-Lab please go to https://www.ibs-lab.com/
5838

39+
40+
## License
41+
42+
Cedalion is licensed under the MIT license.

docs/CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,43 @@
33
## Unreleased changes (available on the `dev` branch)
44

55
### Added
6+
- Added the function `cedalion.geometry.landmarks.normalize_landmarks_labels` that case-insensitively maps common landmark labels to canonical names, by [Mohammad Orabe](https://github.com/orabe). ([#132](https://github.com/ibs-lab/cedalion/pull/132))
7+
- Added functionality and examples for constrained ICA methods (arc-ERBM, arc-EBM), by [Jacqueline Behrendt](https://github.com/jackybehrendt12). ([#133](https://github.com/ibs-lab/cedalion/pull/133))
68
- An example notebook for ICA source extraction was added, by [Jacqueline Behrendt](https://github.com/jackybehrendt12).
79
([#112](https://github.com/ibs-lab/cedalion/pull/112))
10+
- Added `TwoSurfaceHeadmodel.scale_to_headsize` and `TwoSurfaceHeadmodel.scale_to_landmarks` to adjust the head model's size to the head circumferences or digitized landmarks, respectively. By [Eike Middell](https://github.com/emiddell).
11+
- The factory method `cedalion.dot.get_standard_headmodel` to construct the `TwoSurfaceHeadModel` of the standard Colin27 and ICBM-152 heads was added, by [Eike Middell](https://github.com/emiddell).
12+
- Added `cedalion.xrutils.dot_dataarray_csr` for matrix products between `xr.DataArray`
13+
and `scipy.sparse` arrays, by [Eike Middell](https://github.com/emiddell).
14+
- Added `cedalion.geometry.landmarks.normalize_landmarks_labels` to map alternative landmark names (e.g., "nasion", "left ear", "nz") to their canonical 10-10 system labels (e.g. Nz, LPA). The function handles now case-insensitive matching and supports common naming conventions. Usage: `geo3d = normalize_landmarks_labels(geo3d)` before calling registration or plotting functions, by [Mohammad Orabe](https://github.com/orabe). ([#84](https://github.com/ibs-lab/cedalion/issues/84))
815
### Changed
16+
- The package `cedalion.sigproc.motion_correct` was renamed to `cedalion.sigproc.motion`.
17+
- The ICA-EBM and ICA_ERBM implementations were moved into `cedalion.sigdecomp.unimodal`.
18+
- The class `cedalion.dot.ForwardModel` accepts also head models that are not in
19+
voxel space. They will be transformed to voxel space internally.
20+
- Refactored `cedalion.plots` into `cedalion.vis` and its subpackages. This cleans up the code structure and should help with discovering existing functions. The package `cedalion.vis.blocks` emphasizes building blocks for larger visualizations. Please refer to `examples/plots_visualization/12_plots_example.ipynb` to get an overview. Importing `cedalion.plots` will throw a deprecation warning to trigger adoption. By [Eike Middell](https://github.com/emiddell).
21+
- Renamed `LabeledPointCloud` to `LabeledPoints`.
22+
- Split up the `.nirs` submodule into `.nirs.cw`, `.nirs.fd` and `.nirs.td`.
23+
- Merged the submodules `cedalion.datasets` and `cedalion.data`. All functions to
24+
access example datasets are now available under `cedalion.data`.
25+
- The fiducial landmarks of the standard Colin27 and ICBM-152 heads changed. Using the landmark builder 10-10 coordinates were calculated for both heads. These are now
26+
available when head models are created with `get_standard_headmodel`. The example
27+
notebook `48_headmodel_landmarks_verification.ipynb` documents the origin of all
28+
landmarksand quantitatively compares the output of the LandmarkBuilder to published
29+
coordinates. By [Eike Middell](https://github.com/emiddell).
30+
- Added the parameter `mode` to `TwoSurfaceHeadModel.align_and_snap_to_scalp` to switch
31+
between constrained affine transformations (translation, rotation, isotropic scaling)
32+
and unconstrained affine transformations (also anisotropic scaling, shearing and reflection). The default behaviour from `align_and_snap_to_scalp` was changed from
33+
constrained to unconstrained affine transformations.
34+
- The image reconstruction methods were refactored to offer more regularization methods
35+
(including spatial basis functions) as well as direct and indirect reconstructions and to provide a simpler interface to the user. All functions are now located under `cedalion.dot`. By [Laura Carlton](https://github.com/lauracarlton), [Alexander von Lühmann](https://github.com/avolu) and [Eike Middell](https://github.com/emiddell). ([#130](https://github.com/ibs-lab/cedalion/pull/86))
36+
- For the Colin27 and ICBM-152 heads the label for the coordinate reference system was changed from `'aligned'` to `'mni'`.
937
- The ninja HD and UHD cap coordinates were changed from a right-handed to a left-handed
1038
coordinate system, by [Nils Harmening](https://github.com/harmening). ([#110](https://github.com/ibs-lab/cedalion/pull/110))
1139
- Changed the names of several motion correction algorithms from `motion_correct.motion_correct_X`
1240
to `motion_correct.X`. Argument names were made PEP8 compliant. The example `22_motion_artefacts_and_correction` was improved. By [Eike Middell](https://github.com/emiddell).
41+
- The function `cedalion.vis.anatomy.plot_montage3D` now accepts a `landmarks` parameter to specify which landmarks should be highlighted. Pass `None` (default) to show all available canonical registration landmarks (e.g. Nz, Iz, LPA, RPA, Cz), a list of landmark names to show specific ones, or an empty list to show none, by [Mohammad Orabe](https://github.com/orabe). ([#84](https://github.com/ibs-lab/cedalion/issues/84))
42+
- Included t-stat thresholding in `cedalion.vis.misc.plot_probe_gui`, by [Shannon Kelley](https://github.com/shankell212). ([#131](https://github.com/ibs-lab/cedalion/pull/131))
1343

1444

1545
### Deprecated
@@ -19,6 +49,10 @@ to `motion_correct.X`. Argument names were made PEP8 compliant. The example `22_
1949
- Fixed a bug in motion_correct_wavelet affecting the selection of coefficients for IQR-based thresholding. The issue caused unintended suppression of high-frequency components, particularly near the end of recordings. Changed by [Eike Middell](https://github.com/emiddell).
2050
- Fixed a bug in the stopping criterion of motion_correct.pca_recurse caused by an inverted
2151
boolean mask of motion artifacts, by [Eike Middell](https://github.com/emiddell).
52+
- Fixed an issue with constant regressors when fitting a GLM using the AR-IRLS method. The autoregressive filter used to
53+
account for serial correlations was not properly applied to them. The fix ignores samples at the beginning of the time
54+
series until the filter is initialized, by [Eike Middell](https://github.com/emiddell).
55+
2256

2357
## Version 25.1.0 (2025-06-22)
2458

@@ -30,7 +64,7 @@ All dependencies have been updated to recent versions. Please rebuild the enviro
3064
- Spatial and measurement noise regularization options in image reconstruction, by [David Boas](https://github.com/dboas). ([#86](https://github.com/ibs-lab/cedalion/pull/86))
3165
- Improved import of optode and electrode coordinates, by [Nils Harmening](https://github.com/harmening). ([#95](https://github.com/ibs-lab/cedalion/pull/95))
3266
- The interfaces for the fluence and sensitivity computations were changed to allow out-of-core computations, by [Eike Middell](https://github.com/emiddell).
33-
- Precomputed sensitivities for all example datasets, including the ninjaCap whole head probe, are availabe in cedalion.datasets, by [Eike Middell](https://github.com/emiddell).
67+
- Precomputed sensitivities for all example datasets, including the ninjaCap whole head probe, are availabe in cedalion.data, by [Eike Middell](https://github.com/emiddell).
3468

3569
- Make all example notebooks run on Google Colab integration, by [Josef Cutler](https://github.com/jccutler). ([#96](https://github.com/ibs-lab/cedalion/pull/96))
3670

docs/LICENSE.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/_static/css/rtd_fixes.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ ul.xr-var-list li.xr-var-item label {
77
margin-top: 2px !important;
88
margin-bottom: 2px !important;
99
}
10+
11+
div.citation .label {
12+
width: 5em;
13+
}

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1111

1212
project = "cedalion"
13-
copyright = "2024, the cedalion developers"
14-
author = "the cedalion developers"
13+
copyright = "2024-2025, the Cedalion developers"
14+
author = "the Cedalion developers"
1515

1616
# -- General configuration ---------------------------------------------------
1717
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -84,8 +84,8 @@
8484
autodoc_type_aliases = {
8585
"NDTimeSeries" : "cdt.NDTimeSeries",
8686
"cdt.NDTimeSeries" : "cdt.NDTimeSeries",
87-
"LabeledPointCloud" : "cdt.LabeledPointCloud",
88-
"cdt.LabeledPointCloud" : "cdt.LabeledPointCloud",
87+
"LabeledPoints" : "cdt.LabeledPoints",
88+
"cdt.LabeledPoints" : "cdt.LabeledPoints",
8989
"cedalion.Quantity" : "Quantity",
9090
"pint.Quantity" : "Quantity",
9191
"Quantity" : "Quantity",

docs/data_io/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ I/O
4343
cedalion.io.forward_model
4444
cedalion.io.photogrammetry
4545
cedalion.io.probe_geometry
46-
cedalion.datasets
46+
cedalion.data
4747

4848

4949
Examples
@@ -55,4 +55,5 @@ Examples
5555
../examples/getting_started_io/10_xarray_datastructs_fnirs.ipynb
5656
../examples/getting_started_io/11_recording_container.ipynb
5757
../examples/getting_started_io/13_data_structures_intro.ipynb
58+
../examples/getting_started_io/14_snirf2bids.ipynb
5859
../examples/getting_started_io/34_store_hrfs_in_snirf_file.ipynb

docs/dot/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Diffuse optical tomography
2+
==========================
3+
4+
.. py:currentmodule:: cedalion.dot
5+
6+
7+
.. autosummary::
8+
:toctree: _autosummary_dot
9+
:recursive:
10+
11+
cedalion.geometry
12+
13+
cedalion.dot
14+
15+
16+
Examples
17+
--------
18+
19+
.. nbgallery::
20+
:glob:
21+
22+
../examples/head_models/*

0 commit comments

Comments
 (0)