Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
7a58c97
ENH: Restore diffusion derivatives
effigies Aug 1, 2019
86facea
MAINT: Split out tractography
oesteban Sep 18, 2019
578079f
Merge pull request #9 from bids-standard/maint/split-tractography
arokem Sep 18, 2019
5ab7dc3
First commit for restructuring of DWI derivatives
Lestropie Jul 4, 2019
1beda57
BEP016: Small fixes, and try to get links to headers working
Lestropie Jul 16, 2019
1fd477c
BEP016: More updates of internal header links
Lestropie Jul 16, 2019
a462603
BEP016: Minor tweaks from first feedback round
Lestropie Aug 16, 2019
021cfd5
BEP016: Try to get links working within tables
Lestropie Aug 16, 2019
899a676
BEP016: More minor tweaking
Lestropie Aug 16, 2019
48c24dc
BEP016: Transpose SH volume count tables
Lestropie Aug 16, 2019
c092f48
BEP016: Provide example for parameter definitions
Lestropie Sep 11, 2019
7fe44f9
BEP016: Change to single-file diffusion models
Lestropie Sep 11, 2019
7eb44cb
BEP016: Initial explanation of filename
Lestropie Sep 11, 2019
4bc2b95
BEP016: File naming clarification
Lestropie Sep 11, 2019
f07489d
BEP016: Spelling fix
Lestropie Sep 11, 2019
5d14ffa
BEP016: Fix missing anchor links
Lestropie Sep 11, 2019
a804aeb
BEP016: Move orientation specification
Lestropie Sep 18, 2019
77a732f
Merge pull request #5 from bids-standard/dwi_derivatives_restructure
oesteban Sep 23, 2019
1a0f221
Merge remote-tracking branch 'upstream/master' into bep-016
effigies Jun 14, 2021
7210dd7
Merge remote-tracking branch 'bids-specification/master' into bep-016
Lestropie Nov 16, 2021
7227a75
BEP016: Revise SH description
Lestropie Nov 22, 2021
3c412f6
BEP016: Initial conformity to markdown formatting
Lestropie Nov 22, 2021
a5f4514
BEP016: More formatting conformity changes
Lestropie Nov 22, 2021
0dccc99
BEP016: More formatting conformity changes
Lestropie Nov 22, 2021
f237b8b
BEP016: Attempted fixes to table cell padding
Lestropie Nov 22, 2021
4c5e388
BEP016: Minor fix to tractography derivatives for CI pass
Lestropie Nov 22, 2021
3975051
Merge pull request #30 from bids-standard/remark_fixes
Lestropie Nov 22, 2021
b92e919
Merge branch 'bep-016' into sh_description_cherrypick
Lestropie Nov 22, 2021
158586f
BEP016: Modify nomenclature around MRtrix3 SH coefficients
Lestropie Nov 22, 2021
6ab7130
BEP016: Revise preprocessed DWI data example
Lestropie Nov 23, 2021
4c7b81b
BEP016: Remove SH Descoteaux placeholder
Lestropie Nov 30, 2021
80e19fe
BEP016: Remove majority of models
Lestropie Dec 1, 2021
beb7a16
BEP016: Formatting fix following removal of models
Lestropie Dec 1, 2021
8f18d91
Merge pull request #40 from bids-standard/remove_models
arokem Dec 1, 2021
29fde11
Merge pull request #37 from bids-standard/revise_preprocessed
francopestilli Dec 1, 2021
9ee4aa6
Merge pull request #28 from bids-standard/sh_description_cherrypick
francopestilli Dec 2, 2021
fcff8ac
BEP016: Strip out tractography content
Lestropie Dec 2, 2021
bab2900
Fixes a typo caught by codespell
arokem Dec 2, 2021
3874db9
Merge pull request #45 from bids-standard/typo-fix
Lestropie Dec 2, 2021
c9d2748
BEP016: Initial draft of common filename suffix "model"
Lestropie Dec 2, 2021
618ee5b
BEP016: Rename "dti" to "tensor"
Lestropie Dec 2, 2021
39fa5b0
Merge pull request #42 from bids-standard/strip_tractography
arokem Dec 8, 2021
844f9a5
Merge pull request #47 from bids-standard/rename_tensor
Lestropie Jan 11, 2022
4e03dc7
Rename "_parameter-" entity to "_param-"
Lestropie Aug 9, 2022
a83d607
DWI derivatives: Compulsory "parameter" entity
Lestropie Aug 9, 2022
ab05216
Merge pull request #51 from bids-standard/param_entity
Lestropie Aug 10, 2022
653766d
Merge remote-tracking branch 'origin/bep-016' into compulsory_paramet…
Lestropie Aug 10, 2022
c7cfbaf
DWI derivatives: Resolution between content changes
Lestropie Aug 10, 2022
46d3eb4
Merge remote-tracking branch 'origin/bep-016' into model_suffix
Lestropie Aug 16, 2022
d3bbb86
DWI derivatives: Fix tensor model example
Lestropie Aug 16, 2022
d86b7cd
DWI derivatives: "model" as entity
Lestropie Aug 16, 2022
e101e50
Merge pull request #46 from bids-standard/model_suffix
francopestilli Sep 12, 2022
2b7f88d
Merge branch 'bep-016' into compulsory_parameter_entity
Lestropie Sep 12, 2022
143d1cc
Merge pull request #52 from bids-standard/compulsory_parameter_entity
Lestropie Sep 12, 2022
d5bda6d
Merge branch 'bep-016' into model_entity
Lestropie Sep 12, 2022
ec50c47
Merge branch 'master' into bep-016
Lestropie Sep 12, 2022
e485551
Merge pull request #57 from bids-standard/model_entity
Lestropie Sep 12, 2022
a453274
DWI models: Restore renaming "dti" to "tensor"
Lestropie Sep 12, 2022
8ca6f53
Merge pull request #60 from bids-standard/restore_rename_tensor
Lestropie Sep 12, 2022
4746056
BEP016: Remove reference to old terminology
Lestropie Sep 13, 2022
4118ce0
Merge pull request #63 from bids-standard/revert_intrinsic
Lestropie Sep 13, 2022
c13031e
BEP016: Revert "_param-all"
Lestropie Sep 13, 2022
2b40cb7
Merge pull request #64 from bids-standard/no_paramall
Lestropie Sep 13, 2022
4489a0c
BEP016: Adopt "model fit parameters" terminology
Lestropie Sep 13, 2022
f4a7239
BEP016: Remove references to removed "pdf" data representation
Lestropie Sep 13, 2022
419b25f
Merge pull request #65 from bids-standard/model_fit_parameters
Lestropie Sep 13, 2022
ed53944
Merge pull request #66 from bids-standard/remove_pdf
Lestropie Sep 13, 2022
eddad22
DWI derivatives: Make tensor a data representation
Lestropie Oct 7, 2022
bcd768c
DWI derivatives: Fix ModelDescription in exemplars
Lestropie Oct 7, 2022
c1814fa
Merge pull request #75 from bids-standard/model_description
Lestropie Oct 7, 2022
3ece540
update based on current BIDS spec master
PeerHerholz Nov 10, 2022
2c4932f
Merge pull request #78 from PeerHerholz/update_specification
arokem Nov 14, 2022
235552a
Merge branch 'master' into bep-016
arokem Nov 14, 2022
53f7484
Merge branch 'master' into bep-016
arokem Nov 28, 2022
6da90d4
Merge branch 'master' into bep-016
PeerHerholz Apr 25, 2023
7994706
Adds the descoteaux 2007 convention.
arokem Apr 25, 2023
f7e6f43
Merge pull request #80 from arokem/adds_descoteaux
arokem Apr 25, 2023
2fa5940
Change from strange html encoding to "<" and ">"
arokem Apr 29, 2023
8dee2f0
Merge pull request #81 from arokem/adds_descoteaux
arokem Apr 29, 2023
dd8fe32
Fix codespell-detected British spellings.
arokem Apr 29, 2023
a0cadd3
Merge pull request #82 from arokem/fix-british-spellings
arokem Jun 27, 2023
9a68b41
Merge branch 'master' into bep-016
arokem Jun 28, 2023
7a605fd
Replace the latin "etc" with ellipses.
arokem Jun 28, 2023
ab2b4cd
Merge pull request #83 from arokem/fix-validation
arokem Jun 29, 2023
0a04ee6
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
48a6a42
Merge branch 'master' into bep-016
arokem Mar 29, 2024
c6e50fc
Merge branch 'bep-016' into tensor_as_representation
Lestropie Apr 23, 2024
ab173a5
Merge pull request #74 from bids-standard/tensor_as_representation
Lestropie Apr 23, 2024
c62a2d7
BEP016: Major changes
Lestropie Apr 26, 2024
a2c35b8
BEP016: Fis JSON formatting in demonstrative examples
Lestropie Apr 26, 2024
8672cbe
Diffusion models: Forbid negative spherical coordinate radius
Lestropie Apr 26, 2024
7a123d5
Diffusion model derivatives: Spelling fixes
arokem May 1, 2024
1b50e3e
Merge pull request #92 from bids-standard/dwimap_and_no_inheritance
arokem May 14, 2024
148f9fa
Merge branch 'master' into bep-016
arokem May 14, 2024
4cf0723
Apply US spelling. Addresses current codespell CI failure.
arokem May 14, 2024
1317863
Markdown table linting
arokem May 14, 2024
77dbfbd
Get rid of a few latin phrases (i.e., "e.g.").
arokem May 14, 2024
156359a
DWI models: Define "bvec" orientation reference
Lestropie May 15, 2024
adb0e62
DWI models: Force presence of "param" entity
Lestropie May 15, 2024
2ac5549
DWI models: add "ParameterURL" metadata field
Lestropie May 15, 2024
4b8c56e
Merge remote-tracking branch 'origin/bep-016' into dependabot/github_…
Lestropie May 15, 2024
3bb9da0
Clarify metadata fields relevance (#102)
Lestropie May 15, 2024
9163f9d
Merge pull request #87 from bids-standard/dependabot/github_actions/a…
Lestropie May 15, 2024
9c3ceda
Merge pull request #97 from arokem/us-spelling
Lestropie May 15, 2024
73e4252
Merge branch 'bep-016' into metadata_parameterurl
arokem May 15, 2024
37b1bad
Merge pull request #101 from bids-standard/metadata_parameterurl
arokem May 15, 2024
c73cf54
Merge branch 'bep-016' into force_param_entity
arokem May 15, 2024
3f5f38d
Merge pull request #99 from bids-standard/force_param_entity
arokem May 15, 2024
e4df23c
Removes one more i.e.
arokem May 15, 2024
a26ccbd
Merge pull request #103 from arokem/one_more_latin
Lestropie May 15, 2024
277723a
New appendix page: spherical harmonics
Lestropie May 16, 2024
900381c
BEP016: Utilize filesystem macro
Lestropie May 16, 2024
c531a0a
BEP016: Reformat demonstrative examples
Lestropie May 16, 2024
9cb1e09
BEP016: Don't use filesystem macros for templates
Lestropie May 17, 2024
f115ec4
BEP016: Comment filesystem macros
Lestropie May 17, 2024
1fb734f
Merge pull request #105 from bids-standard/filesystem_macros
Lestropie May 17, 2024
30f7c6b
Appendix: SH: Fix LaTeX equations
Lestropie May 18, 2024
b093ac1
DWI models: Update bvec reference
Lestropie Jun 5, 2024
d56816d
Merge branch 'master' into bep-016
arokem Jun 5, 2024
bda570f
Merge remote-tracking branch 'origin/bep-016' into bvec_reference_axes
Lestropie Jun 5, 2024
1ce38c2
Merge pull request #98 from bids-standard/bvec_reference_axes
Lestropie Jun 5, 2024
edab0fd
Merge branch 'master' into bep-016
arokem Aug 20, 2024
b210dc0
chore(deps): bump codecov/codecov-action from 4 to 5
dependabot[bot] Nov 18, 2024
2e13940
Merge branch 'master' into bep-016
arokem Sep 15, 2025
248828b
chore(deps): bump astral-sh/setup-uv from 6 to 7
dependabot[bot] Nov 1, 2025
7a1a724
chore(deps): bump the actions-infrastructure group across 1 directory…
dependabot[bot] Dec 1, 2025
9302519
chore(deps): bump peter-evans/create-pull-request from 7 to 8
dependabot[bot] Jan 1, 2026
9a10402
Merge pull request #109 from bids-standard/dependabot/github_actions/…
Lestropie Mar 25, 2026
804f8f4
Merge pull request #111 from bids-standard/dependabot/github_actions/…
Lestropie Mar 25, 2026
7bd1565
Merge pull request #114 from bids-standard/dependabot/github_actions/…
Lestropie Mar 25, 2026
57a1853
Merge branch 'bep-016' into dependabot/github_actions/actions-infrast…
Lestropie Mar 25, 2026
6a4c2d9
Merge pull request #113 from bids-standard/dependabot/github_actions/…
Lestropie Mar 25, 2026
16773d1
Merge branch 'bep-016' into sh_to_appendix
Lestropie Mar 25, 2026
0d5afae
Appendix: SH: Remove use of SH "degree"
Lestropie Mar 25, 2026
3fc940f
BEP016: Renaming relevant to FSL
Lestropie Mar 25, 2026
58afad6
Merge pull request #104 from bids-standard/sh_to_appendix
Lestropie Mar 25, 2026
8bf0c9e
Merge remote-tracking branch 'origin/bep-016' into fsl_renaming
Lestropie Mar 25, 2026
4f4dcde
Merge pull request #115 from bids-standard/fsl_renaming
Lestropie Mar 25, 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
18 changes: 9 additions & 9 deletions .github/workflows/changelog_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
github_changelog_generator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
cat ~/changelog_build/CHANGES.md
- name: Archive changelog
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: changelog_pre_lint
path: |
Expand All @@ -62,14 +62,14 @@ jobs:
needs: github_changelog_generator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Download previously build changelog
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: changelog_pre_lint
path: ~/changelog_build
- name: Set up Node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install remark and extensions
Expand All @@ -93,7 +93,7 @@ jobs:
head -n 25 ~/changelog_build/CHANGES.md
npx remark ~/changelog_build/CHANGES.md --rc-path ${{ github.workspace }}/.remarkrc --frail --quiet --no-stdout
- name: Archive linted changelog
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: changelog_post_lint
path: |
Expand All @@ -108,9 +108,9 @@ jobs:
if: contains(github.event.head_commit.message, '[build changelog]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Download previously build changelog
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: changelog_post_lint
path: ~/changelog_build
Expand All @@ -123,7 +123,7 @@ jobs:
git add ${{ github.workspace }}/src/CHANGES.md
git commit -m "[DOC] Auto-generated changelog entry"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: changelog_generator_update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0
filter: "blob:none"
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: 3
- run: env
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/schemacode_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
attestations: write
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
- name: "Build archive on tag"
run: |
Expand Down Expand Up @@ -62,10 +62,10 @@ jobs:
python-version: 3.13
name: ${{ matrix.os }} with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }} (uv)
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
Expand All @@ -74,7 +74,7 @@ jobs:
run: python -c "import sys; print(sys.version)"

- name: "Fetch packages"
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: Packages
path: dist
Expand All @@ -95,7 +95,7 @@ jobs:
working-directory: tools/schemacode

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: unit_${{ matrix.os }}_${{ matrix.python-version }}
path: tools/schemacode/coverage.xml
Expand All @@ -112,7 +112,7 @@ jobs:

steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: Packages
path: dist
Expand All @@ -131,10 +131,10 @@ jobs:
runs-on: ubuntu-latest
name: Validate schema
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set Up Python environment
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.11"

Expand All @@ -150,7 +150,7 @@ jobs:
working-directory: tools/schemacode

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: schema_validation
path: tools/schemacode/coverage.xml
Expand All @@ -162,10 +162,10 @@ jobs:
needs: [test, validate_schema]
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Download artifacts
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6

- name: Upload to CodeCov
uses: codecov/codecov-action@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt update && sudo apt install -y shellcheck
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: codespell-project/actions-codespell@master

# Markdown formatting
remark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
- name: Install dependencies
Expand All @@ -36,35 +36,35 @@ jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Lint yml files in src/schema
run: uvx yamllint -f standard src/schema/ -c .yamllint.yml

# Python best practices
python-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uvx ruff format --diff
- run: uvx ruff check

# Avoid Latin phrases to improve readability
latin-phrases:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Check for Latin phrases
run: uv run tools/no-bad-latin.py

# Validate CITATION.cff
validate_cff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Validate CITATION.cff
run: uvx cffconvert --validate
- name: Check for Zenodo compatibility
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ nav:
- Quantitative MRI: appendices/qmri.md
- Arterial Spin Labeling: appendices/arterial-spin-labeling.md
- Cross modality correspondence: appendices/cross-modality-correspondence.md
- Spherical Harmonics: appendices/spherical-harmonics.md
- Changelog: CHANGES.md
- The BIDS Starter Kit:
- Website: https://bids.neuroimaging.io/getting_started/
Expand Down
106 changes: 106 additions & 0 deletions src/appendices/spherical-harmonics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Spherical Harmonics

Spherical Harmonics (SH) are continuous functions defined on the surface of the sphere.
They may be used to encode directionally dependent information;
for instance, the distribution of white matter fibre orientations within an image voxel.
This page provides the requisite information on the different basis sets that may be used,
and how coefficients of such functions may be encoded within a data file.

## SH functions

![SH functions](https://latex.codecogs.com/gif.latex?Y_l^m(\theta,\phi)&space;=&space;\sqrt{\frac{(2l&plus;1)}{4\pi}\frac{(l-m)!}{(l&plus;m)!}}&space;P_l^m(\cos&space;\theta)&space;e^{im\phi})

for integer *order* *l*, *phase* *m*, associated Legendre polynomials *P*.

## Truncated basis coefficients

![SH basis coefficients](https://latex.codecogs.com/gif.latex?f(\theta,\phi)&space;=&space;\sum_{l=0}^{l_\text{max}}&space;\sum_{m=-l}^{l}&space;c_l^m&space;Y_l^m(\theta,\phi))

for *maximum* spherical harmonic order *l<sub>max</sub>*.

## Real-valuedness

All functions represented using a spherical harmonics basis are assumed to be real.
This implies conjugate symmetry;
that is: *Y*(*l*,-*m*) = *Y*(*l*,*m*)\*,
where \* denotes the complex conjugate.

## Antipodal symmetry

All functions currently represented using a spherical harmonics based are assumed to be antipodally symmetric.
This implies that all basis functions with odd order are zero.

## Bases

### `mrtrix3`

![MRtrix3 SH basis](https://latex.codecogs.com/gif.latex?Y_{lm}(\theta,\phi)=\begin{Bmatrix}&space;0&\text{if&space;}l\text{&space;is&space;odd},\\&space;\sqrt{2}\times\text{Im}\left[Y_l^{-m}(\theta,\phi)\right]&\text{if&space;}m<0,\\&space;Y_l^0(\theta,\phi)&\text{if&space;}m=0,\\&space;\sqrt{2}\times\text{Re}\left[Y_l^m(\theta,\phi)\right]&\text{if&space;}m>0\\&space;\end{Bmatrix})

### `descoteaux`

![Descoteaux SH basis functions](https://latex.codecogs.com/gif.latex?Y_{lm}(\theta,\phi)=\begin{Bmatrix}&space;0&\text{if&space;}l\text{&space;is&space;odd},\\&space;\sqrt{2}\times\text{Re}\left[Y_l^{-m}(\theta,\phi)\right]&\text{if&space;}m<0,\\&space;Y_l^0(\theta,\phi)&\text{if&space;}m=0,\\&space;\sqrt{2}\times\text{Im}\left[Y_l^m(\theta,\phi)\right]&\text{if&space;}m>0\\&space;\end{Bmatrix})

## Zonal Spherical Harmonics

*Zonal* Spherical Harmonics (ZSH) refer to spherical harmonic functions for which all coefficients
of non-zero order *m* are zero.
These functions are therefore invariant under rotation about some zenith axis.

![ZSH](https://latex.codecogs.com/gif.latex?Z_{l}(\theta,\phi)=Z_{l}(\theta)=Y_{l0})

## Serialization and deserialization

This is used to, for instance,
store coefficients in a spherical harmonic basis within volumes of a 4D NIfTI image.

### SH serialiszation and deserialization

For coefficient index *n* and spherical harmonic basis function coefficient *Y<sub>l,m</sub>*:

*n<sub>l,m</sub>* = (*l*(*l*+1) / 2) + *m*

| ***n*** | **Coefficient** |
| ------- | ------------------ |
| 0 | *Y<sub>0,0</sub>* |
| 1 | *Y<sub>2,-2</sub>* |
| 2 | *Y<sub>2,-1</sub>* |
| 3 | *Y<sub>2,0</sub>* |
| 4 | *Y<sub>2,1</sub>* |
| 5 | *Y<sub>2,2</sub>* |
| 6 | *Y<sub>4,-4</sub>* |
| 7 | *Y<sub>4,-3</sub>* |
| ... | ... |

Relationship between maximal spherical harmonic degree *l<sub>max</sub>*
and total number of coefficients *N*:

*N* = ((*l<sub>max</sub>*+1) x (*l<sub>max</sub>*+2)) / 2

| ***l<sub>max</sub>*** | 0 | 2 | 4 | 6 | 8 | 10 | ... |
| --------------------- |--:|--:|--: |--: |--: |--: | :--: |
| ***N*** | 1 | 6 | 15 | 28 | 45 | 66 | ... |

### ZSH serialization and deserialization

For coefficient index *n* and zonal spherical harmonic basis function coefficient *Z<sub>l</sub>*:

*n<sub>l</sub>* = *l* / 2

| ***n*** | **Coefficient** |
| ------- | ---------------- |
| 0 | *Z<sub>0</sub>* |
| 1 | *Z<sub>2</sub>* |
| 2 | *Z<sub>4</sub>* |
| 3 | *Z<sub>6</sub>* |
| 4 | *Z<sub>8</sub>* |
| 5 | *Z<sub>10</sub>* |
| ... | ... |

Relationship between maximal zonal spherical harmonic degree *l<sub>max</sub>*
and total number of coefficients *N*:

*N* = 1 + *l*/2

| ***l<sub>max</sub>*** | 0 | 2 | 4 | 6 | 8 | 10 | ... |
| --------------------- |--:|--:|--:|--:|--:|--: | :--: |
| ***N*** | 1 | 2 | 3 | 4 | 5 | 6 | ... |
Loading
Loading