/* $Id: kmo_test_create_data.h,v 1.4 2012-11-09 12:58:37 aagudo Exp $
 *
 * This file is part of the KMOS Pipeline
 * Copyright (C) 2002,2003 European Southern Observatory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Automatic data generation functions
 *
 * who       when        what
 * --------  ----------  ----------------------------------------------
 * aagudo    2008-02-06  created
 *
 * The functions in this file are only used in functions generating test data
 * in kmos/tests and recipes/tests, therefore no test functions are provided
 * for the functions present here. (This file has to be loccated here since it
 * is referred to from kmos/tests and recipes/tests)
 *
 */

/*
 * $Author: aagudo $
 * $Date: 2012-11-09 12:58:37 $
 * $Revision: 1.4 $
 * $Name: not supported by cvs2svn $
 */

#ifndef KMOS_TEST_CREATE_DATA_H
#define KMOS_TEST_CREATE_DATA_H

#include <sys/stat.h>

#include <cpl.h>

extern float   test_global_seed_data;
extern float   test_global_seed_noise;

extern int     test_global_size_x;
extern int     test_global_size_y;
extern int     test_global_size_z;
extern int     test_global_nr_frames;
extern int     test_global_valid[];

extern const char *test_global_path_test_data;
extern const char *test_global_path_ref_data;
extern const char *test_global_raw_path;

/* ---------------------- test-functions ------------------------------------ */
int            kmo_test_file_exists(const char *name);

const char*    kmo_test_cat_strings(char *newstr,
                               const char *string1,
                               const char *string2);

void           kmo_test_verbose_off();

void           kmo_test_verbose_on();

const char*    kmo_test_esorex_verbose();

void           kmo_get_pipe_command(char *cmd,
                                    const char *filename,
                                    const char *sof,
                                    int extend);

double         kmo_test_esorex_data(const char* filename, int dont_lower);

void           kmo_test_create_pipeline_data();
void           kmo_test_create_pipeline_data_core(const char * subpath, const char *log_path);

cpl_frame*     kmo_test_frame_new(const char *filename,
                                        const char *tag,
                                        cpl_frame_group group);

cpl_error_code kmo_test_update_keywords(cpl_propertylist *pl,
                                        char *keys[],
                                        char *vals[],
                                        int types[],
                                        int nr_keys);

void           kmo_test_fill_vector(cpl_vector *vec,
                                        float seed,
                                        float offset);

void           kmo_test_fill_image(cpl_image *img,
                                        float seed,
                                        float offset);

void           kmo_test_fill_cube(cpl_imagelist *cube,
                                        float seed,
                                        float offset);

void           kmo_test_fill_mask(cpl_image *img);

void           kmo_test_alloc_cube(cpl_imagelist *cube,
                                        int x,
                                        int y,
                                        int z);

void           kmo_test_init_vec(cpl_vector *vec);

cpl_imagelist* kmo_test_create_cube(int x, int y, int z, int gauss, int *offset);

void           kmo_test_create_primary_extension(const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys);

int            kmo_test_create_RAW_data(int x,
                                        int y,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys,
                                        float seed,
                                        float offset);

int            kmo_test_create_RAW_data_zero(int x,
                                        int y,
                                        const char *filename);

int            kmo_test_create_F2D_data(int x,
                                        int y,
                                        int mask,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F2D_data_noise(int x,
                                        int y,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F2I_data(int x,
                                        int y,
                                        int mask,
                                        int nr_images,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F2I_data_noise(int x,
                                        int y,
                                        int nr_images,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F3I_data(int x,
                                        int y,
                                        int z,
                                        int gauss,
                                        int nr_cubes,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F3I_data_infinite(int x,
                                        int y,
                                        int z,
                                        int nr_cubes,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F3I_data2(int x,
                                        int y,
                                        int z,
                                        int nr_cubes,
                                        int val[],
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F3I_data_noise(int x,
                                        int y,
                                        int z,
                                        int gauss,
                                        int nr_cubes,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F1I_data(int x,
                                        int nr_vectors,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_F1I_data_noise(int x,
                                        int nr_vectors,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

int            kmo_test_create_B2D_data(int x,
                                        int y,
                                        int mask,
                                        const char *filename,
                                        char *primary_keys[],
                                        char *primary_vals[],
                                        int primary_types[],
                                        int nr_primary_keys,
                                        char *sub_keys[],
                                        char *sub_vals[],
                                        int sub_types[],
                                        int nr_sub_keys);

#endif
