This program reads a Cifti file from argv[1], and writes it out to argv[2] using 8-bit unsigned integer and data scaling. It uses a single CiftiFile object to do this, for simplicity - to see how to do something similar with two objects, which is more relevant for how you would do processing on cifti files, see rewrite.cxx.
#include "CiftiFile.h"
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char** argv)
{
if (argc < 3)
{
cout << "usage: " << argv[0] << " <input cifti> <output cifti>" << endl;
cout << " rewrite the input cifti file to the output filename, using uint8 and data scaling, little-endian." << endl;
return 1;
}
try
{
CiftiFile inputFile(argv[1]);
inputFile.writeFile(argv[2], CiftiVersion(), CiftiFile::LITTLE);
} catch (CiftiException& e) {
cerr << "Caught CiftiException: " + AString_to_std_string(e.whatString()) << endl;
return 1;
}
return 0;
}
const int32_t NIFTI_TYPE_UINT8
Definition: nifti1.h:546
namespace for all CiftiLib functionality
Definition: CiftiBrainModelsMap.h:42