26 #include <Base/Image/ImageBase.hh>
27 #include <Base/Image/ImageIO.hh>
44 cout <<
"Usage: biassetuid [options] files"<<endl;
45 cout <<
" Options: "<< endl
46 <<
" -f : force setting of a new uid"<<endl
48 cout <<
"This program opens the image files given by the command line"
49 <<
", checks for a valid id and assigns a new one if there is no."<<endl
50 <<
"Returns: 0 on success, 1 if errors occured."<<endl<<endl;
55 string::size_type EndOfPrefix;
58 EndOfPrefix = fn.rfind(
'.');
59 if (EndOfPrefix == string::npos)
return -1;
60 suffix = fn.substr(EndOfPrefix+1,fn.length());
70 int main (
int argc,
char *argv[])
72 bool ForceNewUUID =
false;
74 if (argc>1)
if (!strcmp(
"-f",argv[1])) {
75 std::cout <<
"Existing UIDs are replaced."<<endl;
85 bool ErrorFlag =
false;
90 if (DetermineFiletype(argv[i], FileType)!=0) {
91 BIASERR(
"Skipping current file because of unknown/unsuported format: "
92 <<argv[i]<<endl<<
" UIDs can only be written to mip,pgm,ppm,pnm");
100 BIASERR(
"Error reading "<< argv[i]);
107 if (ForceNewUUID) idstatus = 2;
125 BIASERR(
"Error writing "<< argv[i]);
128 cout <<
"File " << argv[i] <<
" has UID "<<CurImage.
GetUID();
130 case 1: cout<<
" (kept existing)";
break;
131 case 2: cout<<
" (replaced old)";
break;
132 default:cout<<
" (new)";
136 if (ErrorFlag) cout <<
"There were errors." <<endl;
137 if (ErrorFlag)
return 1;
const BIAS::UUID & GetUID() const
returns the UUID of the image
TFileFormat
format specifier when writing an image to a file Do NOT change order or associated enum value because...
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
This is the base class for images in BIAS.
bool IsValid() const
checks whether this uuid is valid(true) or unitialized(false)