Skip to content

Commit

Permalink
FIX cortex.export.plot_panels correctly shows inflated surfaces for…
Browse files Browse the repository at this point in the history
… subjects without a flatmap (#477)

* ENH add inflated view for when flatmap is not available

* FIX figure out if subject has flatmap and modify values accordingly

* FIX pass a copy

* DOC small fix

* FIX map to the correct values for unfolding
  • Loading branch information
mvdoc authored Jan 25, 2023
1 parent 94936d5 commit 2a51886
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cortex/export/save_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def save_3d_views(
else:
interpolation_params = dict()

has_flatmap = hasattr(getattr(cortex.db, volume.subject).surfaces, "flat")
file_names = []
for view, surface in zip(list_angles, list_surfaces):
if isinstance(view, str):
Expand All @@ -99,7 +100,14 @@ def save_3d_views(
else:
view_name, view_params = view
if isinstance(surface, str):
surface_params = unfold_view_params[surface]
surface_params = unfold_view_params[surface].copy()
# Fix unfold parameters if this subject doesn't have a flatmap
# Without a flatmap, the inflated surf corresponds to an unfold value of 1
# With a flatmap, the inflated surf corresponds to an unfold value of 0.5
if not has_flatmap:
surface_params["surface.{subject}.unfold"] = min(
surface_params["surface.{subject}.unfold"] * 2, 1
)
else:
surface_params = surface

Expand Down

0 comments on commit 2a51886

Please sign in to comment.