configfile: 'config/config.yaml'

rule all:
    input:
        expand('results/recon_dir_{raw_data}', 
            raw_data = config['raw_data'])

def get_raw_data_path(wildcards):
    return config['raw_data'][wildcards.raw_data]

#if the tif files contain a numerical prefix that is not separated from the actual image index, it is best to first rename the files
#otherwise (if the tif files don't contain a numerical prefix), it is not needed to call this rule
rule rename_files:
    input: 
        get_raw_data_path
    output:
        'logs/renamefile_{raw_data}.log'
    log: 
        'logs/renamefile_{raw_data}.log'
    script:
        'scripts/rename_tifs.py'

rule reconstruct:
    input: 
        get_raw_data_path
    output: 
        directory('results/recon_dir_{raw_data}')
    params:
        numDarks = config['number_of_darks'],    
        numFlats = config['number_of_flats'],    
        numProjs = config['number_of_projections'], 
        rotCenter = config['rotation_center'] 
    script:
        'scripts/reconstructs_tomo_dataset.py'
