Skip to content

Releases: BlueBrain/MorphIO

Add support for more markers

08 Feb 14:58
8fdd355
Compare
Choose a tag to compare
Improve marker handling (#229)

* Handle more markers

This commits assume that each marker can be suffixed with an arbitrary integer.
For example `Flower` is a valid marker but `Flower4` or `Flower4444` are now
also valid.

The list of valid marker tags has been updated based on the current morphology
repository that we have.

## Marker specification
Here is the regexes of supported markers:

- Dot[0-9]*
- Plus[0-9]*
- Cross[0-9]*
- Splat[0-9]*
- Flower[0-9]*
- Circle[0-9]*
- Flower[0-9]*
- TriStar[0-9]*
- OpenStar[0-9]*
- Asterisk[0-9]*
- SnowFlake[0-9]*
- OpenCircle[0-9]*
- ShadedStar[0-9]*
- FilledStar[0-9]*
- TexacoStar[0-9]*
- MoneyGreen[0-9]*
- DarkYellow[0-9]*
- OpenSquare[0-9]*
- OpenDiamond[0-9]*
- CircleArrow[0-9]*
- CircleCross[0-9]*
- OpenQuadStar[0-9]*
- DoubleCircle[0-9]*
- FilledSquare[0-9]*
- MalteseCross[0-9]*
- FilledCircle[0-9]*
- FilledDiamond[0-9]*
- FilledQuadStar[0-9]*
- OpenUpTriangle[0-9]*
- FilledUpTriangle[0-9]*
- OpenDownTriangle[0-9]*
- FilledDownTriangle[0-9]*

## Code snippet

Here is the code I used to generate the list of markers. I then had to manually
filter and check the result to obtain the final list of markers.

```python
import json
from itertools import chain

from morph_tool.utils import iter_morphology_files
from tqdm import tqdm

def create_token_list():
    files = list(iter_morphology_files('/home/bcoste/workspace/MorphologyRepository/',
                                       recursive=True))

    def is_not_number(token):
        try:
            float(token)
            return False
        except ValueError:
            return True

    def parse_line(line):
        tokens = line.split(';')[0].replace('(', ' ').replace(')', ' ').split()
        return filter(is_not_number, tokens)
    token = set()
    for f in tqdm(files):
        try:
            new_set = set(chain.from_iterable(parse_line(line) for line in f.open().readlines()))
            token = token | new_set
        except:
            print(f'failed parsing {f}')

    with open('bla.json', mode='w') as f:
        json.dump(list(token), f)

def read_token_list():
    with open('bla.json') as f:
        data = json.load(f)

    filtered = {'Settings\\user\\Desktop\\tkb02\\060206\\'}

    data = filter(lambda token: not token.startswith('0x'), data)
    data = filter(lambda token: token[0].isupper(), data)
    data = filter(lambda token: all(word not in token for word in filtered), data)
    data = sorted(data, key=lambda token: len(token))
    data = list(data)

    from pprint import pprint
    pprint(data)
```

Drop h5v2 support

05 Feb 16:54
f9319a2
Compare
Choose a tag to compare

Stop supporting h5v2 (#227)

If a h5v2 file is detected at loading time, the error message will point the user to the documentation for a way to convert it to h5v1.

https://github.com/BlueBrain/MorphIO#h5v2

Add support for BBP generated markers #228

04 Feb 18:03
0e82cac
Compare
Choose a tag to compare
Add support for BBP generated markers (#228)

At BBP we annotate files with potential issues with the Circle markers.
https://github.com/BlueBrain/MorphIO/issues/226

This commit adds support for such markers.

Add NeuroLucida marker support

04 Feb 17:00
fb23021
Compare
Choose a tag to compare
NeuroLucida markers are parsed and kept in Morphology::markers (#186)

## Description

A marker is an [s-expression](https://fr.wikipedia.org/wiki/S-expression) at the top level of the Neurolucida file that contains additional information about the morphology. For example:

```lisp
("pia"
  (Closed)
  (MBFObjectType 5)
  (0 1 2 3)
  (3 4 5 4)
  (6 7 8 5)
  (9 10 11 6)
 )
```

This PR adds a `Morphology.markers` attribute that stores the markers found in the file.
A Marker object has 3 attributes:
- label
- points
- diameters.

## Specification

The following s-expressions are parsed:
- Any s-exp with a top level string. Like:
    ```lisp
    ("pia"
    (Closed)
    (MBFObjectType 5)
    (0 1 2 3)
    (3 4 5 4)
    (6 7 8 5)
    (9 10 11 6)
    )
    ```
- An sexp with one of the following top level s-exp:
  * Dot
  * FilledCircle
  * SnowFlake
  * Asterisk
  * OpenCircle
  * OpenStar
  * Flower
  * OpenSquare
  * FilledStar
  * DoubleCircle
  
  Example:
  ```lisp
  (FilledCircle
  (Color RGB (64, 0, 128))
  (Name "Marker 11")
  (Set "axons")
  ( -189.59    55.67    28.68     0.12)  ; 1
  )  ;  End of markers
  ```

## Context

This has been requested by @lidakanari in order to extract pia and layer markers from LNMC NeuroLucida files.
https://bbpteam.epfl.ch/project/issues/browse/CELLS-31

## Usage

```python
cell = Morphology(os.path.join(_path, 'pia.asc'))
all_markers = cell.markers
pia = m.markers[0]

# fetch the label marker with the `label` attribute
assert_equal(pia.label, 'pia')

# fetch the points with the `points` attribute
assert_array_equal(pia.points,
                       [[0, 1, 2],
                        [3, 4, 5],
                        [6, 7, 8],
                        [9, 10, 11]])

# fetch the diameters with the `diameters` attribute
assert_array_equal(pia.diameters, [3, 4, 5, 6])
```

Freeze CellFamily for h5v2

03 Feb 14:49
2b9ddf7
Compare
Choose a tag to compare
🐛 Freeze CellFamily for h5v2 (#225)

H5v2 format only support 'Neuron' has a CellFamily so we don't
need to read the field and can directly set the value to Neuron.

Moreover, fixed a kind of bug where the metadata from h5v1 in `_readV11Metadata`
would be stored in the morpho properties even if the morpho is not of type h5v1.

Handle missing duplicates like NEURON does

29 Jan 15:18
689338b
Compare
Choose a tag to compare
v2.5.0

Fix brew in wheel building (#208)

First release with cibuildwheels

06 Jan 10:48
c7a501e
Compare
Choose a tag to compare
v2.4.1

Update publish-sdist-wheels.yml

v2.4.0: Adding GlialCell classes

13 Nov 12:48
d796359
Compare
Choose a tag to compare
Adding classes `morphio.GlialCell` and `morphio.mut.GlialCell` (#205)

I/O Improvements for HDF5 v1 Files

17 Sep 12:42
44a1016
Compare
Choose a tag to compare

Supports parsing number starting with a '+' symbol in NeuroLucida (#196)
I/O Improvements for HDF5 v1 Files (#194)
Test negative section type raises in H5 format (#195)
Fix one docstring (#190)
Bump highfive version to 2.2 (#189)

Windows CI

28 May 10:17
e7b6e2c
Compare
Choose a tag to compare
v2.3.10

Do not keep the h5py to top level (#188)