brainscapes issueshttps://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues2021-04-13T09:05:30+02:00https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/17Regions extracted using same bounding box from BigBrain histology and isocort...2021-04-13T09:05:30+02:00Schiffer, Christianc.schiffer@fz-juelich.deRegions extracted using same bounding box from BigBrain histology and isocortex segmentation are not alignedGiven a bounding box, I tried to extract a region from the BigBrain histological space and the corresponding isocortex segmentation.
Since I used the same bounding box for both, I would expect the resulting volumes to be aligned (up to t...Given a bounding box, I tried to extract a region from the BigBrain histological space and the corresponding isocortex segmentation.
Since I used the same bounding box for both, I would expect the resulting volumes to be aligned (up to the precision of the cortex segmentation), but they are not.
This is the code I used:
```python
import numpy as np
import brainscapes as bs
from nilearn import plotting
from cloudvolume import Bbox
bb_img = bs.bigbrain.BigBrainVolume(bs.spaces.BIG_BRAIN_HISTOLOGY.url)
# Define two points in BigBrain space
p0 = np.array((-3.979, -61.256, 3.906))
p1 = np.array((5.863, -55.356, -2.487))
def mm_to_vox(p0, p1, img, mip):
# Bounding box needs to be defined in voxel space, so we need to apply the inverse affine matrix to the points
inv_aff = np.linalg.inv(img.affine(mip))
p0_vox = np.dot(inv_aff[:3, :3], p0) + inv_aff[:3, -1]
p1_vox = np.dot(inv_aff[:3, :3], p1) + inv_aff[:3, -1]
return p0_vox, p1_vox
# Read region from BigBrain
mip = 0
p0_vox, p1_vox = mm_to_vox(p0, p1, img=bb_img, mip=mip)
# Define bounding box
bbox = Bbox(p0_vox, p1_vox)
img = bb_img.Image(clip=bbox, mip=mip, force=True)
mask_url = "https://neuroglancer.humanbrainproject.eu/precomputed/BigBrainRelease.2015/classif/"
mask_img = bs.bigbrain.BigBrainVolume(mask_url)
# Bounding box needs to be redefined, as mask_img has different voxel space
p0_vox, p1_vox = mm_to_vox(p0, p1, img=mask_img, mip=mip)
# Define bounding box
bbox = Bbox(p0_vox, p1_vox)
mask = mask_img.Image(clip=bbox, mip=mip, force=True)
# Plot on top of each other. I would expect these images to be aligned, since I used the same bounding box, but they are not.
plotting.view_img(mask,
bg_img=img,
cmap="gray",
vim=0,
vmax=255,
resampling_interpolation="nearest",
symmetric_cmap=False)
```
I could imagine that there is an issue with how the bounding box coordiantes are rounded internally to match to the voxel space.https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/16Image function of BigBrainVolume expects bounding box to be in voxel space2021-04-13T08:54:14+02:00Schiffer, Christianc.schiffer@fz-juelich.deImage function of BigBrainVolume expects bounding box to be in voxel spaceIf passing a bounding box to the `clip` argument to the `Image` function of `BigBrainVolume`, it expects the bounding box to be specified in voxel space of the specified resolution, which is highly inconvenient for users.
The bounding bo...If passing a bounding box to the `clip` argument to the `Image` function of `BigBrainVolume`, it expects the bounding box to be specified in voxel space of the specified resolution, which is highly inconvenient for users.
The bounding box should be defined in millimeter space and the class should do the conversion itself (which it can do using it's affine matrix).
@t.dickscheidhttps://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/15Rename functions affine and Image of BigBrainVolume2021-04-13T08:50:36+02:00Schiffer, Christianc.schiffer@fz-juelich.deRename functions affine and Image of BigBrainVolume@t.dickscheid The names of functions `affine`and `Image` of the `BigBrainVolume` class are misleading.
Based on the naming, both of them are easily confused with an attribute or a properties.
I would not expect an entity called `affine` ...@t.dickscheid The names of functions `affine`and `Image` of the `BigBrainVolume` class are misleading.
Based on the naming, both of them are easily confused with an attribute or a properties.
I would not expect an entity called `affine` to be a function or to accept an argument.
In addition, `Image` does not confirm to the naming convention for functions or attributes, it looks more like a nested class.
I would suggest renaming the functions to imply what they are doing from the name, for example `buildAffine` or `getImage`.https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/14RegionProps Error2021-03-17T09:19:54+01:00v.marcenkoRegionProps ErrorWhen creating RegionProps for the following Input (see also code bellow):
- Parcellation: Julich-Brain Probabilistic Cytoarchitectonic Maps (v2.5)
- Space: MNI Colin 27
- Region: Area PFm (IPL) - right hemisphere
I get the following Err...When creating RegionProps for the following Input (see also code bellow):
- Parcellation: Julich-Brain Probabilistic Cytoarchitectonic Maps (v2.5)
- Space: MNI Colin 27
- Region: Area PFm (IPL) - right hemisphere
I get the following Error: `TypeError: Non-integer label_image types are ambiguous`
This error aslo occurs on other combinations of Parcellation/Space/Region
```
atlas = REGISTRY.MULTILEVEL_HUMAN_ATLAS
# Julich-Brain Probabilistic Cytoarchitectonic Maps (v2.5)
atlas.select_parcellation('minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-25')
# Region 'Area PFm (IPL) - right hemisphere'
selected_region = atlas.regiontree.find('Area PFm (IPL) - right hemisphere')
atlas.select_region(selected_region[0])
# MNI Colin 27
space_id = 'minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992'
r_props = regionprops.RegionProps(atlas, find_space_by_id(atlas, space_id))
```https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/12Provide autocompletion for parcellations and spaces linked to an atlas2021-03-15T14:41:46+01:00Dickscheid, TimoProvide autocompletion for parcellations and spaces linked to an atlasWhen selectin parcellations and spaces from an atlas object, the `atlas.spaces` and `atlas.parcellations` members should behave like the main `brainscapes.spaces` and `brainscapes.parcellations` glossaries, in that they allow autocomplti...When selectin parcellations and spaces from an atlas object, the `atlas.spaces` and `atlas.parcellations` members should behave like the main `brainscapes.spaces` and `brainscapes.parcellations` glossaries, in that they allow autocompltion and need not be used with list indices.Dickscheid, TimoDickscheid, Timohttps://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/8Runtime warning from scipy2021-01-30T14:06:10+01:00Köhnen, StefanRuntime warning from scipyRunning this JuGEx analysis:
```
from os import environ
environ['HBP_AUTH_TOKEN'] = "<<<Paste your HBP auth token here>>>"
import brainscapes as bs
bs.logger.setLevel("INFO")
atlas = bs.atlases.MULTILEVEL_HUMAN_ATLAS
atlas.select_parc...Running this JuGEx analysis:
```
from os import environ
environ['HBP_AUTH_TOKEN'] = "<<<Paste your HBP auth token here>>>"
import brainscapes as bs
bs.logger.setLevel("INFO")
atlas = bs.atlases.MULTILEVEL_HUMAN_ATLAS
atlas.select_parcellation(bs.parcellations.JULICH_BRAIN_PROBABILISTIC_CYTOARCHITECTONIC_MAPS_V2_5_)
atlas.enable_continuous_map_thresholding(0.2)
candidate_regions = ["v1 right", "v2 right"]
candidate_genes = ["MAOA","TAC1"]
jugex = bs.analysis.DifferentialGeneExpression(atlas)
jugex.add_candidate_genes(candidate_genes)
jugex.define_roi1(candidate_regions[0])
jugex.define_roi2(candidate_regions[1])
result = jugex.run(permutations=1000)
print(result['p-values'])
```
Causes this runtime warning from scipy:
```
/Users/xxxx/opt/anaconda3/lib/python3.8/site-packages/scipy/stats/_distn_infrastructure.py:1932: RuntimeWarning: invalid value encountered in less_equal
cond2 = cond0 & (x <= _a)
```
Versions:
* OS: macOS 10.15.5
* Python 3.8.3
* scipy: 1.5.0
Is anybody else experiencing similar warnings?https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/7Precompute regionprops for standard regions2021-01-30T14:08:48+01:00Dickscheid, TimoPrecompute regionprops for standard regionsComputing the surface area of a region is computationally expensive (marching cubes), but is constant for the same region over time. The spatial properties of brain regions should be precomputed and stored with the parcellation to avoid ...Computing the surface area of a region is computationally expensive (marching cubes), but is constant for the same region over time. The spatial properties of brain regions should be precomputed and stored with the parcellation to avoid costly recomputing and the client side.https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/5Error on populating the cache (probably related to gene-data from Allen Brain...2021-01-30T14:38:29+01:00Köhnen, StefanError on populating the cache (probably related to gene-data from Allen Brain API)```
Will retrieve a list of gene acronyms from Allen Atlas now.
This may take a minute.
Traceback (most recent call last):
File "aioserver.py", line 25, in <module>
import brainscapes
File "/webjugex/brainscapes/brainscapes/__...```
Will retrieve a list of gene acronyms from Allen Atlas now.
This may take a minute.
Traceback (most recent call last):
File "aioserver.py", line 25, in <module>
import brainscapes
File "/webjugex/brainscapes/brainscapes/__init__.py", line 24, in
<module>
from .atlas import REGISTRY as atlases
File "/webjugex/brainscapes/brainscapes/atlas.py", line 21, in <module>
from . import parcellations, spaces, features, logger
File "/webjugex/brainscapes/brainscapes/features/__init__.py", line
30, in <module>
extractor_types,gene_names,modalities = __init__()
File "/webjugex/brainscapes/brainscapes/features/__init__.py", line
22, in __init__
from .genes import AllenBrainAtlasQuery
File "/webjugex/brainscapes/brainscapes/features/genes.py", line 65,
in <module>
class AllenBrainAtlasQuery(FeatureExtractor):
File "/webjugex/brainscapes/brainscapes/features/genes.py", line 123,
in AllenBrainAtlasQuery
+"This may take a minute."))
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
Happens quite seldom, but we should maybe catch the error if it happens.https://jugit.fz-juelich.de/v.marcenko/brainscapes/-/issues/3build from dockerfile also results in error2020-10-29T09:49:30+01:00Gui, Xiaoyunbuild from dockerfile also results in errorcommand
```
docker build -t brainscape .
```
results in:
```
Sending build context to Docker daemon 220.2MB
Step 1/6 : FROM python:3.8-alpine
---> 8744555ae7bb
Step 2/6 : RUN apk update
---> Using cache
---> 6e57a4254f4a
Step 3/6 : ...command
```
docker build -t brainscape .
```
results in:
```
Sending build context to Docker daemon 220.2MB
Step 1/6 : FROM python:3.8-alpine
---> 8744555ae7bb
Step 2/6 : RUN apk update
---> Using cache
---> 6e57a4254f4a
Step 3/6 : RUN apk add make automake gcc g++ subversion python3-dev
---> Using cache
---> 1d26bffbff6d
Step 4/6 : ADD . /brainscapes_client
---> fd8a352f7c37
Step 5/6 : WORKDIR /brainscapes_client
---> Running in b970d5d565ba
Removing intermediate container b970d5d565ba
---> 4d6c90a6a6de
Step 6/6 : RUN pip install -r requirements.txt
---> Running in bd29d796eb5f
Collecting requests
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting nibabel
Downloading nibabel-3.2.0-py3-none-any.whl (3.3 MB)
Collecting anytree
Downloading anytree-2.8.0-py2.py3-none-any.whl (41 kB)
Collecting pandas
Downloading pandas-1.1.3.tar.gz (5.2 MB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: still running...
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
ERROR: Could not find a version that satisfies the requirement PIL (from -r requirements.txt (line 5)) (from versions: none)
ERROR: No matching distribution found for PIL (from -r requirements.txt (line 5))
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
```