cmass_coor
: Centre of mass, any coordinates#
- hypercoil.functional.cmass.cmass_coor(X: Tensor, coor: Tensor, radius: float | None = None) Tensor [source]#
Differentiably compute a weight’s centre of mass.
- Dimension:
- Input : \((*, W, L)\)
*
denotes any number of preceding dimensions, W denotes number of weights (e.g., regions of an atlas), and L denotes number of locations (e.g., voxels).- coor : \((*, D, L)\)
D denotes the dimension of the embedding space of the locations.
- Parameters:
- XTensor
Weight whose centre of mass is to be computed.
- coorTensor
Coordinates corresponding to each column (location/voxel) in X.
- radiusfloat or None (default None)
If this is not None, then the computed centre of mass is projected onto a sphere with the specified radius.
- Returns:
- Tensor
Tensor containing the coordinates of the centre of mass of each row of input X. Coordinates are ordered as in the second-to-last axis of
coor
.