class_docstr: A collection of points described by coordinates.
  
  Parameters
  ----------
  coords : array-like
    (*N*, *n*) array with *N* being points and columns their *n*-dimensional coordinates
  affine : :class:`numpy.ndarray`
    Affine transform to be applied to coordinates array
  homogeneous : :class:`bool`
    Indicate whether the provided coordinates are homogeneous,
    i.e., homogeneous 3D coordinates have the form ``(x, y, z, 1)``
class_docstr_tok: ["A","collection","of","points","described","by","coordinates",".","Parameters","--","--","--","--","--","coords",":","array-like","(","*","N","*",",","*","n","*",")","array","with","*","N","*","being","points","and","columns","their","*","n","*","-dimensional","coordinates","affine",":",":","class",":","`","numpy.ndarray","`","Affine","transform","to","be","applied","to","coordinates","array","homogeneous",":",":","class",":","`","bool","`","Indicate","whether","the","provided","coordinates","are","homogeneous",",","i.e.",",","homogeneous","3D","coordinates","have","the","form","``","(","x",",","y",",","z",",","1",")","``"]
code: def __init__(
      self,
      coordinates: CoordinateArray,
      affine: np.ndarray | None = None,
      homogeneous: bool = False,
  ):
      self.coordinates = coordinates
      self.homogeneous = homogeneous
  
      if affine is None:
          self.affine = np.eye(self.dim + 1)
      else:
          self.affine = np.asanyarray(affine)
  
      if self.affine.shape != (self.dim + 1,) * 2:
          raise ValueError(
              f"Invalid affine for {self.dim}D coordinates:\n{self.affine}"
          )
      if np.any(self.affine[-1, :-1] != 0) or self.affine[-1, -1] != 1:
          raise ValueError(f"Invalid affine matrix:\n{self.affine}")
  
imports: from __future__ import annotations
  import math
  import typing
  from dataclasses import dataclass, replace
  import numpy
  from nibabel.casting import able_int_type
  from nibabel.fileslice import strided_scalar
  from nibabel.spatialimages import SpatialImage
label_desc: Use image node_id 1 to create a new Pointset object  with example: obj = Pointset(coordinates, affine, homogeneous)