def test_run_functional_brain_mask_3dautomask(): import os import nibabel as nb import pkg_resources as p from qap.functional_preproc import run_functional_brain_mask if "functional_brain_mask" in os.listdir(os.getcwd()): err = "\n[!] The output folder for this workflow already exists.\n" raise Exception(err) func_motion = p.resource_filename("qap", os.path.join(test_sub_dir, \ "rest_1", \ "func_motion_correct", \ "rest_calc_tshift_resample_" \ "volreg.nii.gz")) ref_out = p.resource_filename("qap", os.path.join(test_sub_dir, \ "rest_1", \ "functional_brain_mask", \ "rest_calc_tshift_resample_volreg_" \ "mask.nii.gz")) # run the workflow output = run_functional_brain_mask(func_motion, False) # make the correlation ref_out_data = nb.load(ref_out).get_data() output_data = nb.load(output).get_data() os.system("rm -R functional_brain_mask") # create a vector of True and False values bool_vector = ref_out_data == output_data assert bool_vector.all()
def test_workflow_functional_brain_mask_3dautomask(): import os import pkg_resources as p from qap.functional_preproc import run_functional_brain_mask from qap.workflow_utils import build_test_case func_motion = p.resource_filename("qap", os.path.join(test_sub_dir, \ "rest_1", \ "func_motion_correct", \ "rest_calc_tshift_resample_" \ "volreg.nii.gz")) ref_graph = p.resource_filename("qap", os.path.join("test_data", \ "workflow_reference", \ "functional_brain_mask_3dautomask", \ "graph_functional_brain_mask" \ "_3dautomask.dot")) ref_inputs = p.resource_filename("qap", os.path.join("test_data", \ "workflow_reference", \ "functional_brain_mask_3dautomask", \ "wf_inputs.txt")) # build the workflow wf, base_dir = run_functional_brain_mask(func_motion, use_bet=False, \ run=False) # get the workflow inputs of the workflow being tested wf_inputs_string = str(wf.inputs).replace("\n", "") wf_inputs_string = wf_inputs_string.replace(base_dir, \ "BASE_DIRECTORY_HERE") wf_inputs_string = wf_inputs_string.replace(func_motion, "IN_FILE_HERE") flag, err = build_test_case(wf, ref_inputs, ref_graph, wf_inputs_string) assert flag == 2, err
def test_workflow_functional_brain_mask_3dautomask(): import os import pkg_resources as p from qap.functional_preproc import run_functional_brain_mask from qap.workflow_utils import build_test_case func_motion = p.resource_filename( "qap", os.path.join(test_sub_dir, "rest_1", "func_motion_correct", "rest_calc_tshift_resample_" "volreg.nii.gz") ) ref_graph = p.resource_filename( "qap", os.path.join( "test_data", "workflow_reference", "functional_brain_mask_3dautomask", "graph_functional_brain_mask" "_3dautomask.dot", ), ) ref_inputs = p.resource_filename( "qap", os.path.join("test_data", "workflow_reference", "functional_brain_mask_3dautomask", "wf_inputs.txt") ) # build the workflow wf, base_dir = run_functional_brain_mask(func_motion, use_bet=False, run=False) # get the workflow inputs of the workflow being tested wf_inputs_string = str(wf.inputs).replace("\n", "") wf_inputs_string = wf_inputs_string.replace(base_dir, "BASE_DIRECTORY_HERE") wf_inputs_string = wf_inputs_string.replace(func_motion, "IN_FILE_HERE") flag, err = build_test_case(wf, ref_inputs, ref_graph, wf_inputs_string) assert flag == 2, err
def test_run_functional_brain_mask_3dautomask(): import os import nibabel as nb import pkg_resources as p from qap.functional_preproc import run_functional_brain_mask if "functional_brain_mask" in os.listdir(os.getcwd()): err = "\n[!] The output folder for this workflow already exists.\n" raise Exception(err) func_motion = p.resource_filename( "qap", os.path.join(test_sub_dir, "rest_1", "func_motion_correct", "rest_calc_tshift_resample_" "volreg.nii.gz") ) ref_out = p.resource_filename( "qap", os.path.join( test_sub_dir, "rest_1", "functional_brain_mask", "rest_calc_tshift_resample_volreg_" "mask.nii.gz" ), ) # run the workflow output = run_functional_brain_mask(func_motion, False) # make the correlation ref_out_data = nb.load(ref_out).get_data() output_data = nb.load(output).get_data() os.system("rm -R functional_brain_mask") # create a vector of True and False values bool_vector = ref_out_data == output_data assert bool_vector.all()