File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,8 @@ def from_surfaces(
334334 parcels = cedalion .io .read_parcellations (parcel_file )
335335 assert len (parcels ) == brain_ijk .nvertices
336336 brain_ijk .vertex_coords ["parcel" ] = np .asarray (parcels .Label .tolist ())
337+ else :
338+ parcels = None
337339
338340 if parcel_volume_file is not None :
339341 import nibabel as nib
@@ -350,10 +352,13 @@ def from_surfaces(
350352 assert csv_cbig [i ] == l
351353 assert brain_mask .shape == voxel_parcels .shape
352354 assert (t_ijk2ras .values == affine ).all ()
355+ voxel_parcels = voxel_parcels .astype (int )
356+ else :
357+ voxel_parcels = None
353358
354359 voxel_to_vertex_brain = map_segmentation_mask_to_surface (
355360 brain_mask , t_ijk2ras , brain_ijk .apply_transform (t_ijk2ras ),
356- parcels_vox = voxel_parcels . astype ( int ) , parcels_verts = parcels
361+ parcels_vox = voxel_parcels , parcels_verts = parcels
357362 )
358363 voxel_to_vertex_scalp = map_segmentation_mask_to_surface (
359364 scalp_mask , t_ijk2ras , scalp_ijk .apply_transform (t_ijk2ras )
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ def read_parcellations(parcel_file: str | Path) -> pd.DataFrame:
168168 parcels ["Vertices" ] = parcels ["Vertices" ].astype (int )
169169 parcels = parcels .sort_values ("Vertices" )
170170
171- parcels ["Label" ] = parcels ["Label" ].apply (lambda x : "_" .join (x .split (" " )) + "H" )
171+ if not parcels ["Label" ].values [1 ].endswith ('H' ):
172+ parcels ["Label" ] = parcels ["Label" ].apply (lambda x : "_" .join (x .split (" " )) + "H" )
172173
173174 return parcels
You can’t perform that action at this time.
0 commit comments