/* band_pass.cc Mark Woolrich, FMRIB Image Analysis Group Copyright (C) 1999-2000 University of Oxford */ /* CCOPYRIGHT */ #include <iostream> #include <fstream> #include <sstream> #define WANT_STREAM #define WANT_MATH #include "newmatap.h" #include "newmatio.h" #include "miscmaths/volumeseries.h" #include "miscmaths/volume.h" #include "utils/log.h" #include "BandPassOptions.h" #include <string> #ifndef NO_NAMESPACE using namespace NEWMAT; using namespace FILM; using namespace Utilities; #endif int main(int argc, char *argv[]) { try{ // parse command line to find out directory name for logging: ofstream out2; BandPassOptions& globalopts = BandPassOptions::getInstance(); globalopts.parse_command_line(argc, argv, out2); // Setup logging: Log& logger = Log::getInstance(); logger.setLogFile("bpasslogfile"); logger.establishDir(globalopts.datadir); // parse command line again to output arguments to logfile globalopts.parse_command_line(argc, argv, logger.str()); // load non-temporally filtered data VolumeSeries x; x.read(globalopts.inputfname); x.thresholdSeries(globalopts.thresh, true); SIGPROC::BandPass(x, globalopts.lowcut, globalopts.highcut); // Write out necessary data: cerr << "Saving results... "; x.unthresholdSeries(); x.replaceMeans(); x.writeAsFloat(logger.getDir() + "/bandpassed"); cerr << "Completed" << endl; } catch(Exception p_excp) { cerr << p_excp.what() << endl; } catch(...) { cerr << "Image error" << endl; } return 0; }