#ifndef STREAKS_IO_H
#define STREAKS_IO_H 1

streakFiles *openFiles(pmConfig *config, bool remove, char *program_name);

sFile *sFileOpen(pmConfig *config, ippStage stage, psString fileSelect,
    psString outputFilename, bool required, bool checkIfDestreaked);

void closeImages(streakFiles *sfiles);

void closeImage(sFile *sfile);

void readImage(sFile *sfile, int extnum, ippStage stage, bool isMask);
void copyPHU(streakFiles *sfiles, bool remove, bool destreaked);
void copyTable(sFile *out, sFile *in, int extnum);
void copyFitsOptions(sFile *out, sFile *rec, sFile *in, psVector *tiles);
void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll);
void strkGetMaskValues(streakFiles *sfiles);
void copyExtraExtensions(streakFiles *sfiles);

void writeImage(sFile *sfile, psString extname, int extnum);
void writeImageCube(sFile *sfile, psArray *imagecube, psString extname, int extnum);
bool replicate(sFile *outFile, sFile *inFile);
void readImageFrom_pmFile(streakFiles *sf);

void addDestreakKeyword(psMetadata *, bool value);
void addRecoveryKeyword(psMetadata *);

bool streakFilesNextExtension(streakFiles *sf);

bool isExciseValue(double, double);
void setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts);

bool replicateOutputs(streakFiles *sf);
bool swapOutputsToInputs(streakFiles *sf);
bool deleteTemps(streakFiles *sf);
void streaksNebulousCleanup(void);

#endif // STREAKS_IO_H
