Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e60e6ae
Introduced option to start with edited labels
kdiers Jul 28, 2025
095a360
Updated requirements
kdiers Jul 28, 2025
43ce812
Rename ruff per-file ignores section
m-reuter Nov 24, 2025
623b0f8
Introduced option to start with edited masks
kdiers Jun 12, 2026
b056a72
Updated version
kdiers Jun 12, 2026
a95f97e
Introduced cortical and entorhinal extensions
kdiers Jun 22, 2026
fead7cb
Formatting
kdiers Jun 22, 2026
34ef574
Merge branch 'main' into dev
kdiers Jun 22, 2026
040aa1e
Updated version
kdiers Jun 22, 2026
4242c62
Updated atlases
kdiers Jun 22, 2026
9cbc41e
Updated tutorial
kdiers Jun 23, 2026
c611ff6
Included entorhinal and cortical modes
kdiers Jun 23, 2026
f3fd301
Updated tutorial
kdiers Jun 23, 2026
d105f69
Updated LUTs
kdiers Jun 23, 2026
572580d
Added orientation definition for hc+ctx processing
kdiers Jun 23, 2026
64358bd
Revised entorhinal boundaries
kdiers Jun 23, 2026
198a49e
Consider ras coords for EV flipping
kdiers Jun 23, 2026
97a3ee9
Ignore long lines
kdiers Jun 24, 2026
80203ae
Excluded BA36
kdiers Jun 24, 2026
af3ba25
Removed build for python 3.9, added 3.14
kdiers Jun 24, 2026
88dcba7
Apply suggestions from code review
kdiers Jun 24, 2026
a0ebc0a
Apply suggestions from code review
kdiers Jun 24, 2026
a765d2c
Formatting
kdiers Jun 24, 2026
5c06926
Removed support for python 3.9, added 3.14
kdiers Jun 24, 2026
9f92f2d
Updated images folder
kdiers Jun 24, 2026
0cf6056
Updated documentation
kdiers Jun 24, 2026
dfd6dcd
Updated version
kdiers Jun 24, 2026
f7adbce
Fixed typo
kdiers Jun 24, 2026
5dd9d92
Updated build matrix and supported python versions
kdiers Jun 24, 2026
1833080
Removed restriction to numpy<2
kdiers Jun 24, 2026
3130774
Updated version
kdiers Jun 24, 2026
d5232c0
Added strict=True for zip()
kdiers Jun 24, 2026
fe6346c
Added local ignores for long lines instead of project-wide ignore
kdiers Jun 24, 2026
0b8ec4d
Updated lut selection
kdiers Jun 24, 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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
name: ${{ matrix.os }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hippocampal shape and thickness analysis as described in our recent [publication

Please see the [documentation pages](https://deep-mi.org/hipsta/dev/index.html) for a general overview, usage information and
examples, and output description. Brief usage information is also available [here](hipsta/doc/DOCUMENTATION.md).
Some suggestions for running the script can be found in the [tutorial](TUTORIAL.md).
Some suggestions for running the script can be found in the [tutorial](https://deep-mi.org/hipsta/dev/tutorials/index.html).


## Current status:
Expand Down Expand Up @@ -75,7 +75,7 @@ exist as an environment variable and point to a valid FreeSurfer installation.
or the ASHS software. A custom segmentation is also permissible (some restrictions
and settings apply; see [Supported Segmentations](https://github.com/Deep-MI/Hipsta#supported-segmentations)).

3. Python 3.8 or higher including the lapy, numpy, scipy, nibabel, pyvista, and
3. Python 3.10 or higher including the lapy, numpy, scipy, nibabel, pyvista, and
pyacvd libraries, among others. See `requirements.txt` for a full list, and use
`pip install -r requirements.txt` to install.

Expand Down
61 changes: 56 additions & 5 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ argument.

Since no explicit labels for the hippocampal head are present in ASHS
segmentations, it will be necessary to use the `--automask-head` flag and
optionally also the `--automask-tail-margin` argument. If the identification of
the boundary between hippocampal body tail does not work well given the existing
labels, using the `--automask-tail` flag and optionally the `--automask-head-margin`
optionally also the `--automask-head-margin` argument. If the identification of
the boundary between hippocampal body and tail does not work well given the existing
labels, using the `--automask-tail` flag and optionally the `--automask-tail-margin`
argument may be advised as well.

### Additional arguments for ASHS and FreeSurfer segmentations
Expand All @@ -264,10 +264,10 @@ The primary output of the hippocampal shape and thickness analysis are surface
files and associated thickness values in the `thickness` folder. The estimated
hippocampal thickness values will be stored in csv tables:

| Filenane | Contents |
| Filename | Contents |
|----------------------------------------------------|-----------------------------------------------------------|
| `lh.grid-segments-x.csv`, `rh.grid-segments-x.csv` | Length estimates in the medial-to-lateral dimension |
| `lh.grid-segments-y.csv`, `rh.grid-segments-y.csv` | Length estimates in the medial-to-lateral dimension |
| `lh.grid-segments-y.csv`, `rh.grid-segments-y.csv` | Length estimates in the posterior-to-anterior dimension |
| `lh.grid-segments-z.csv`, `rh.grid-segments-z.csv` | Thickness estimates in the exterior-to-interior dimension |

Here, x corresponds to the medial-->lateral dimension, y to the
Expand Down Expand Up @@ -303,6 +303,57 @@ provided for interior, mid, and exterior surfaces:
| `<lh\|rh>.<int\|mid\|ext>-surface.<mean\|gauss>-curv.mgh` | Overlays of mean and gaussian curvature estimtes for corresponding surfaces |


## Extensions to parahippocampal and entorhinal cortex

The Penn ABC-3T ASHS atlas includes several labels beyond the hippocampus,
including parahippocampal, entorhinal, BA35, and BA36 regions. The analysis can
extended to parts of these regions as well. The corresponding processing
variants can be called with the `--lut ashs-penn_abc_3t_t2_ext` and `--lut ashs-penn_abc_3t_t2_ent`
arguments. The former will add (parts of) parahippocampal and entorhinal cortex
as well as BA35 to the analysis, but still restrict the analysis to the
hippocampal body region along the longitudinal axis.
The latter will perform a separate analysis of the entorhinal cortex. Due to
more complex or variable anatomy, these approaches should to some extent be
considered experimental and may require additional QC or manual edits.

The expected output when using `--lut ashs-penn_abc_3t_t2_ext` is shown in the
following figure; it is simply an extension of the analysis beyond the
subiculum and presubiculum into the cortex.

![](images/scaled/ctx-01.png)

A potential issue that might arise in this analysis could be due to large shifts
between segmentations in successive slices, especially for anisotropic voxel
sizes, leading to holes in the surface mesh. Another potential issue is too close
proximity of the subiculum / CA1 and cortical regions so that the surface mesh
will incorrectly create a connection. Manual edits or changing the
spatial filter settings may help resolving these issues (see the following
section on Troubleshooting for details).

![](images/scaled/ctx-03a.png)
![](images/scaled/ctx-03b.png)
![](images/scaled/ctx-03c.png)
![](images/scaled/ctx-02.png)

The expected output when using `--lut ashs-penn_abc_3t_t2_ent` is shown below.
Here, we leave out the hippocampal labels and restrict the analysis the
complete entorhinal cortex segmentation.

![](images/scaled/erc-01a.png)
![](images/scaled/erc-01b.png)
![](images/scaled/erc-01c.png)

Care should be taken that the entorhinal cortex is cut across its full extent
at its anterior and posterior ends. The left figure shows to conservative
cutting, the middle and right figure more appropriate cuts. Cutting can be
adjusted using the `--cut-range` and `--automask-head-margin` / `--automask-tail-margin`
arguments (see the following section on Troubleshooting for details).

![](images/scaled/erc-02a.png)
![](images/scaled/erc-02b.png)
![](images/scaled/erc-02c.png)


## Troubleshooting

### Logfiles
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1.3
0.10.0
2 changes: 0 additions & 2 deletions doc/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
=======

```{include} ../../TUTORIAL.md
:relative-images:
```
63 changes: 58 additions & 5 deletions hipsta/cfg/atlases.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_atlases(lut):

LUTINDEX = [226, [233, 235, 237, 239, 245], 234, 236, 238, 240, 240, 242, 244, 246]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX))
LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [234, 236, 238, 240, 246]

Expand All @@ -37,7 +37,7 @@ def get_atlases(lut):

LUTINDEX = [226, [233, 235, 237, 239, 245], 234, 236, 238, 240, 240, 242, 244]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX))
LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [234, 236, 238, 240]

Expand All @@ -63,10 +63,62 @@ def get_atlases(lut):

LUTINDEX = [1, 2, 4, 3, 3, 5, 8, 8, 9, 10, 11, 12, 20, 5]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX))
LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [8, 1, 2, 4]

elif lut == "ashs-penn_abc_3t_t2_ent":
LOGGER.info("Found internal, modified look-up table for the Penn ABC-3T ASHS Atlas for T2-weighted MRI.")

LUTLABEL = [
"ca1",
"ca2",
"ca3",
"ca4",
"dg",
"tail_orig",
"subiculum",
"presubiculum",
"entorhinal",
"ba35",
"ba36",
"parahippocampal",
"head",
"tail",
]

LUTINDEX = [1, 2, 4, 3, 3, 5, 8, 8, 9, 10, 11, 12, 20, 5]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [9]

elif lut == "ashs-penn_abc_3t_t2_ext":
LOGGER.info("Found internal, modified look-up table for the Penn ABC-3T ASHS Atlas for T2-weighted MRI.")

LUTLABEL = [
"ca1",
"ca2",
"ca3",
"ca4",
"dg",
"tail_orig",
"subiculum",
"presubiculum",
"entorhinal",
"ba35",
"ba36",
"parahippocampal",
"head",
"tail",
]

LUTINDEX = [1, 2, 4, 3, 3, 5, 8, 8, 9, 10, 11, 12, 20, 5]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [12, 10, 9, 8, 1, 2, 4]

elif lut == "ashs-umcutrecht_7t":
LOGGER.info("Found internal, modified look-up table for ASHS UMC Utrecht 7T atlas.")

Expand All @@ -86,7 +138,7 @@ def get_atlases(lut):

LUTINDEX = [1, 2, 2, 3, 4, 5, 6, 5, 7, 8, 20]

LUTDICT = dict(zip(LUTLABEL, LUTINDEX))
LUTDICT = dict(zip(LUTLABEL, LUTINDEX, strict=True))

HSFLIST = [2, 3, 4, 6]

Expand All @@ -105,7 +157,7 @@ def get_atlases(lut):

lut = lut[lut[1].str.lower().isin(["presubiculum", "subiculum", "head", "tail", "ca1", "ca2", "ca3", "ca4"])]

LUTDICT = dict(zip(lut[1], lut[0]))
LUTDICT = dict(zip(lut[1], lut[0], strict=True))

HSFLIST = list(lut[1])

Expand All @@ -121,6 +173,7 @@ def get_atlases(lut):
LUTDICT["bndtail"] = 2260
LUTDICT["bndhead"] = 2320
LUTDICT["bndca4"] = 2420
LUTDICT["bndba35"] = 100

# return

Expand Down
4 changes: 3 additions & 1 deletion hipsta/cfg/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This module provides configuration defaults for the hippocampal shape and
This module provides configuration defaults for the hippocampal shape and
thickness analysis package.

"""
Expand All @@ -10,6 +10,8 @@ def get_defaults(x):
# note: if changing these values, remember to adjust the argparse help
# messages as well as the run_hipsta docstring also
# options
start_with_edited_labels=False,
start_with_edited_masks=False,
no_cleanup=False,
no_crop=False,
upsample=False,
Expand Down
Loading
Loading