/* * pgmio.h * * Created on: Oct 31, 2019 * Author: lutton */ #ifndef PGMIO_H_ #define PGMIO_H_ #ifdef __cplusplus extern "C"{ #endif typedef struct file_node { char file_name[256]; char file_path[1024]; struct file_node *next; } file_node_t; typedef enum {DIM_COLUMNS, DIM_ROWS, DIM_SLICES} dim_idx; file_node_t * get_pgm_files(char path[]); // returns a list of pgm file names in the directory path, or nothing if no files were found int * get_pgm_dimensions(char path[]); // returns the dimensions of an image int get_pgm_size(char path[]); // returns the size of an image int get_pgm_dimension(char path[], dim_idx dim); // returns the size of the image at location path in in dimension dim unsigned char * pgm_read(char path[]); // returns image from pgm file from the given path, or NULL if error int pgm_write(unsigned char *img, char path[], int dims[]); // writes img to pgm file to the given path, returns 0 if no error #ifdef __cplusplus } #endif #endif /* PGMIO_H_ */