- navis.interfaces.r.xform_brain(x, source, target, fallback=None, bulk=False, verbose=False, **kwargs)¶
Transform 3D data between template brains.
This is a simple wrapper for
For Neurons only: whether there is a change in units during transformation (e.g. nm -> um) is inferred by comparing distances between x/y/z coordinates before and after transform. This guesstimate is then used to convert
.unitsand node radii (for TreeNeurons).
x (Neuron/List | numpy.ndarray | pandas.DataFrame) – Data to transform. Dataframe must contain
['x', 'y', 'z']columns. Numpy array must be shape
source (str) – Source template brain that the data currently is in.
target (str) – Target template brain that the data should be transformed into.
fallback (None | "AFFINE",) – If “AFFINE”, will fall back to affine transformation if CMTK transformation fails. Else coordinates of points for which the transformation failed (e.g. b/c they are out of bounds), will be returned as
bulk (bool | int) – If True or number and input is NeuronList, will xform all coordinates in chunks (default=100k) instead of neuron-by-neuron. This can be ~2x faster (due to reduced overhead) is very memory intensive! If
bulkis a number will process chunks of given size.
**kwargs – Keyword arguments passed to
Copy of input with transformed coordinates.
- Return type:
same type as