Ejemplo n.º 1
0
def read_parms():
    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['mpacts_pics_select'])
    prm = param_xml.prm
    prm['timestamp'] = param_xml.get_value('timestamp', l_path_keys=['RAM'])
    return prm
Ejemplo n.º 2
0
def read_parms():
    param_xml = Param_xml.get_param_xml(sys.argv,
                l_main_keys=['body', 'viz_7cell'], verbose=True) #param file must be passed as first argument
    
    input_file_excel  = param_xml.get_value('input_file_excel',['paths'])
    output_folder  = param_xml.get_value('output_folder',['paths'])
    
    return input_file_excel,output_folder
Ejemplo n.º 3
0
def read_parms():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'extract_geom_data'],
        verbose=True)  # param file must be passed as first argument

    input_folder = param_xml.get_value('input_folder', ['paths'])
    output_folder = param_xml.get_value('output_folder', ['paths'])

    return input_folder, output_folder
Ejemplo n.º 4
0
def read_parms():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'enrich_contactinfo'],
        verbose=True)  #param file must be passed as first argument

    input_folder = param_xml.get_value('input_folder', ['paths'])
    input_file_nb = param_xml.get_value('input_file_nb', ['paths'])
    output_folder = param_xml.get_value('output_folder', ['paths'])

    return input_folder, input_file_nb, output_folder
Ejemplo n.º 5
0
def read_parms():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'extract_indent_volume'],
        verbose=True)  # param file must be passed as first argument

    input_folder = param_xml.get_value('input_folder', ['paths'])
    l_input_vtp = param_xml.get_value(
        'l_input_vtp',
        ['paths'])  # this list must be thought of as a list of pairs
    output_folder = param_xml.get_value('output_folder', ['paths'])

    return l_input_vtp, input_folder, output_folder
Ejemplo n.º 6
0
def read_parms():
	param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body', 'agg_seg_data'],verbose=True)  # param file must be passed as first argument

	input_dds = param_xml.get_value('input_dds', ['paths'])
	root_folder = param_xml.get_value('root_folder', ['paths'])
	regex_file_select = param_xml.get_value('regex_file_select', ['paths'])
	regex_file_select2 = param_xml.get_value('regex_file_select2', ['paths'])
	regex_file_select3 = param_xml.get_value('regex_file_select3', ['paths'])
	regex_file_select4 = param_xml.get_value('regex_file_select4', ['paths'])
	regex_file_select5 = param_xml.get_value('regex_file_select5', ['paths'])
	output_folder = param_xml.get_value('output_folder', ['paths'])


	return input_dds, root_folder, regex_file_select,regex_file_select2, regex_file_select3, regex_file_select4, regex_file_select5,output_folder
Ejemplo n.º 7
0
def read_parms():

    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['RAM'])
    param_xml.add_prms_to_dict(l_keys=['CTC_TRA'])

    prm = param_xml.prm
    if not prm['input_file_csv']:
        prm['input_file_csv'] = fh.get_f_name('cluster_summary')
    if not prm['input_file_clusterview']:
        prm['input_file_clusterview'] = fh.get_f_name('clusterview')

    return param_xml
Ejemplo n.º 8
0
def read_parms():
	param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body', 'SEG_3D_scoring'],verbose=True)  # param file must be passed as first argument

	input_folder_GT = param_xml.get_value('input_folder_GT', ['paths'])
	input_folder_RES = param_xml.get_value('input_folder_RES', ['paths'])
	output_folder = param_xml.get_value('output_folder', ['paths'])
	input_file_type = param_xml.get_value('input_file_type',['paths'])

	data = param_xml.get_value('l_error_intersection_trimesh')
	l_error_intersection_trimesh = []
	for i,k in zip(data[0::2], data[1::2]):
		l_error_intersection_trimesh.append(tuple((i,k)))


	scaling = param_xml.get_value('scaling')

	return input_folder_GT, input_folder_RES, output_folder, l_error_intersection_trimesh, input_file_type, scaling
Ejemplo n.º 9
0
def enrich_xml_testcase_metadata():
    for tc_i in Testcase.d_label_instance.values():
        #print(tc_i.get_param_xml_file())
        tc_param_xml = Param_xml.get_param_xml(
            ['_', tc_i.get_param_xml_file()],
            l_main_keys=['body'],
            verbose=False)
        for xml_key in prm['l_xml_keys_tc_data']:
            l_keys = xml_key.split('/')
            l_keys = [i for i in l_keys if i != '.']  #remove .
            search_field = l_keys[-1]
            key_fields = [] if len(l_keys) < 2 else l_keys[:-1]
            try:
                tc_i.xml_data[search_field] = tc_param_xml.get_value(
                    search_field, l_path_keys=key_fields)
            except:
                tc_i.xml_data[search_field] = 'SEARCH FIELD NOT FOUND !'
    return
Ejemplo n.º 10
0
def construct_tc_xml_deprecated(file, tc):
    """the param xml of the testcase will be used to extract metadata """
    #print(tc.get_param_xml_file())
    d_df = {"tc_label": tc.label}
    tc_param_xml = Param_xml.get_param_xml([_, file],
                                           l_main_keys=['body'],
                                           verbose=False)

    for xml_key in prm['l_xml_keys_tc_data']:
        l_keys = xml_key.split('/')
        l_keys = [i for i in l_keys if i != '.']  #remove .
        search_field = l_keys[-1]
        key_fields = [] if len(l_keys) < 2 else l_keys[:-1]

        d_df[search_field] = tc_param_xml.get_value(search_field,
                                                    l_path_keys=key_fields)

    return pd.DataFrame(d_df)
Ejemplo n.º 11
0
def read_parms():
    verbose = True

    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body'], verbose=False)
    param_xml.add_prms_to_dict(l_keys=['mpacts_pics_enrich'])
    param_xml.add_prms_to_dict(l_keys=['RAM'])

    prm = param_xml.prm
    prm['zres'], prm['yres'], prm['xres'] = param_xml.get_file_info(
        field='scaling_ZYX')

    prm['nb_stack'] = param_xml.get_value(
        'nb_stack_prepro', ['RAM', 'nb_stack'])
    prm['verbose'] = verbose


    return prm
Ejemplo n.º 12
0
def read_parms():
	param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body', 'agg_geom_data'],verbose=True)  # param file must be passed as first argument

	input_dds = param_xml.get_value('input_dds', ['paths'])
	root_folder = param_xml.get_value('root_folder', ['paths'])
	regex_file_select = param_xml.get_value('regex_file_select', ['paths'])
	regex_file_select2 = param_xml.get_value('regex_file_select2', ['paths'])
	regex_file_select3 = param_xml.get_value('regex_file_select3', ['paths'])
	regex_file_select4 = param_xml.get_value('regex_file_select4', ['paths'])
	regex_file_select5 = param_xml.get_value('regex_file_select5', ['paths'])

	output_folder = param_xml.get_value('output_folder', ['paths'])

	l_select_cellID = param_xml.get_value('l_select_cellID')
	copy_and_rename_only = param_xml.get_value('copy_and_rename_only')
	prefix_folder = param_xml.get_value('prefix_folder')

	return input_dds, root_folder, regex_file_select, regex_file_select2, regex_file_select3, l_select_cellID,regex_file_select4, regex_file_select5,output_folder,copy_and_rename_only,prefix_folder
Ejemplo n.º 13
0
def read_param():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'sphere_meshing'],
        verbose=True)  # param file must be passed as first argument
    docker_run_ic = param_xml.get_value('docker_run_ic', ['paths'])
    output_folder = param_xml.get_value('output_folder', ['paths'],
                                        docker_run=docker_run_ic)
    if not output - folder:
        output_folder = param_xml.get_value(
            'output_folder_meshes', ['paths'],
            docker_run=docker_run_ic)  #backward compatibility
    input_file_spheres = param_xml.get_value('input_file_spheres', ['paths'],
                                             docker_run=docker_run_ic)
    shrink_factor = param_xml.get_value('shrink_factor', ['parms'])
    threshold_radius_micron = param_xml.get_value('threshold_radius_micron',
                                                  ['parms'])

    return output_folder, input_file_spheres, shrink_factor, threshold_radius_micron
Ejemplo n.º 14
0
def read_parms():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'exam_last_slice'],
        verbose=True)  # param file must be passed as first argument

    input_file_preprocessing = param_xml.get_value('input_file_preprocessing',
                                                   ['paths'])
    input_file_sphere_meshing = param_xml.get_value(
        'input_file_sphere_meshing', ['paths'])
    input_file_exterior_mask = param_xml.get_value('input_file_exterior_mask',
                                                   ['paths'])
    output_folder = param_xml.get_value('output_folder', ['paths'])
    nb_stack = param_xml.get_value('nb_stack', ['process_flow'])

    l_dim = param_xml.get_file_info(field='RAW_IMG_DIM_TZYX')
    VOXEL_DEPTH, _, PIXEL_WIDTH = param_xml.get_file_info(field='scaling_ZYX')
    XY_VS_Z = VOXEL_DEPTH / PIXEL_WIDTH

    return input_file_preprocessing, input_file_sphere_meshing, input_file_exterior_mask, output_folder, nb_stack, l_dim, XY_VS_Z
Ejemplo n.º 15
0
def read_parms():

    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['RAM'])
    param_xml.add_prms_to_dict(l_keys=['lineager_feeder'])

    prm = param_xml.prm
    if prm['offset_lineage_files'] == -1:
        prm['l_stack_number'] = param_xml.get_value(
            'l_stack_number', ['preprocessing', 'flowcontrol'])
        if isinstance(prm['l_stack_number'], list):
            prm['offset_lineage_files'] = prm['l_stack_number'][0] - 1
        else:
            prm['offset_lineage_files'] = 0

    prm['convert_to_tsv'] = True

    return param_xml
Ejemplo n.º 16
0
def read_parms():
    param_xml = Param_xml.get_param_xml(
        sys.argv, l_main_keys=['body', 'select_cells'],
        verbose=True)  #param file must be passed as first argument

    input_folder = param_xml.get_value('input_folder', ['paths'])
    input_file_nb = param_xml.get_value('input_file_nb', ['paths'])
    input_file = param_xml.get_value('input_file', ['paths'])
    output_folder = param_xml.get_value('output_folder', ['paths'])
    write_stl_files = param_xml.get_value('write_stl_files', ['process_flow'])

    dds_file = param_xml.get_value('dds_file', ['body', 'RAM'],
                                   use_main_keys=False)
    repID = param_xml.get_value('repID', ['body', 'RAM'], use_main_keys=False)
    timestep = param_xml.get_value('timestep', ['body', 'RAM'],
                                   use_main_keys=False)
    if isinstance(timestep, list):
        timestep = timestep[0]

    return input_folder, input_file_nb, input_file, output_folder, write_stl_files, dds_file, repID, timestep
Ejemplo n.º 17
0
def _pre_resolve_variables(d_args, root, tree):
    '''pre resolve variables ad-hoc (the param file needs some variables
    to be fully resolved to allow for extraction by a simple grep or
    text search outside a python context)'''
    param_xml = Param_xml.get_param_xml(['', d_args['output_xml']],
                                        l_main_keys=['body'],
                                        verbose=False)
    param_xml.add_prms_to_dict(l_keys=['sphere_meshing'])
    for key, item in param_xml.prm.items():
        item = str(item)
        if key in ['shrink_factor', 'threshold_radius_micron']:
            search_key = './sphere_meshing/parms/' + key
        else:
            search_key = './sphere_meshing/paths/' + key
        xml_element = root.findall(search_key)[0]
        if xml_element:
            xml_element.set('value', item)

    tree.write(str(d_args['output_xml']))  # update the xml-file
    return
Ejemplo n.º 18
0
def _read_parms(p_xml):
    print(p_xml)
    param_xml = Param_xml.get_param_xml(p_xml,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['RAM'])
    param_xml.add_prms_to_dict(l_keys=['preprocessing', 'flowcontrol'])
    param_xml.add_prms_to_dict(l_keys=['preprocessing', 'paths'])

    param_xml.l_main_keys = ['body', 'preprocessing', 'filter_parms']
    prm = param_xml.prm
    prm['z_range'] = param_xml.get_value('z_range', ['collect_stats'])
    prm['z_range_loc_max'] = param_xml.get_value('z_range_loc_max',
                                                 ['blend_z_membrane'])

    if prm['nb_cores'] < 1:
        prm['nb_cores'] = multiprocessing.cpu_count()
    prm['output_folder'] = prm['root_output_folder'] / '002_preprocessing'
    prm['temp_folder'] = prm['output_folder'] / 'temp'

    return param_xml
Ejemplo n.º 19
0
def read_parms():

	param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body'],verbose=True) 
	param_xml.add_prms_to_dict(l_keys=['RAM'])
	param_xml.add_prms_to_dict(l_keys=['spheresDT'])

	prm = param_xml.prm
	prm['l_stack_raw'] = param_xml.get_value('l_stack_nb', ['body', 'preprocessing', 'flowcontrol'], use_main_keys=False)
	
	prm['use_exterior_overlay'] = True
	prm['validate_cells'] = True if prm['validation_file'] else False
	prm['SHOW_CELLS_ONLY'] = False if prm['validate_cells'] else True

	prm['offset_input_img'] = prm['nb_stack_prepro'] - prm['nb_stack_input'] if prm['offset_input_img'] else 0
	prm['offset_exterior_mask'] = prm['nb_stack_prepro'] - prm['nb_stack_input'] if prm['offset_exterior_mask'] else 0

	prm['verbose']= False
	prm['DBG'] = False


	return param_xml
Ejemplo n.º 20
0
def read_parms():
    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['RAM'])
    param_xml.add_prms_to_dict(l_keys=['mpacts_input_generator'])

    prm = param_xml.prm
    prm['file_spheres'] = param_xml.get_value(
        'file_spheres', ['mpacts_input_generator', 'paths', 'output_folder'])

    prm['validation_file'] = param_xml.get_value(
        'validation_file', l_path_keys=['spheresDT', 'paths'])
    # prm['l_stack_number_preprocess'] = param_xml.get_value('l_stack_number',l_path_keys=['preprocessing', 'flowcontrol'])

    _, prm['zmax'], prm['ymax'], prm['xmax'] = param_xml.get_file_info(
        field='RAW_IMG_DIM_TZYX')
    prm['zres'], prm['yres'], prm['xres'] = param_xml.get_file_info(
        field='scaling_ZYX')

    return param_xml
Ejemplo n.º 21
0
def read_parms():
    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body'],
                                        verbose=True)
    param_xml.add_prms_to_dict(l_keys=['sphere_meshing'])
    return param_xml.prm
Ejemplo n.º 22
0
def read_parms():
	param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body'],verbose=True) 
	param_xml.add_prms_to_dict(l_keys=['analyse_agg_data'])
	return param_xml.prm
Ejemplo n.º 23
0
        cmodel=COUNTER,
        cd=CD_cell_cell)
    for i in range(len(cells('triangles/contact_index'))):
        try:
            mysim('cells/triangles/contact_index')[
                i] = -1  # Default is 0 but this overlaps with triangle index 0
        except RuntimeError:
            pass


if __name__ == "__main__":
    import time
    tic = time.time()

    param_xml = Param_xml.get_param_xml(sys.argv,
                                        l_main_keys=['body', 'mpacts_PiCS'],
                                        verbose=False)
    docker_run_ic = param_xml.get_value('docker_run_ic', ['paths'])
    input_file_pixel_selector = param_xml.get_value(
        'input_file_pixel_selector', ['paths'], docker_run=docker_run_ic)
    pixel_selector_type = param_xml.get_value('pixel_selector_type',
                                              ['process_flow'],
                                              docker_run=docker_run_ic)
    output_folder = param_xml.get_value('output_folder', ['paths'],
                                        docker_run=docker_run_ic)

    if output_folder.exists(
    ) and '012_mpacts_pics' in output_folder.parts:  #safety check to prevent disastrous delete
        shutil.rmtree(output_folder, ignore_errors=False, onerror=None)
    output_folder.mkdir(parents=True, exist_ok=True)  #
    logging.basicConfig(filename=output_folder / 'chronology.log',
Ejemplo n.º 24
0
def read_parms():
    param_xml = Param_xml.get_param_xml(sys.argv, l_main_keys=['body'],verbose=True) 
    param_xml.add_prms_to_dict(l_keys=['extract_contactinfo'])
    return param_xml.prm
Ejemplo n.º 25
0
def main(inputXML=None):
    def read_parms():

        l_execution_blocks = param_xml.get_value('l_execution_blocks',
                                                 ['flowcontrol'])
        ix_restart = param_xml.get_value('ix_restart', ['flowcontrol'])
        l_execution_blocks = l_execution_blocks if (
            not ix_restart
            or ix_restart == 0) else l_execution_blocks[ix_restart:]

        img_raw_file = param_xml.get_value('img_raw_file', ['paths'])
        img_exterior_outline = param_xml.get_value('img_exterior_outline',
                                                   ['paths'])

        IMG_RAW_DIR = str(img_raw_file.parent)
        IMG_RAW_FILE = img_raw_file.name
        OUTPUT_FOLDER_ROOT = param_xml.get_value('OUTPUT_FOLDER_ROOT',
                                                 ['paths'])
        ic_timestamp_subfolder = param_xml.get_value('ic_timestamp_subfolder',
                                                     ['paths'])

        return l_execution_blocks, IMG_RAW_DIR, IMG_RAW_FILE, OUTPUT_FOLDER_ROOT, ic_timestamp_subfolder, img_exterior_outline

    def initialize_filehandler():

        filehandler = FileHandler()
        filehandler.d_save_info['save_dir'] = OUTPUT_FOLDER_ROOT
        #print("DEBUG1: filehandler {0},  OUTPUT_FOLDER_ROOT {1}, filehandler.get_save_location() {2}".format(filehandler.__repr__(), OUTPUT_FOLDER_ROOT,filehandler.get_save_location()))

        if ic_timestamp_subfolder:
            if IMG_RAW_FILE:
                filehandler.d_save_info['sub_dir_1'] = str(
                    datetime.datetime.now()).replace(":", "_").replace(
                        " ", "_") + "_" + IMG_RAW_FILE[0:-4]
            else:
                filehandler.d_save_info['sub_dir_1'] = str(
                    datetime.datetime.now()).replace(":",
                                                     "_").replace(" ", "_")

        filehandler.set_save_info_root()
        #print("DEBUG2: filehandler {0},  OUTPUT_FOLDER_ROOT {1}, filehandler.get_save_location() {2}".format(filehandler.__repr__(), OUTPUT_FOLDER_ROOT,filehandler.get_save_location()))
        filehandler.d_load_info['load_dir'] = IMG_RAW_DIR
        filehandler.take_snapshot()
        #print("DEBUG3: filehandler {0},  OUTPUT_FOLDER_ROOT {1}, filehandler.get_save_location() {2}".format(filehandler.__repr__(), OUTPUT_FOLDER_ROOT,filehandler.get_save_location()))
        print('SDT_MAIN.py:all info will be written to : ',
              filehandler.get_save_location())

        return filehandler

    def update_filehandler_with_f_name(filename_raw):
        if not IMG_RAW_FILE or ic_timestamp_subfolder:  #if input file name is not filled in , create a subfolder for each image processed
            filehandler.extend_save_info(extra_dir_1=filename_raw[0:-4],
                                         from_root=True,
                                         set_root=True)
        filehandler.store_f_name('IMG_RAW_FILE', filename_raw)
        filehandler.d_load_info['f_name'] = filename_raw

        filehandler.store_f_name('img_exterior_outline', img_exterior_outline)

        filehandler.take_snapshot()

        return filehandler

    def load_raw_image():
        filehandler.d_load_info['load_dir'] = param_xml.get_value(
            'IMG_RAW_DIR', ['paths'], dtype='string')
        filehandler.d_load_info['f_name'] = param_xml.get_value('IMG_RAW_FILE',
                                                                ['paths'],
                                                                dtype='string')
        return filehandler.load_tif()

    print(
        'STEP0-SETUP------------------------------------------------------------------------------------------------------------'
    )

    param_xml = Param_xml.get_param_xml(inputXML,
                                        l_main_keys=['body', 'MAIN'],
                                        verbose=True)
    # file_param, param_xml,param_xml.l_main_keys = read_param_xml_file()
    l_execution_blocks, IMG_RAW_DIR, IMG_RAW_FILE, OUTPUT_FOLDER_ROOT, ic_timestamp_subfolder, img_exterior_outline = read_parms(
    )

    filehandler = initialize_filehandler()
    os.makedirs(filehandler.get_save_location(), exist_ok=True)
    shutil.copyfile(str(param_xml.file),
                    os.path.join(filehandler.get_save_location(),
                                 param_xml.file.name))  #backup param file

    print('checks done, proceeding...') if check_params_and_data() else print(
        'checks failed. stopping executing')

    for filename_raw in Path(IMG_RAW_DIR).glob('**/*.tif'):
        # for filename_raw in os.listdir(IMG_RAW_DIR):
        #     if filename_raw.endswith(".tif") or filename_raw==IMG_RAW_FILE:

        if IMG_RAW_FILE and filename_raw.name != IMG_RAW_FILE:
            continue  #if input file is given , only process this one file

        update_filehandler_with_f_name(filename_raw.name)

        for execution_block in l_execution_blocks:
            if d_execution_blocks.get(execution_block) == 'preprocessing':
                print(
                    'STEP1-PREPROCESSING---------------------------------------------------------------------------------------------------'
                )
                preprocess_image(param_xml, filehandler)

            elif d_execution_blocks.get(execution_block) == 'spheresDT':
                print(
                    'STEP2-SPHERES_DT------------------------------------------------------------------------------------------------------'
                )
                spheres_DT(param_xml, filehandler)

            elif d_execution_blocks.get(execution_block) == 'lineager_feeder':
                print(
                    'STEP3-LINEAGER_FEEDER------------------------------------------------------------------------------------------------------'
                )
                generate_lineager_input_files(param_xml, filehandler)

            elif d_execution_blocks.get(execution_block) == 'CTC_TRA':
                print(
                    'STEP4-CTC_TRA------------------------------------------------------------------------------------------------------'
                )
                generate_CTC_TRA_files(param_xml, filehandler)

            elif d_execution_blocks.get(
                    execution_block) == 'mpacts_input_generator':
                print(
                    'STEP5-mpacts_input_generator-----------------------------------------------------------------------------------------------------'
                )
                mpacts_input_generator(param_xml, filehandler)

            elif d_execution_blocks.get(execution_block) == 'fig_z_trajectory':
                print(
                    'STEP6-fig_z_trajectory-----------------------------------------------------------------------------------------------------'
                )
                fig_z_trajectory(param_xml)

            else:
                print('execution block not recognized')
            filehandler.set_save_info_to_root()
        #<--next executionstep
        filehandler.pop_save_info(set_root=True)  #remove filename from root
Ejemplo n.º 26
0
 def read_parms():
     param_xml = Param_xml.get_param_xml(sys.argv,l_main_keys = ['body','fig_z_trajectory'],verbose=True) #param file must be passed as first argument
     input_file_csv= param_xml.get_value('input_file_csv',['paths'])
     output_file_csv= param_xml.get_value('output_file_csv',['paths'])
     
     return input_file_csv,output_file_csv 
Ejemplo n.º 27
0
def _transfer_values_from_other_tc(d_config, d_args, df_tc_info, root):
    '''parms can be copied from a another testcase
    (different schemes can be definied ad-hoc) '''
    d_config['xml_transfer'] = substitute_hashtags(d_config['xml_transfer'],
                                                   df_tc_info)
    d_config['xml_transfer_scheme'] = substitute_hashtags(
        d_config['xml_transfer_scheme'], df_tc_info)
    p_xml_transfer = d_args['output_xml_folder'] / \
        "testinfra_{0}.xml".format(d_config['xml_transfer'])
    if d_config['xml_transfer_scheme'] == 'TRA':
        try:
            param_xml_transfer = Param_xml.get_param_xml(['', p_xml_transfer],
                                                         l_main_keys=['body'],
                                                         verbose=False)
            xml_element = root.findall('./RAM/paths/img_raw_file_rescaled')[0]
            xml_element.set(
                'value',
                str(
                    param_xml_transfer.get_value('img_raw_file_rescaled',
                                                 ['RAM', 'paths'])))

            xml_element = root.findall('./RAM/RAW_IMG_DIM_TZYX')[0]
            xml_element.set(
                'value', ';'.join([
                    str(i) for i in param_xml_transfer.get_value(
                        'RAW_IMG_DIM_TZYX', ['RAM'])
                ]))

            xml_element = root.findall('./RAM/RAW_IMG_DIM_TZYX_rescaled')[0]
            xml_element.set(
                'value', ';'.join([
                    str(i) for i in param_xml_transfer.get_value(
                        'RAW_IMG_DIM_TZYX_rescaled', ['RAM'])
                ]))

            xml_element = root.findall(
                './preprocessing/paths/output_folder')[0]
            xml_element.set(
                'value',
                str(
                    param_xml_transfer.get_value('output_folder',
                                                 ['preprocessing', 'paths'])))

            xml_element = root.findall('./spheresDT/paths/output_folder')[0]
            xml_element.set(
                'value',
                str(
                    param_xml_transfer.get_value('output_folder',
                                                 ['spheresDT', 'paths'])))

            xml_element = root.findall(
                './lineager_feeder/paths/output_folder')[0]
            xml_element.set(
                'value',
                str(
                    param_xml_transfer.get_value(
                        'output_folder', ['lineager_feeder', 'paths'])))

            print(
                f"*** Parms copied from testcase {d_config['xml_transfer']} using scheme {d_config['xml_transfer_scheme']} ***"
            )

        except Exception as e:
            print(
                f"Transfer xml file can not be found or transfer keys are not in this file :{str(d_config['xml_transfer'])}. Continuing without transfer..."
            )

    return