code: def test_reg_transform_def():
      """tests for reg_transform interface"""
      # Create a reg_transform object
      nr_transform = RegTransform()
  
      # Check if the command is properly defined
      assert nr_transform.cmd == get_custom_path("reg_transform")
  
      # Assign some input data
      trans_file = example_data("warpfield.nii")
      nr_transform.inputs.def_input = trans_file
      nr_transform.inputs.omp_core_val = 4
  
      cmd_tmp = "{cmd} -omp 4 -def {trans_file} {out_file}"
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          trans_file=trans_file,
          out_file=os.path.join(os.getcwd(), "warpfield_trans.nii.gz"),
      )
  
      assert nr_transform.cmdline == expected_cmd
  
      # Test reg_transform: def ref
      nr_transform_2 = RegTransform(omp_core_val=4)
      ref_file = example_data("im1.nii")
      trans_file = example_data("warpfield.nii")
      nr_transform_2.inputs.ref1_file = ref_file
      nr_transform_2.inputs.def_input = trans_file
  
      cmd_tmp = (
          "{cmd} -ref {ref_file} -omp 4 -def {trans_file} {out_file}"
      )
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          ref_file=ref_file,
          trans_file=trans_file,
          out_file=os.path.join(os.getcwd(), "warpfield_trans.nii.gz"),
      )
  
      assert nr_transform_2.cmdline == expected_cmd
  
      # Test reg_transform: comp nii
      nr_transform_3 = RegTransform(omp_core_val=4)
      ref_file = example_data("im1.nii")
      trans_file = example_data("warpfield.nii")
      trans2_file = example_data("anatomical.nii")
      nr_transform_3.inputs.ref1_file = ref_file
      nr_transform_3.inputs.comp_input2 = trans2_file
      nr_transform_3.inputs.comp_input = trans_file
  
      cmd_tmp = "{cmd} -ref {ref_file} -omp 4 -comp {trans1} {trans2} {out_file}"
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          ref_file=ref_file,
          trans1=trans_file,
          trans2=trans2_file,
          out_file=os.path.join(os.getcwd(), "warpfield_trans.nii.gz"),
      )
  
      assert nr_transform_3.cmdline == expected_cmd
  
      # Test reg_transform: comp txt
      nr_transform_4 = RegTransform(omp_core_val=4)
      aff1_file = example_data("ants_Affine.txt")
      aff2_file = example_data("elastix.txt")
      nr_transform_4.inputs.comp_input2 = aff2_file
      nr_transform_4.inputs.comp_input = aff1_file
  
      cmd_tmp = "{cmd} -omp 4 -comp {aff1} {aff2} {out_file}"
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          aff1=aff1_file,
          aff2=aff2_file,
          out_file=os.path.join(os.getcwd(), "ants_Affine_trans.txt"),
      )
  
      assert nr_transform_4.cmdline == expected_cmd
  
      # Test reg_transform: comp
      nr_transform_5 = RegTransform(omp_core_val=4)
      trans_file = example_data("warpfield.nii")
      aff_file = example_data("elastix.txt")
      nr_transform_5.inputs.comp_input2 = trans_file
      nr_transform_5.inputs.comp_input = aff_file
  
      cmd_tmp = "{cmd} -omp 4 -comp {aff} {trans} {out_file}"
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          aff=aff_file,
          trans=trans_file,
          out_file=os.path.join(os.getcwd(), "elastix_trans.nii.gz"),
      )
  
      assert nr_transform_5.cmdline == expected_cmd
  
      # Test reg_transform: flirt
      nr_transform_6 = RegTransform(omp_core_val=4)
      aff_file = example_data("elastix.txt")
      ref_file = example_data("im1.nii")
      in_file = example_data("im2.nii")
      nr_transform_6.inputs.flirt_2_nr_input = (
          aff_file,
          ref_file,
          in_file,
      )
  
      cmd_tmp = (
          "{cmd} -omp 4 -flirtAff2NR {aff} {ref} {in_file} {out_file}"
      )
      expected_cmd = cmd_tmp.format(
          cmd=get_custom_path("reg_transform"),
          aff=aff_file,
          ref=ref_file,
          in_file=in_file,
          out_file=os.path.join(os.getcwd(), "elastix_trans.txt"),
      )
  
      assert nr_transform_6.cmdline == expected_cmd
  
file_path: nipype/nipype/interfaces/niftyreg/tests/test_regutils.py
imports: import os
  import pytest
  from ....utils.filemanip import which
  from ....testing import example_data
  from ..None import get_custom_path, RegAverage, RegResample, RegJacobian, RegTools, RegMeasure, RegTransform
label_desc: Use image node_id 6 for calling a global function with example usage: test_reg_transform_def() without return types