class_docstr: A class to represent a generic intensity-based image registration
  algorithm.
class_docstr_tok: ["A","class","to","represent","a","generic","intensity-based","image","registration","algorithm","."]
docstr: Defines a subset of the `from` image to restrict joint
  histogram computation.
  
  Parameters
  ----------
  spacing : sequence (3,) of positive integers
    Subsampling of image in voxels, where None (default) results
    in the subsampling to be automatically adjusted to roughly
    match a cubic grid with `npoints` voxels
  corner : sequence (3,) of positive integers
    Bounding box origin in voxel coordinates
  size : sequence (3,) of positive integers
    Desired bounding box size
  npoints : positive integer
    Desired number of voxels in the bounding box. If a `spacing`
    argument is provided, then `npoints` is ignored.
docstr_tok: ["Defines","a","subset","of","the","`","from","`","image","to","restrict","joint","histogram","computation",".","Parameters","--","--","--","--","--","spacing",":","sequence","(","3",",",")","of","positive","integers","Subsampling","of","image","in","voxels",",","where","None","(","default",")","results","in","the","subsampling","to","be","automatically","adjusted","to","roughly","match","a","cubic","grid","with","`","npoints","`","voxels","corner",":","sequence","(","3",",",")","of","positive","integers","Bounding","box","origin","in","voxel","coordinates","size",":","sequence","(","3",",",")","of","positive","integers","Desired","bounding","box","size","npoints",":","positive","integer","Desired","number","of","voxels","in","the","bounding","box",".","If","a","`","spacing","`","argument","is","provided",",","then","`","npoints","`","is","ignored","."]
code: def set_fov(
      self, spacing=None, corner=(0, 0, 0), size=None, npoints=None
  ):
      """
      Defines a subset of the `from` image to restrict joint
      histogram computation.
  
      Parameters
      ----------
      spacing : sequence (3,) of positive integers
        Subsampling of image in voxels, where None (default) results
        in the subsampling to be automatically adjusted to roughly
        match a cubic grid with `npoints` voxels
      corner : sequence (3,) of positive integers
        Bounding box origin in voxel coordinates
      size : sequence (3,) of positive integers
        Desired bounding box size
      npoints : positive integer
        Desired number of voxels in the bounding box. If a `spacing`
        argument is provided, then `npoints` is ignored.
      """
      if spacing is None and npoints is None:
          spacing = [1, 1, 1]
      if size is None:
          size = self._from_img.shape
      # Adjust spacing to match desired field of view size
      if spacing is not None:
          fov_data = self._from_img.get_fdata()[
              self._slicer(corner, size, spacing)
          ]
      else:
          fov_data = self._from_img.get_fdata()[
              self._slicer(corner, size, [1, 1, 1])
          ]
          spacing = ideal_spacing(fov_data, npoints=npoints)
          fov_data = self._from_img.get_fdata()[
              self._slicer(corner, size, spacing)
          ]
      self._from_data = fov_data
      self._from_npoints = (fov_data >= 0).sum()
      self._from_affine = subgrid_affine(
          xyz_affine(self._from_img),
          self._slicer(corner, size, spacing),
      )
      # We cache the voxel coordinates of the clamped image
      self._vox_coords = np.indices(self._from_data.shape).transpose(
          (1, 2, 3, 0)
      )
  
imports: import numpy
  import scipy.ndimage
  from ...core.image.image_spaces import as_xyz_image, make_xyz_image, xyz_affine
  from ._registration import _joint_histogram
  from .affine import affine_transforms, inverse_affine, subgrid_affine
  from .chain_transform import ChainTransform
  from .optimizer import configure_optimizer
  from .similarity_measures import similarity_measures
label_desc: Use image node_id 5 for calling the HistogramRegistration obj's underlying member method code with example usage: obj.set_fov(spacing, corner, size, npoints) without return types