parameters: (arr: ArrayLike, function_name: str, ttype)
return_statement: return templatedFunction(arr)
docstring: Get a vnl object from a Python array.
docstring_summary: Get a vnl object from a Python array.
docstring_tokens: Get a vnl object from a Python array .
function: def _GetVnlObjectFromArray(arr: ArrayLike, function_name: str, ttype):
      """Get a vnl object from a Python array."""
      import itk
  
      # Verify inputs
      if not isinstance(arr, np.ndarray):
          arr = np.asarray(arr)
  
      if ttype is not None:
          if isinstance(ttype, (tuple, list)):
              if len(ttype) != 1:
                  raise RuntimeError("Expected 1 component in ttype tuple.")
              PixelType = ttype[0]
          else:
              PixelType = ttype
      else:
          PixelType = _get_itk_pixelid(arr)
      keys = [k for k in itk.PyVnl.keys() if k[0] == PixelType]
      if len(keys) == 0:
          raise RuntimeError("No suitable template parameter can be found.")
      templatedFunction = getattr(itk.PyVnl[keys[0]], function_name)
      return templatedFunction(arr)
function_tokens: def _GetVnlObjectFromArray ( arr : ArrayLike , function_name : str , ttype ) : import itk # Verify inputs if not isinstance ( arr , np . ndarray ) : arr = np . asarray ( arr ) if ttype is not None : if isinstance ( ttype , ( tuple , list ) ) : if len ( ttype ) != 1 : raise RuntimeError ( "Expected 1 component in ttype tuple." ) PixelType = ttype [ 0 ] else : PixelType = ttype else : PixelType = _get_itk_pixelid ( arr ) keys = [ k for k in itk . PyVnl . keys ( ) if k [ 0 ] == PixelType ] if len ( keys ) == 0 : raise RuntimeError ( "No suitable template parameter can be found." ) templatedFunction = getattr ( itk . PyVnl [ keys [ 0 ] ] , function_name ) return templatedFunction ( arr )