@@ -44,6 +44,8 @@ def plot_brain_surface_figure(
4444 data : Mapping [str , Num ],
4545 species : str = "human" ,
4646 atlas : str = "glasser" ,
47+ only_lh : bool = False ,
48+ only_rh : bool = False ,
4749 surf : str = "veryinflated" ,
4850 ax : Axes | None = None ,
4951 vmin : Num | None = None ,
@@ -69,6 +71,8 @@ def plot_brain_surface_figure(
6971 data (dict[str, float]): 包含脑区名称和对应数值的字典,键为脑区名称(如"lh_bankssts"),值为数值
7072 species (str, optional): 物种名称,支持"human"、"chimpanzee"、"macaque". Defaults to "human".
7173 atlas (str, optional): 脑图集名称,根据物种不同可选不同图集。人上包括"glasser"、"bna",黑猩猩上包括"bna",猕猴上包括"charm4"、"charm5"、"charm6"、"bna"以及"d99". Defaults to "glasser".
74+ only_lh (bool, optional): 是否只显示左半球. Defaults to False.
75+ only_rh (bool, optional): 是否只显示右半球. Defaults to False.
7276 surf (str, optional): 大脑皮层表面类型,如"inflated"、"veryinflated"、"midthickness"等. Defaults to "veryinflated".
7377 ax (Axes | None, optional): matplotlib的坐标轴对象,如果为None则使用当前坐标轴. Defaults to None.
7478 vmin (Num | None, optional): 颜色映射的最小值,None表示使用数据中的最小值. Defaults to None.
@@ -188,14 +192,27 @@ def plot_brain_surface_figure(
188192 else :
189193 # 检查指定物种的图集是否支持
190194 if atlas not in atlas_info [species ]["atlas" ]:
191- raise ValueError (f"不支持的图集:{ atlas } 。支持的图集列表为:{ list (atlas_info [species ]['atlas' ].keys ())} " )
195+ raise ValueError (
196+ f"不支持的图集:{ atlas } 。支持的图集列表为:{ list (atlas_info [species ]['atlas' ].keys ())} "
197+ )
192198
193199 # 创建Plot对象,用于绘制大脑皮层
194200 if surf != "flat" :
195- p = Plot (
196- NEURODATA / atlas_info [species ]["surf" ]["lh" ],
197- NEURODATA / atlas_info [species ]["surf" ]["rh" ],
198- )
201+ if only_lh :
202+ p = Plot (
203+ NEURODATA / atlas_info [species ]["surf" ]["lh" ],
204+ zoom = 1.2 ,
205+ )
206+ elif only_rh :
207+ p = Plot (
208+ NEURODATA / atlas_info [species ]["surf" ]["rh" ],
209+ zoom = 1.2 ,
210+ )
211+ else :
212+ p = Plot (
213+ NEURODATA / atlas_info [species ]["surf" ]["lh" ],
214+ NEURODATA / atlas_info [species ]["surf" ]["rh" ],
215+ )
199216 else :
200217 # NOTE: 目前只有人和猕猴具有flat surface,暂时不支持黑猩猩
201218 p = Plot (
0 commit comments