#ifndef STREAKS_IO_H
#define STREAKS_IO_H 1

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

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

void closeImages(streakFiles *sfiles);

void closeImage(sFile *sfile);

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

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

bool streakFilesNextExtension(streakFiles *sf);

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

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

#endif // STREAKS_IO_H
