File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ class GeometryCollection:
107107 Mapping from structure names to ``Pointset``
108108 """
109109
110+ def __init__ (self , structures ):
111+ self .structures = structures
112+
110113 @classmethod
111114 def from_spec (klass , pathlike ):
112115 """Load a collection of geometries from a specification."""
Original file line number Diff line number Diff line change @@ -28,11 +28,27 @@ def from_spec(klass, pathlike):
2828 'lh' : FreeSurferHemisphere .from_filename (surfs / 'lh.white' ),
2929 'rh' : FreeSurferHemisphere .from_filename (surfs / 'rh.white' ),
3030 }
31- subject = super (). __init__ (structures )
31+ subject = klass (structures )
3232 subject ._subject_dir = subject_dir
3333 return subject
3434
3535
36+ class CaretSpec (ci .GeometryCollection ):
37+ @classmethod
38+ def from_spec (klass , pathlike ):
39+ from nibabel .cifti2 .caretspec import CaretSpecFile
40+
41+ csf = CaretSpecFile .from_filename (pathlike )
42+ structures = {
43+ df .structure : df .uri
44+ for df in csf .data_files
45+ if df .selected # Use selected to avoid overloading for now
46+ }
47+ wbspec = klass (structures )
48+ wbspec ._specfile = csf
49+ return wbspec
50+
51+
3652def test_Cifti2Image_as_CoordImage ():
3753 ones = nb .load (CIFTI2_DATA / 'ones.dscalar.nii' )
3854 axes = [ones .header .get_axis (i ) for i in range (ones .ndim )]
You can’t perform that action at this time.
0 commit comments