class_docstr: Linear Position-Invariant Filter (2-dimensional)
class_docstr_tok: ["Linear","Position-Invariant","Filter","(","2-dimensional",")"]
docstr: Parameters
  ----------
  impulse_response : callable `f(r, c, **filter_params)`
      Function that yields the impulse response.  ``r`` and ``c`` are
      1-dimensional vectors that represent row and column positions, in
      other words coordinates are (r[0],c[0]),(r[0],c[1]) etc.
      `**filter_params` are passed through.
  
      In other words, ``impulse_response`` would be called like this:
  
      >>> def impulse_response(r, c, **filter_params):
      ...     pass
      >>>
      >>> r = [0,0,0,1,1,1,2,2,2]
      >>> c = [0,1,2,0,1,2,0,1,2]
      >>> filter_params = {'kw1': 1, 'kw2': 2, 'kw3': 3}
      >>> impulse_response(r, c, **filter_params)
  
  
  Examples
  --------
  Gaussian filter without normalization of coefficients:
  
  >>> def filt_func(r, c, sigma=1):
  ...     return np.exp(-(r**2 + c**2)/(2 * sigma**2))
  >>> filter = LPIFilter2D(filt_func)
docstr_tok: ["Parameters","--","--","--","--","--","impulse_response",":","callable","`","f","(","r",",","c",",","*","*","filter_params",")","`","Function","that","yields","the","impulse","response",".","``","r","``","and","``","c","``","are","1-dimensional","vectors","that","represent","row","and","column","positions",",","in","other","words","coordinates","are","(","r","[","0","]",",","c","[","0","]",")",",","(","r","[","0","]",",","c","[","1","]",")","etc",".","`","*","*","filter_params","`","are","passed","through",".","In","other","words",",","``","impulse_response","``","would","be","called","like","this",":",">",">",">","def","impulse_response","(","r",",","c",",","*","*","filter_params",")",":","...","pass",">",">",">",">",">",">","r","=","[","0,0,0,1,1,1,2,2,2","]",">",">",">","c","=","[","0,1,2,0,1,2,0,1,2","]",">",">",">","filter_params","=","{","'kw1","'",":","1",",","'kw2","'",":","2",",","'kw3","'",":","3","}",">",">",">","impulse_response","(","r",",","c",",","*","*","filter_params",")","Examples","--","--","--","--","Gaussian","filter","without","normalization","of","coefficients",":",">",">",">","def","filt_func","(","r",",","c",",","sigma=1",")",":","...","return","np.exp","(","-","(","r","*","*","2","+","c","*","*","2",")","\/","(","2","*","sigma","*","*","2",")",")",">",">",">","filter","=","LPIFilter2D","(","filt_func",")"]
code: def __init__(self, impulse_response, **filter_params):
      """
      Parameters
      ----------
      impulse_response : callable `f(r, c, **filter_params)`
          Function that yields the impulse response.  ``r`` and ``c`` are
          1-dimensional vectors that represent row and column positions, in
          other words coordinates are (r[0],c[0]),(r[0],c[1]) etc.
          `**filter_params` are passed through.
  
          In other words, ``impulse_response`` would be called like this:
  
          >>> def impulse_response(r, c, **filter_params):
          ...     pass
          >>>
          >>> r = [0,0,0,1,1,1,2,2,2]
          >>> c = [0,1,2,0,1,2,0,1,2]
          >>> filter_params = {'kw1': 1, 'kw2': 2, 'kw3': 3}
          >>> impulse_response(r, c, **filter_params)
  
  
      Examples
      --------
      Gaussian filter without normalization of coefficients:
  
      >>> def filt_func(r, c, sigma=1):
      ...     return np.exp(-(r**2 + c**2)/(2 * sigma**2))
      >>> filter = LPIFilter2D(filt_func)
  
      """
      if not callable(impulse_response):
          raise ValueError("Impulse response must be a callable.")
  
      self.impulse_response = impulse_response
      self.filter_params = filter_params
      self._cache = None
  
file_path: scikit-image/skimage/filters/lpi_filter.py
imports: import numpy
  import scipy.fft
  from .._shared.utils import _supported_float_type, check_nD
label_desc: Use image node_id 1 to create a new LPIFilter2D object  with example: obj = LPIFilter2D(impulse_response)