Coverage for ibllib/atlas/atlas.py: 86%
28 statements
« prev ^ index » next coverage.py v7.5.4, created at 2024-07-08 17:16 +0100
« prev ^ index » next coverage.py v7.5.4, created at 2024-07-08 17:16 +0100
1"""
2Classes for manipulating brain atlases, insertions, and coordinates.
3"""
5import warnings
6import iblatlas.atlas
9def deprecated_decorator(function):
10 def deprecated_function(*args, **kwargs):
11 warning_text = f"{function.__module__}.{function.__name__} is deprecated. " \ 1aghbcdef
12 f"Use iblatlas.{function.__module__.split('.')[-1]}.{function.__name__} instead"
13 warnings.warn(warning_text, DeprecationWarning) 1aghbcdef
14 return function(*args, **kwargs) 1aghbcdef
16 return deprecated_function
19@deprecated_decorator
20def BrainCoordinates(*args, **kwargs):
21 return iblatlas.atlas.BrainCoordinates(*args, **kwargs) 1def
24@deprecated_decorator
25def BrainAtlas(*args, **kwargs):
26 return iblatlas.atlas.BrainAtlas(*args, **kwargs)
29class Trajectory(iblatlas.atlas.Trajectory):
30 """
31 3D Trajectory (usually for a linear probe), minimally defined by a vector and a point.
33 Examples
34 --------
35 Instantiate from a best fit from an n by 3 array containing xyz coordinates:
37 >>> trj = Trajectory.fit(xyz)
38 """
41class Insertion(iblatlas.atlas.Insertion):
42 """
43 Defines an ephys probe insertion in 3D coordinate. IBL conventions.
45 To instantiate, use the static methods: `Insertion.from_track` and `Insertion.from_dict`.
46 """
49@deprecated_decorator
50def AllenAtlas(*args, **kwargs):
51 return iblatlas.atlas.AllenAtlas(*args, **kwargs) 1abc
54@deprecated_decorator
55def NeedlesAtlas(*args, **kwargs):
56 """
57 Instantiates an atlas.BrainAtlas corresponding to the Allen CCF at the given resolution
58 using the IBL Bregma and coordinate system. The Needles atlas defines a stretch along AP
59 axis and a squeeze along the DV axis.
61 Parameters
62 ----------
63 res_um : {10, 25, 50} int
64 The Atlas resolution in micrometres; one of 10, 25 or 50um.
65 **kwargs
66 See AllenAtlas.
68 Returns
69 -------
70 AllenAtlas
71 An Allen atlas object with MRI atlas scaling applied.
73 Notes
74 -----
75 The scaling was determined by manually transforming the DSURQE atlas [1]_ onto the Allen CCF.
76 The DSURQE atlas is an MRI atlas acquired from 40 C57BL/6J mice post-mortem, with 40um
77 isometric resolution. The alignment was performed by Mayo Faulkner.
78 The atlas data can be found `here <http://repo.mouseimaging.ca/repo/DSURQE_40micron_nifti/>`__.
79 More information on the dataset and segmentation can be found
80 `here <http://repo.mouseimaging.ca/repo/DSURQE_40micron/notes_on_DSURQE_atlas>`__.
82 References
83 ----------
84 .. [1] Dorr AE, Lerch JP, Spring S, Kabani N, Henkelman RM (2008). High resolution
85 three-dimensional brain atlas using an average magnetic resonance image of 40 adult C57Bl/6J
86 mice. Neuroimage 42(1):60-9. [doi 10.1016/j.neuroimage.2008.03.037]
87 """
89 return iblatlas.atlas.NeedlesAtlas(*args, **kwargs)
92@deprecated_decorator
93def MRITorontoAtlas(*args, **kwargs):
94 """
95 The MRI Toronto brain atlas.
97 Instantiates an atlas.BrainAtlas corresponding to the Allen CCF at the given resolution
98 using the IBL Bregma and coordinate system. The MRI Toronto atlas defines a stretch along AP
99 a squeeze along DV *and* a squeeze along ML. These are based on 12 p65 mice MRIs averaged [1]_.
101 Parameters
102 ----------
103 res_um : {10, 25, 50} int
104 The Atlas resolution in micrometres; one of 10, 25 or 50um.
105 **kwargs
106 See AllenAtlas.
108 Returns
109 -------
110 AllenAtlas
111 An Allen atlas object with MRI atlas scaling applied.
113 References
114 ----------
115 .. [1] Qiu, LR, Fernandes, DJ, Szulc-Lerch, KU et al. (2018) Mouse MRI shows brain areas
116 relatively larger in males emerge before those larger in females. Nat Commun 9, 2615.
117 [doi 10.1038/s41467-018-04921-2]
118 """
119 return iblatlas.atlas.MRITorontoAtlas(*args, **kwargs)
122@deprecated_decorator
123def FranklinPaxinosAtlas(*args, **kwargs):
124 return iblatlas.atlas.FranklinPaxinosAtlas(*args, **kwargs)