code: def test_randomise2():
      rand = fsl.Randomise()
  
      # make sure command gets called
      assert rand.cmd == "randomise"
  
      # test raising error with mandatory args absent
      with pytest.raises(ValueError):
          rand.run()
  
      # .inputs based parameters setting
      rand.inputs.input_4D = "infile.nii"
      rand.inputs.output_rootname = "outfile"
      rand.inputs.design_matrix = "design.mat"
      rand.inputs.t_contrast = "infile.con"
  
      actualCmdline = sorted(rand.cmdline.split())
      cmd = "randomise -i infile.nii -o outfile -d design.mat -t infile.con"
      desiredCmdline = sorted(cmd.split())
      assert actualCmdline == desiredCmdline
  
      # .run based parameter setting
      rand2 = fsl.Randomise(
          input_4D="infile2",
          output_rootname="outfile2",
          f_contrast="infile.f",
          one_sample_gmean=True,
          int_seed=4,
      )
  
      actualCmdline = sorted(rand2.cmdline.split())
      cmd = "randomise -i infile2 -o outfile2 -1 -f infile.f --seed=4"
      desiredCmdline = sorted(cmd.split())
      assert actualCmdline == desiredCmdline
  
      rand3 = fsl.Randomise()
      results = rand3.run(
          input_4D="infile3", output_rootname="outfile3"
      )
      assert (
          results.runtime.cmdline == "randomise -i infile3 -o outfile3"
      )
  
      # test arguments for opt_map
      opt_map = {
          "demean_data": ("-D", True),
          "one_sample_gmean": ("-1", True),
          "mask_image": ("-m inp_mask", "inp_mask"),
          "design_matrix": ("-d design.mat", "design.mat"),
          "t_contrast": ("-t input.con", "input.con"),
          "f_contrast": ("-f input.fts", "input.fts"),
          "xchange_block_labels": ("-e design.grp", "design.grp"),
          "print_unique_perm": ("-q", True),
          "print_info_parallelMode": ("-Q", True),
          "num_permutations": ("-n 10", 10),
          "vox_pvalus": ("-x", True),
          "fstats_only": ("--fonly", True),
          "thresh_free_cluster": ("-T", True),
          "thresh_free_cluster_2Dopt": ("--T2", True),
          "cluster_thresholding": ("-c 0.20", 0.20),
          "cluster_mass_thresholding": ("-C 0.40", 0.40),
          "fcluster_thresholding": ("-F 0.10", 0.10),
          "fcluster_mass_thresholding": ("-S 0.30", 0.30),
          "variance_smoothing": ("-v 0.20", 0.20),
          "diagnostics_off": ("--quiet", True),
          "output_raw": ("-R", True),
          "output_perm_vect": ("-P", True),
          "int_seed": ("--seed=20", 20),
          "TFCE_height_param": ("--tfce_H=0.11", 0.11),
          "TFCE_extent_param": ("--tfce_E=0.50", 0.50),
          "TFCE_connectivity": ("--tfce_C=0.30", 0.30),
          "list_num_voxel_EVs_pos": ("--vxl=1,2,3,4", "1,2,3,4"),
          "list_img_voxel_EVs": ("--vxf=6,7,8,9,3", "6,7,8,9,3"),
      }
  
      for name, settings in list(opt_map.items()):
          rand4 = fsl.Randomise(
              input_4D="infile",
              output_rootname="root",
              **{name: settings[1]},
          )
          assert (
              rand4.cmdline
              == rand4.cmd + " -i infile -o root " + settings[0]
          )
  
file_path: nipype/nipype/interfaces/fsl/tests/test_dti.py
imports: import os
  import nipype.interfaces.fsl.dti
  from nipype.interfaces.fsl import Info, no_fsl
  from nipype.interfaces.base import Undefined
  import pytest
  from nipype.testing.fixtures import create_files_in_directory
label_desc: Use image node_id 2 for calling a global function with example usage: test_randomise2() without return types