From 77bf43228bd8a70595419fc001a8a9a62c143da6 Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 01/11] docs(dataset): document Volume/Vertex/Volume2D/Vertex2D **kwargs Spells out what actually flows through the previously-vague **kwargs line: state, priority, stim, rate, delay, filter, and (Volume2D/Vertex2D only) alpha. Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/view2D.py | 30 ++++++++++++++++++++++++++++-- cortex/dataset/views.py | 28 +++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/cortex/dataset/view2D.py b/cortex/dataset/view2D.py index 089deff95..d69ae5762 100644 --- a/cortex/dataset/view2D.py +++ b/cortex/dataset/view2D.py @@ -143,7 +143,20 @@ class Volume2D(Dataview2D): Maximum value in colormap for dim2. If not given defaults to TODO:WHAT **kwargs All additional arguments in kwargs are passed to the VolumeData and Dataview - + state : untyped + role unclear + priority : int (default = 1) + controls the order in which datasets are viewed in webgl + stim : str + path to stimulus file + rate : numeric (default 1) + frame rate for movie/time series playback in webgl + delay : numeric (default 0) + delay for movie/time series playback in webgl + filter : str (default = "nearest") + interpolation filter for volumetric rendering in webgl (nearest/trilinear/nearlin/debug) + alpha : ndarray or Volume + overwrites the computed alpha channel from a cmap, but currently commented out in Dataview2D """ _cls = VolumeData dim1: Volume @@ -238,7 +251,20 @@ class Vertex2D(Dataview2D): Maximum value in colormap for dim2. If not given defaults to TODO:WHAT **kwargs All additional arguments in kwargs are passed to the VolumeData and Dataview - + state : untyped + role unclear + priority : int (default = 1) + controls the order in which datasets are viewed in webgl + stim : str + path to stimulus file + rate : numeric (default 1) + frame rate for movie/time series playback in webgl + delay : numeric (default 0) + delay for movie/time series playback in webgl + filter : str (default = "nearest") + interpolation filter for volumetric rendering in webgl (nearest/trilinear/nearlin/debug) + alpha : ndarray or Volume + overwrites the computed alpha channel from a cmap, but currently commented out in Dataview2D """ _cls = VertexData blend_curvature = _cls.blend_curvature # hacky inheritance diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index 6402cdea0..739277931 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -411,7 +411,21 @@ class Volume(VolumeData, Dataview): description : str, optional String describing this dataset. Displayed in webgl viewer. **kwargs - All additional arguments in kwargs are passed to the VolumeData and Dataview + All additional arguments in kwargs are passed to the VolumeData and Dataview. + state : untyped + role unclear + priority : int (default = 1) + controls the order in which datasets are viewed in webgl + stim : str + path to stimulus file + rate : numeric (default 1) + frame rate for movie/time series playback in webgl + delay : numeric (default 0) + delay for movie/time series playback in webgl + filter : str + interpolation filter for volumetric rendering in webgl (nearest/trilinear/nearlin/debug) + + """ @@ -502,6 +516,18 @@ class Vertex(VertexData, Dataview): String describing this dataset. Displayed in webgl viewer. **kwargs All additional arguments in kwargs are passed to the VolumeData and Dataview + state : untyped + role unclear + priority : int (default = 1) + controls the order in which datasets are viewed in webgl + stim : str + path to stimulus file + rate : numeric (default 1) + frame rate for movie/time series playback in webgl + delay : numeric (default 0) + delay for movie/time series playback in webgl + filter : str + interpolation filter for volumetric rendering in webgl (nearest/trilinear/nearlin/debug) """ From 4493195a6a02a4b1fd95795994737776255b021a Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 02/11] docs(dataset): fix stale Vertex.map() docstring The docstring claimed this calls cortex.freesurfer.vertex_to_vertex(), which no longer exists; the code actually calls db.get_mri_surf2surf_matrix(). Also adds the missing Returns section. Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/views.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index 739277931..918fabc2a 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -593,8 +593,9 @@ def map( ) -> Vertex: """Map this data from this surface to another surface - Calls `cortex.freesurfer.vertex_to_vertex()` with this - vertex object as the first argument. + Builds a source-to-target vertex mapping matrix via + `cortex.freesurfer.get_mri_surf2surf_matrix()` and applies it to + this Vertex's data. NOTE: Requires either previous computation of mapping matrices (with `cortex.db.get_mri_surf2surf_matrix`) or active @@ -607,7 +608,13 @@ def map( Other Parameters ---------------- - kwargs map to `cortex.freesurfer.vertex_to_vertex()` + kwargs map to `cortex.freesurfer.get_mri_surf2surf_matrix()` + + Returns + ------- + Vertex + This data, resampled onto `target_subj`'s vertices, with the + same `cmap`, `vmin`, and `vmax` as this Vertex. """ # Input check if hemi not in ["lh", "rh", "both"]: From a9ce8d6fa4f80b188da9c4e6106baaa209dc29e7 Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 03/11] docs(dataset): document Dataview.copy/from_hdf and Volume/Vertex.raw These resolve as the actual inherited methods surfaced on the website for Volume/Vertex (.raw) and Volume2D/Vertex2D/VolumeRGB/VertexRGB (.copy/.from_hdf, unoverridden). Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/views.py | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index 918fabc2a..f6fb0337d 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -207,6 +207,23 @@ def __init__( self.description = description def copy(self, *args, **kwargs): + """Create a new instance of this Dataview's class, reusing its + display settings (cmap, vmin, vmax, description, state, attrs). + + Parameters + ---------- + *args + Positional arguments passed to the subclass constructor (e.g. + new `red`/`green`/`blue` data for a VolumeRGB). + **kwargs + Additional keyword arguments; merged with (and overriding) this + Dataview's own `attrs`. + + Returns + ------- + Dataview + A new instance of `self.__class__`. + """ kwargs.update(self.attrs) return self.__class__( *args, @@ -256,6 +273,23 @@ def to_json(self, simple: bool=False) -> DataviewJSON: @staticmethod def from_hdf(node, subject=None): + """Reconstruct a Dataview from a `/views/` node in an HDF5 + file previously written by `Dataview._write_hdf`. + + Parameters + ---------- + node : h5py.Dataset + The view node to decode. + subject : str, optional + Subject to use instead of the one stored in the file (e.g. if + the subject has been renamed since the file was written). + + Returns + ------- + Dataview + The decoded Volume, Vertex, VolumeRGB, VertexRGB, Volume2D, or + Vertex2D object. + """ data = json.loads(u(node[0])) desc = node[1] try: @@ -473,6 +507,14 @@ def _write_hdf(self, h5, name="data"): @property def raw(self) -> VolumeRGB: + """Colormap this Volume's data into an RGBA VolumeRGB. + + Returns + ------- + VolumeRGB + This Volume's data, mapped through `cmap`/`vmin`/`vmax` into + per-voxel RGB colors, with alpha set to 0 for NaN voxels. + """ (r, g, b, a), nan_mask = super().raw result = VolumeRGB( r, @@ -569,6 +611,14 @@ def _write_hdf(self, h5, name="data"): @property def raw(self) -> VertexRGB: + """Colormap this Vertex's data into an RGBA VertexRGB. + + Returns + ------- + VertexRGB + This Vertex's data, mapped through `cmap`/`vmin`/`vmax` into + per-vertex RGB colors, with alpha set to 0 for NaN vertices. + """ (r, g, b, a), nan_mask = super().raw result = VertexRGB( r, From a728afa2b8afb8da21721a821294e288c189addc Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 04/11] docs(dataset): fix stale Dataset/append docstrings Both claimed kwargs must be BrainData or Dataset objects; normalize() actually also accepts tuples, filename strings, and dicts. Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/dataset.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cortex/dataset/dataset.py b/cortex/dataset/dataset.py index 45abd2dc1..d6ddfa43c 100644 --- a/cortex/dataset/dataset.py +++ b/cortex/dataset/dataset.py @@ -15,12 +15,16 @@ class Dataset: """ - Wrapper for multiple data objects. This often does not need to be used - explicitly--for example, if a dictionary of data objects is passed to - `cortex.webshow`, it will automatically be converted into a `Dataset`. + Wrapper for a named collection of Dataview objects (Volume, Vertex, VolumeRGB, + etc.). Provides a standard way to save/load that collection as an HDF5 file, + and lets a single Dataview be treated the same as a full Dataset elsewhere in + pycortex (e.g. `cortex.webshow`). + + Each keyword argument names one view; its value can be a Dataview, a tuple + (implicitly converted to a Volume or Vertex), a filename string (loaded from + an .hdf file), a dict (converted to a nested Dataset), or another Dataset + (merged in). - # TODO: should be BrainData & Dataview, or just Dataview - All kwargs should be `BrainData` or `Dataset` objects. """ def __init__(self, **kwargs: Union[Dataview, dict, str, tuple, Dataset]) -> None: self.h5: Optional[h5py.File] = None @@ -29,8 +33,16 @@ def __init__(self, **kwargs: Union[Dataview, dict, str, tuple, Dataset]) -> None self.append(**kwargs) def append(self, **kwargs: Union[Dataview, dict, str, tuple, Dataset]) -> Dataset: - """Add the `BrainData` or `Dataset` objects in `kwargs` into this - dataset. + """Add the views in `kwargs` into this dataset. Each keyword names + one view; its value can be a Dataview, a tuple (implicitly converted + to a Volume or Vertex), a filename string (loaded from an .hdf + file), a dict (converted to a nested Dataset), or another Dataset + (merged in). See the `Dataset` class docstring for details. + + Returns + ------- + Dataset + This dataset, with the new views added, for chaining. """ for name, data in kwargs.items(): norm = normalize(data) From 5e16f9bcc3ab247f3aaf55f57028117d57ee0afc Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 05/11] docs(dataset): document Dataset.save/get_surf/get_xfm/get_mask/get_overlay/uniques All were previously undocumented public methods. Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/dataset.py | 105 +++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/cortex/dataset/dataset.py b/cortex/dataset/dataset.py index d6ddfa43c..574023e8a 100644 --- a/cortex/dataset/dataset.py +++ b/cortex/dataset/dataset.py @@ -130,7 +130,19 @@ def from_file(cls, filename: str, subject: Optional[str]=None) -> Dataset: return ds def uniques(self, collapse: bool=False) -> set[Dataview]: - """Return the set of unique BrainData objects contained by this dataset""" + """Return the set of unique BrainData objects contained by this dataset + + Parameters + ---------- + collapse : bool, optional + Passed through to each view's own `uniques()`. Default False. + + Returns + ------- + uniques : set + The distinct BrainData objects (e.g. Volume/Vertex channels) + referenced across all views in this dataset. + """ uniques = set() for name, view in self: # .uniques() is provided by BrainData @@ -140,6 +152,24 @@ def uniques(self, collapse: bool=False) -> set[Dataview]: return uniques def save(self, filename: Optional[str]=None, pack: bool=False) -> None: + """Write this dataset's views out to an HDF5 file. + + Parameters + ---------- + filename : str, optional + Path to write to. If omitted, writes to the file this dataset + was already opened from (raises if there is none). + pack : bool, optional + If True, also bundle each view's subject surfaces, transforms, + and masks into the file, so it can be opened without access to + the pycortex filestore/database. Default False. + + Returns + ------- + None + Writes `filename` (or the already-open file) as a side effect; + has no return value. + """ if filename is not None: self.h5 = h5py.File(filename, 'a') elif self.h5 is None: @@ -184,6 +214,32 @@ def get_surf(self, subject: str, type: str, hemi: Literal['lh', 'rh'], *, merge: def get_surf(self, subject: str, type: str, hemi: Literal['both', 'lh', 'rh']='both', *, merge: bool=False, nudge: bool=False) -> Union[tuple[tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]], tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]]], tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]]]: ... def get_surf(self, subject: str, type: str, hemi: Literal['both', 'lh', 'rh']='both', *, merge: bool=False, nudge: bool=False) -> Union[tuple[tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]], tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]]], tuple[npt.NDArray[np.floating], npt.NDArray[np.integer]]]: + """Retrieve a subject's surface geometry from this (packed) dataset file. + + Parameters + ---------- + subject : str + Subject identifier, as packed into this dataset. + type : str + Surface type, e.g. 'wm', 'pia', or 'fiducial' (averaged from + 'wm' and 'pia'). + hemi : str, optional + 'lh', 'rh', or 'both'. Default 'both'. + merge : bool, optional + If True (and `hemi='both'`), stack both hemispheres into a + single (pts, polys) pair with right-hemisphere face indices + offset. Default False. + nudge : bool, optional + If True, shift each hemisphere so they don't overlap along the + x-axis. Default False. + + Returns + ------- + (pts, polys) or ((lpts, lpolys), (rpts, rpolys)) + Vertex coordinates and triangle faces for the requested + surface. If `hemi='both'` and `merge=False`, a pair of + (pts, polys) tuples, one per hemisphere, is returned instead. + """ pts: npt.NDArray[np.floating] polys: npt.NDArray[np.integer] if hemi == 'both': @@ -213,6 +269,20 @@ def get_surf(self, subject: str, type: str, hemi: Literal['both', 'lh', 'rh']='b raise IOError('Subject not found in package') def get_xfm(self, subject: str, xfmname: str) -> Transform: + """Retrieve a subject's transform from this (packed) dataset file. + + Parameters + ---------- + subject : str + Subject identifier, as packed into this dataset. + xfmname : str + Transform name, as packed into this dataset. + + Returns + ------- + Transform + The requested transform. + """ try: group: h5py.Group = self.h5['subjects'][subject]['transforms'][xfmname] return Transform(group['xfm'][:], tuple(group['xfm'].attrs['shape'])) @@ -220,6 +290,22 @@ def get_xfm(self, subject: str, xfmname: str) -> Transform: raise IOError('Transform not found in package') def get_mask(self, subject: str, xfmname: str, maskname: str): + """Retrieve a subject's voxel mask from this (packed) dataset file. + + Parameters + ---------- + subject : str + Subject identifier, as packed into this dataset. + xfmname : str + Transform name the mask belongs to, as packed into this dataset. + maskname : str + Name of the mask to retrieve. + + Returns + ------- + h5py.Dataset + The requested mask array, as stored in the HDF5 file. + """ try: group: h5py.Group = self.h5['subjects'][subject]['transforms'][xfmname]['masks'] return group[maskname] @@ -227,6 +313,23 @@ def get_mask(self, subject: str, xfmname: str, maskname: str): raise IOError('Mask not found in package') def get_overlay(self, subject: str, type: str='rois', **kwargs) -> tempfile._TemporaryFileWrapper: + """Retrieve a subject's overlay (currently only ROIs) from this + (packed) dataset file. + + Parameters + ---------- + subject : str + Subject identifier, as packed into this dataset. + type : str, optional + Overlay type to retrieve. Only 'rois' is currently supported. + Default 'rois'. + + Returns + ------- + tempfile.NamedTemporaryFile + A temporary file containing the overlay's SVG data, seeked to + the start. + """ try: group: h5py.Group = self.h5['subjects'][subject] if type == "rois": From fda29c2f07a35833f3a6eb17ae0611178ed616ac Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 06/11] docs(dataset): document VolumeRGB/VertexRGB.to_json and DataviewRGB.uniques Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/viewRGB.py | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/cortex/dataset/viewRGB.py b/cortex/dataset/viewRGB.py index 8d2c9d4ea..0456e36c9 100644 --- a/cortex/dataset/viewRGB.py +++ b/cortex/dataset/viewRGB.py @@ -103,6 +103,20 @@ def __init__( ) def uniques(self, collapse=False): + """Yield the underlying Dataview channels that make up this RGB view. + + Parameters + ---------- + collapse : bool, optional + If True, yield this RGB view itself as a single unit instead of + its individual channels. Default False. + + Returns + ------- + generator + Yields `self` if `collapse`, otherwise `self.red`, `self.green`, + `self.blue`, and `self.alpha` (if set). + """ if collapse: yield self else: @@ -591,6 +605,21 @@ def alpha(self, alpha: Optional[Union[npt.NDArray, Volume]]): self._alpha = alpha def to_json(self, simple=False): + """Serialize this RGB volume to a JSON-compatible dict, for the + webgl viewer / HDF5 export. + + Parameters + ---------- + simple : bool, optional + If True, return an abbreviated summary suitable for a quick + listing rather than the full webgl payload. Default False. + + Returns + ------- + dict + Serialized view data, including the transform matrix (when not + `simple`) needed to place the RGB volume in the correct space. + """ sdict = super().to_json(simple=simple) if simple: sdict["shape"] = self.red.shape @@ -894,6 +923,21 @@ def vertices(self) -> npt.NDArray[np.uint8]: return np.array(verts).transpose([1, 2, 0]) def to_json(self, simple=False): + """Serialize this RGB vertex view to a JSON-compatible dict, for the + webgl viewer / HDF5 export. + + Parameters + ---------- + simple : bool, optional + If True, return an abbreviated summary (hemisphere split point + and frame count) rather than the full webgl payload. Default + False. + + Returns + ------- + dict + Serialized view data. + """ sdict = super().to_json(simple=simple) if simple: From 74131487fa202e2eac2352af6b946eef5ae250ff Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 07/11] docs(dataset): document Dataview2D.to_json/uniques Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/view2D.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cortex/dataset/view2D.py b/cortex/dataset/view2D.py index d69ae5762..ed2dd1129 100644 --- a/cortex/dataset/view2D.py +++ b/cortex/dataset/view2D.py @@ -34,6 +34,20 @@ def __init__(self, description: str="", cmap: Optional[str]=None, self.description = description def uniques(self, collapse=False): + """Yield the two underlying Dataview objects (dim1, dim2) that make + up this composite 2D view. + + Parameters + ---------- + collapse : bool, optional + Unused here; accepted for interface compatibility with + `Dataview.uniques`. + + Returns + ------- + generator + Yields `self.dim1`, then `self.dim2`. + """ yield self.dim1 yield self.dim2 @@ -48,6 +62,22 @@ def _write_hdf(self, h5, name="data"): return viewnode def to_json(self, simple=False): + """Serialize this 2D dataview to a JSON-compatible dict, for the + webgl viewer / HDF5 export. + + Parameters + ---------- + simple : bool, optional + Unused here; accepted for interface compatibility with + `Dataview.to_json`. + + Returns + ------- + dict + Serialized view data, including both dims' names, cmap, + vmin/vmax pairs, state, attrs, description, and (if the + underlying dims are Volumes) the shared xfm. + """ sdict = dict(data=[[self.dim1.name, self.dim2.name]], state=self.state, attrs=self.attrs, From 96746e30bcf4d1ed3f8c6c6371a7f3cd6e7bec91 Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 08/11] docs(dataset): fix stale BrainData.uniques() TODO placeholder Docstring was a literal """TODO: WHAT IS THIS""" left by the original author; resolves as Volume.uniques/Vertex.uniques on the website. Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/braindata.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cortex/dataset/braindata.py b/cortex/dataset/braindata.py index 4ee81c899..a29b07542 100644 --- a/cortex/dataset/braindata.py +++ b/cortex/dataset/braindata.py @@ -61,7 +61,22 @@ def exp(self): return self.copy(np.exp(self.data)) def uniques(self, collapse=False): - """TODO: WHAT IS THIS + """Yield the underlying BrainData object(s) this view is built from. + + For a plain Volume/Vertex, that's just itself; composite views + (VolumeRGB, VertexRGB, Volume2D, Vertex2D) override this to yield + their individual channels instead. + + Parameters + ---------- + collapse : bool, optional + Unused here; accepted for interface compatibility with the + composite-view overrides of this method. + + Returns + ------- + generator + Yields `self`. """ yield self From fba5446a372480d01c8a249b2cbe1f5ac645b5dc Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 18:10:57 -0700 Subject: [PATCH 09/11] docs(dataset): document VertexData.to_json Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/braindata.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cortex/dataset/braindata.py b/cortex/dataset/braindata.py index a29b07542..13efc9c85 100644 --- a/cortex/dataset/braindata.py +++ b/cortex/dataset/braindata.py @@ -524,9 +524,23 @@ def __getitem__(self, idx): #return VertexData(self.data[idx], self.subject, **self.attrs) return self.copy(self.data[idx]) - - # TODO: simple + def to_json(self, simple: bool = False) -> dict[str, list[str]]: + """Serialize this vertex data to a JSON-compatible dict, for the + webgl viewer / HDF5 export. + + Parameters + ---------- + simple : bool, optional + If True, return an abbreviated summary (hemisphere split point + and frame count) rather than the full webgl payload. Default + False. + + Returns + ------- + dict + Serialized data. + """ if simple: sdict = dict(split=self.llen, frames=self.vertices.shape[0]) sdict.update(super().to_json(simple=simple)) From a2b050ede6153040b2415bd874e6ab197e111f70 Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Mon, 24 Aug 2026 10:04:01 -0700 Subject: [PATCH 10/11] docs(dataset): address review feedback on PR #688 - BrainData.uniques(): describe the yielded type (BrainData) rather than the self-specific implementation detail, per review suggestion. - Vertex.map(): update the stale "active freesurfer environment" NOTE. get_mri_surf2surf_matrix was rewritten as a pure-Python implementation (direct nnfr construction from sphere.reg files) that requires no mri_surf2surf binary call; reworded to reflect the actual requirement (sphere.reg files existing on disk, produced by a prior recon-all run). Co-Authored-By: Claude Sonnet 5 --- cortex/dataset/braindata.py | 2 +- cortex/dataset/views.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cortex/dataset/braindata.py b/cortex/dataset/braindata.py index 13efc9c85..2a15f0970 100644 --- a/cortex/dataset/braindata.py +++ b/cortex/dataset/braindata.py @@ -76,7 +76,7 @@ def uniques(self, collapse=False): Returns ------- generator - Yields `self`. + Yields `BrainData` """ yield self diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index f6fb0337d..f07d07ec7 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -647,9 +647,11 @@ def map( `cortex.freesurfer.get_mri_surf2surf_matrix()` and applies it to this Vertex's data. - NOTE: Requires either previous computation of mapping matrices - (with `cortex.db.get_mri_surf2surf_matrix`) or active - freesurfer environment. + NOTE: Requires the source and target subjects' registered sphere + surfaces (`?h.sphere.reg`), produced by Freesurfer's `recon-all` + pipeline. No active Freesurfer installation is needed at call + time -- the mapping is computed directly from those files in + pure Python. Parameters ---------- From 4c716cda877604ab81a79826e2994ec286cb2a07 Mon Sep 17 00:00:00 2001 From: Sunjae Shim <85246533+sjshim@users.noreply.github.com> Date: Thu, 24 Sep 2026 11:50:38 -0700 Subject: [PATCH 11/11] Apply suggestion from @sjshim --- cortex/dataset/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index f07d07ec7..425d8d4e1 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -216,7 +216,9 @@ def copy(self, *args, **kwargs): Positional arguments passed to the subclass constructor (e.g. new `red`/`green`/`blue` data for a VolumeRGB). **kwargs - Additional keyword arguments; merged with (and overriding) this + Additional keyword arguments; merged with this Dataview's own + `attrs`. Existing `attrs` take precedence, so only new keys are + added. Dataview's own `attrs`. Returns