class_docstr: Array writer that can use slope and intercept to scale array
  
  The writer can subtract an intercept, and divided by a slope, in order to
  be able to convert floating point values into a (u)int range, or to convert
  larger (u)ints to smaller.
  
  It extends the ArrayWriter class with attributes:
  
  * inter
  * slope
  
  and methods:
  
  * reset() - reset inter, slope to default (not adapted to self.array)
  * calc_scale() - calculate inter, slope to best write self.array
class_docstr_tok: ["Array","writer","that","can","use","slope","and","intercept","to","scale","array","The","writer","can","subtract","an","intercept",",","and","divided","by","a","slope",",","in","order","to","be","able","to","convert","floating","point","values","into","a","(","u",")","int","range",",","or","to","convert","larger","(","u",")","ints","to","smaller",".","It","extends","the","ArrayWriter","class","with","attributes",":","*","inter","*","slope","and","methods",":","*","reset","(",")","-","reset","inter",",","slope","to","default","(","not","adapted","to","self.array",")","*","calc_scale","(",")","-","calculate","inter",",","slope","to","best","write","self.array"]
docstr: Initialize array writer
  
  Parameters
  ----------
  array : array-like
      array-like object
  out_dtype : None or dtype
      dtype with which `array` will be written.  For this class,
      `out_dtype`` needs to be the same as the dtype of the input `array`
      or a swapped version of the same.
  calc_scale : {True, False}, optional
      Whether to calculate scaling for writing `array` on initialization.
      If False, then you can calculate this scaling with
      ``obj.calc_scale()`` - see examples
  scaler_dtype : dtype-like, optional
      specifier for numpy dtype for slope, intercept
  \*\*kwargs : keyword arguments
      This class processes only:
  
      * nan2zero : bool, optional
        Whether to set NaN values to 0 when writing integer output.
        Defaults to True.  If False, NaNs get converted with numpy
        ``astype``, and the behavior is undefined.  Ignored for floating
        point output.
  
  Examples
  --------
  >>> arr = np.array([0, 255], np.uint8)
  >>> aw = SlopeInterArrayWriter(arr)
  >>> aw.slope, aw.inter
  (1.0, 0.0)
  >>> aw = SlopeInterArrayWriter(arr, np.int8)
  >>> (aw.slope, aw.inter) == (1.0, 128)
  True
  >>> aw = SlopeInterArrayWriter(arr, np.int8, calc_scale=False)
  >>> aw.slope, aw.inter
  (1.0, 0.0)
  >>> aw.calc_scale()
  >>> (aw.slope, aw.inter) == (1.0, 128)
  True
docstr_tok: ["Initialize","array","writer","Parameters","--","--","--","--","--","array",":","array-like","array-like","object","out_dtype",":","None","or","dtype","dtype","with","which","`","array","`","will","be","written",".","For","this","class",",","`","out_dtype","``","needs","to","be","the","same","as","the","dtype","of","the","input","`","array","`","or","a","swapped","version","of","the","same",".","calc_scale",":","{","True",",","False","}",",","optional","Whether","to","calculate","scaling","for","writing","`","array","`","on","initialization",".","If","False",",","then","you","can","calculate","this","scaling","with","``","obj.calc_scale","(",")","``","-","see","examples","scaler_dtype",":","dtype-like",",","optional","specifier","for","numpy","dtype","for","slope",",","intercept","\\","*","\\","*","kwargs",":","keyword","arguments","This","class","processes","only",":","*","nan2zero",":","bool",",","optional","Whether","to","set","NaN","values","to","0","when","writing","integer","output",".","Defaults","to","True",".","If","False",",","NaNs","get","converted","with","numpy","``","astype","``",",","and","the","behavior","is","undefined",".","Ignored","for","floating","point","output",".","Examples","--","--","--","--",">",">",">","arr","=","np.array","(","[","0",",","255","]",",","np.uint8",")",">",">",">","aw","=","SlopeInterArrayWriter","(","arr",")",">",">",">","aw.slope",",","aw.inter","(","1.0",",","0.0",")",">",">",">","aw","=","SlopeInterArrayWriter","(","arr",",","np.int8",")",">",">",">","(","aw.slope",",","aw.inter",")","==","(","1.0",",","128",")","True",">",">",">","aw","=","SlopeInterArrayWriter","(","arr",",","np.int8",",","calc_scale=False",")",">",">",">","aw.slope",",","aw.inter","(","1.0",",","0.0",")",">",">",">","aw.calc_scale","(",")",">",">",">","(","aw.slope",",","aw.inter",")","==","(","1.0",",","128",")","True"]
code: def __init__(
      self,
      array,
      out_dtype=None,
      calc_scale=True,
      scaler_dtype=np.float32,
      **kwargs,
  ):
      r"""Initialize array writer
  
      Parameters
      ----------
      array : array-like
          array-like object
      out_dtype : None or dtype
          dtype with which `array` will be written.  For this class,
          `out_dtype`` needs to be the same as the dtype of the input `array`
          or a swapped version of the same.
      calc_scale : {True, False}, optional
          Whether to calculate scaling for writing `array` on initialization.
          If False, then you can calculate this scaling with
          ``obj.calc_scale()`` - see examples
      scaler_dtype : dtype-like, optional
          specifier for numpy dtype for slope, intercept
      \*\*kwargs : keyword arguments
          This class processes only:
  
          * nan2zero : bool, optional
            Whether to set NaN values to 0 when writing integer output.
            Defaults to True.  If False, NaNs get converted with numpy
            ``astype``, and the behavior is undefined.  Ignored for floating
            point output.
  
      Examples
      --------
      >>> arr = np.array([0, 255], np.uint8)
      >>> aw = SlopeInterArrayWriter(arr)
      >>> aw.slope, aw.inter
      (1.0, 0.0)
      >>> aw = SlopeInterArrayWriter(arr, np.int8)
      >>> (aw.slope, aw.inter) == (1.0, 128)
      True
      >>> aw = SlopeInterArrayWriter(arr, np.int8, calc_scale=False)
      >>> aw.slope, aw.inter
      (1.0, 0.0)
      >>> aw.calc_scale()
      >>> (aw.slope, aw.inter) == (1.0, 128)
      True
      """
      super().__init__(
          array, out_dtype, calc_scale, scaler_dtype, **kwargs
      )
  
imports: import numpy
  from .casting import best_float, floor_exact, int_abs, shared_range, type_info
  from .volumeutils import array_to_file, finite_range
label_desc: Use image node_id 1 to create a new SlopeInterArrayWriter object from inherited base classes: SlopeArrayWriter with example: obj = SlopeInterArrayWriter(array, out_dtype, calc_scale, scaler_dtype)