cedalion.io.probe_geometry
Module for reading and writing probe geometry files.
Functions
|
Export optodes, fiducials, landmarks, electrodes, or measurement lists to tsv. |
|
Load a tsv file containing optodes or landmarks. |
|
Read a file containing digitized 3D points. |
|
Read a textured triangle mesh generated by Einstar 3D scanners. |
|
Read electrode positions from a FieldTrip |
|
Read a JSON file containing landmarks (3D Slicer |
|
Read optode positions from a Homer/AtlasViewer |
|
Save landmarks to a 3D Slicer |
- cedalion.io.probe_geometry.load_tsv(
- tsv_fname: str,
- crs: str = None,
- units: str = None,
Load a tsv file containing optodes or landmarks.
This function reads tsv-files with a column layout that differs from the NIRS-BIDS standard.
- Parameters:
tsv_fname – Path to the tsv file.
crs – Coordinate reference system of the points if not in the file header.
units – Units of the points if not in the file header.
- Returns:
xr.DataArray containing the optodes or landmarks with
label,type, and positional dimensions.
- cedalion.io.probe_geometry.export_to_tsv(tsv_filename, points)[source]
Export optodes, fiducials, landmarks, electrodes, or measurement lists to tsv.
This function writes tsv-files with a column layout that differs from the NIRS-BIDS standard.
- Parameters:
tsv_filename – Path to the output tsv file.
points – Points to save. Either an
xr.DataArray(optodes / landmarks / electrodes) or apd.DataFrame(measurement list).
- cedalion.io.probe_geometry.read_mrk_json(fname: str, crs: str) DataArray[source]
Read a JSON file containing landmarks (3D Slicer
.mrk.jsonformat).- Parameters:
fname – Path to the JSON file.
crs – Coordinate reference system of the landmarks.
- Returns:
xr.DataArray containing landmark positions with
labelandtypecoordinates, quantified with pint units.
- cedalion.io.probe_geometry.save_mrk_json(fname: str, landmarks: DataArray, crs: str)[source]
Save landmarks to a 3D Slicer
.mrk.jsonfile.- Parameters:
fname – Path to the output JSON file.
landmarks – Landmark positions as an xr.DataArray with
labelcoordinate.crs – Coordinate reference system name to embed in the file.
- cedalion.io.probe_geometry.read_digpts(fname: str, units: str = 'mm') DataArray[source]
Read a file containing digitized 3D points.
Each line must have the format
label: x y z.- Parameters:
fname – Path to the digitized-points file.
units – Physical units of the coordinates (default:
"mm").
- Returns:
xr.DataArray with dimensions
["label", "pos"], quantified with pint units.
- cedalion.io.probe_geometry.read_einstar_obj(fname: str) TrimeshSurface[source]
Read a textured triangle mesh generated by Einstar 3D scanners.
- Parameters:
fname – Path to the
.objmesh file.- Returns:
TrimeshSurface in the
"digitized"CRS with millimetre units.
- cedalion.io.probe_geometry.read_fieldtrip_elc(
- fname: Path | str,
Read electrode positions from a FieldTrip
.elcfile.- Parameters:
fname – Path to the
.elcfile.- Returns:
LabeledPoints with electrode positions,
labelandtypecoordinates, and pint units derived from the file header.
- cedalion.io.probe_geometry.read_sd(
- fname: Path | str,
- crs='av',
Read optode positions from a Homer/AtlasViewer
.matSD file.- Parameters:
fname – Path to the
.matSD file.crs – Coordinate reference system label to assign (default:
"av").
- Returns:
LabeledPoints with source, detector, and landmark positions.