class_docstr: ArrayWriter that can use scalefactor for writing arrays
  
  The scalefactor allows the array writer to write floats to int output
  types, and rescale larger ints to smaller.  It can therefore lose
  precision.
  
  It extends the ArrayWriter class with attribute:
  
  * slope
  
  and methods:
  
  * reset() - reset slope to default (not adapted to self.array)
  * calc_scale() - calculate slope to best write self.array
class_docstr_tok: ["ArrayWriter","that","can","use","scalefactor","for","writing","arrays","The","scalefactor","allows","the","array","writer","to","write","floats","to","int","output","types",",","and","rescale","larger","ints","to","smaller",".","It","can","therefore","lose","precision",".","It","extends","the","ArrayWriter","class","with","attribute",":","*","slope","and","methods",":","*","reset","(",")","-","reset","slope","to","default","(","not","adapted","to","self.array",")","*","calc_scale","(",")","-","calculate","slope","to","best","write","self.array"]
code: def _iu2iu(self):
      # (u)int to (u)int scaling
      mn, mx = self.finite_range()
      out_dt = self._out_dtype
      if out_dt.kind == "u":
          # We're checking for a sign flip.  This can only work for uint
          # output, because, for int output, the abs min of the type is
          # greater than the abs max, so the data either fits into the range
          # (tested for in _do_scaling), or this test can't pass. Need abs
          # that deals with max neg ints. abs problem only arises when all
          # the data is set to max neg integer value
          o_min, o_max = shared_range(self.scaler_dtype, out_dt)
          if mx <= 0 and int_abs(mn) <= int(o_max):  # sign flip enough?
              # -1.0 * arr will be in scaler_dtype precision
              self.slope = -1.0
              return
      self._range_scale(mn, mx)
  
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 10 for calling the SlopeArrayWriter obj's underlying member method code with example usage: obj._iu2iu() without return types