code: def itk_transform_2_numpy(input_filepath, return_all=False):
      """This function takes in an itk transform text file and converts into a 4x4
      array.
  
      TODO: Ensure this correctly rotates.
      TODO: Make work for more than just .txt files.
  
      Parameters
      ----------
      filepath: str
          The filepath to be converted
  
      Returns
      -------
      output_array: numpy array
          A 4x4 float matrix containing the affine transform.
      """
  
      with open(input_filepath) as f:
          content = f.readlines()
  
      for row_idx, row in enumerate(content):
          if row.startswith("Parameters:"):
              r_idx = row_idx
          if row.startswith("FixedParameters:"):
              t_idx = row_idx
  
      output_array = np.zeros((4, 4))
  
      rotations = [
          float(r)
          for r in str.split(
              content[r_idx].replace("Parameters: ", "").rstrip(), " "
          )
      ]
      translations = [
          float(t)
          for t in str.split(
              content[t_idx].replace("FixedParameters: ", "").rstrip(),
              " ",
          )
      ] + [1]
  
      for i in range(4):
          output_array[i, 0:3] = rotations[i * 3 : (i + 1) * 3]
          output_array[i, 3] = translations[i]
  
      if return_all:
          return output_array, None, None
      else:
          return output_array
  
imports: import os
  import numpy
  import nibabel
  import nrrd
  import pydicom
  import subprocess
  from collections import defaultdict
  from imageio import imwrite, imread
  from deepneuro.utilities.util import grab_files_recursive, quotes
label_desc: Use image node_id 6 for calling a global function with example usage: itk_transform_2_numpy(input_filepath, return_all) and returns: output_array,  None,  None, output_array