function run_exp(input_set)


% Input configs
styles = {'martin'};
%styles = {'kelco'};
IO.example_type = 'auto_warped';
IO.input_set = input_set;

%example_type = 'random';


% Algorithmic configs
config.transfer_bg = true;
config.transfer_eyes = true;
config.dump_debug = true;
config.bilateral_decomp=false;
config.dense_warp=true;
config.radius_scale = 0.5 ; 
config.nLevel = 6;
config.user_warp = true;


for j = 1 : length(styles)

  IO.style  = styles{j};
  config.color_space  = get_color_space(IO.style);
  inputs = input_pairs(input_set, IO.style);

  for i = 1 : length(inputs)

    % Inputs
    IO.input_name = inputs{i};
    fprintf('Processing %s...\n', IO.input_name);

    input_c = get_input(IO.input_set, IO.input_name, IO.style); 
    example_c = get_model(IO.input_set, IO.style, IO.example_type, i); 

    % Kernel
    output = multi_scale(input_c, example_c, IO, config);

    keyboard;

    % Write outputs
    fprintf('Writing outputs %s...\n', IO.input_name);
    imwrite_q(input_c, sprintf('results/%s_input_%s.jpg', ...
                                    IO.input_name, IO.style));
    imwrite_q(example_c, ...
    sprintf('results/%s_example_%s_%s.jpg', IO.input_name, ...
                                    IO.example_type, IO.style));
    imwrite_q(output, ...
    sprintf('results/%s_mscale_%s_%s.jpg', ...
                        IO.input_name, IO.example_type, IO.style));

  end
end

%% I/O Helpers
%% ---------------------------------------------------------------
function color_space = get_color_space(style)
  if strcmp(style, 'kelco')
    color_space = 'wb';
  else
    color_space = 'lab';
  end

function example_c = get_model(input_set, style, example_type, i)

  [~, by_examples, warped_examples] = input_pairs(input_set, style);

  switch example_type
    case 'random'
      examples = dir(sprintf('../aligned_data/%s/*.jpg', style));
      example_name = examples(randi(length(examples))).name;
      example_c = double(imread(sprintf('../aligned_data/%s/%s',... 
                                    style, example_name)))/255;
    case 'auto_warped'
      example_name = [by_examples{i} '.jpg'];
      example_c = double(imread(sprintf('../aligned_data/%s/%s',... 
                                    style, example_name)))/255;
    case 'manual_warped'
      example_name = [warped_examples{i} '.jpg'];
      example_c = double(imread(sprintf('manual_warp/%s/%s',... 
                                    style, example_name)))/255;
    end


function input_c = get_input(input_set, input_name, style)
    input_c = double(imread(sprintf('../aligned_data/%s_%s/%s.jpg', ...
                                input_set, style, input_name)))/255;
