class_docstr: Uses SPM to apply transform stored in a .mat file to given file
  
  Examples
  --------
  
  >>> import nipype.interfaces.spm.utils as spmu
  >>> applymat = spmu.ApplyTransform()
  >>> applymat.inputs.in_file = 'functional.nii'
  >>> applymat.inputs.mat = 'func_to_struct.mat'
  >>> applymat.run() # doctest: +SKIP
class_docstr_tok: ["Uses","SPM","to","apply","transform","stored","in","a",".mat","file","to","given","file","Examples","--","--","--","--",">",">",">","import","nipype.interfaces.spm.utils","as","spmu",">",">",">","applymat","=","spmu.ApplyTransform","(",")",">",">",">","applymat.inputs.in_file","=","'functional.nii'",">",">",">","applymat.inputs.mat","=","'func_to_struct.mat'",">",">",">","applymat.run","(",")","#","doctest",":","+SKIP"]
docstr: checks for SPM, generates script
docstr_tok: ["checks","for","SPM",",","generates","script"]
code: def _make_matlab_command(self, _):
      """checks for SPM, generates script"""
      outputs = self._list_outputs()
      self.inputs.out_file = outputs["out_file"]
      script = """
          infile = '{}';
          outfile = '{}'
          transform = load('{}');
  
          V = spm_vol(infile);
          X = spm_read_vols(V);
          [p n e v] = spm_fileparts(V.fname);
          V.mat = transform.M * V.mat;
          V.fname = fullfile(outfile);
          spm_write_vol(V,X);
  
          """.format(
          self.inputs.in_file,
          self.inputs.out_file,
          self.inputs.mat,
      )
      # img_space = spm_get_space(infile);
      # spm_get_space(infile, transform.M * img_space);
      return script
  
imports: import os
  import numpy
  from ...utils.filemanip import split_filename, fname_presuffix, ensure_list, simplify_list
  from ..base import TraitedSpec, isdefined, File, traits, OutputMultiPath, InputMultiPath
  from .base import SPMCommandInputSpec, SPMCommand, scans_for_fnames, scans_for_fname
label_desc: Use image node_id 1 for calling the ApplyTransform obj's underlying member method code with example usage: obj._make_matlab_command(_) and returns: script