Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

raw2vud.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <fstream>
00003 #include <unistd.h>
00004 #include <errno.h>
00005 #include <stdlib.h>
00006 #include "vuFileHelper.h"
00007 #include "Volume/Regular/Unimodal/3d/1B/1B.h"
00008 //#include "Volume/Regular/Unimodal/3d/2B/2B.h" not supported yet
00009 
00010 using namespace std;
00011 
00012 void usage(const char* exe);
00013 bool readnumber(const char* str, int& number);
00014 
00015 int main(int argc, char ** argv)
00016 {
00017     if(argc < 3) {
00018         usage(argv[0]);
00019         return -1;
00020     }
00021 
00022     vuString fileName = argv[1];
00023     vu11121 volume;
00024     
00025     vuString outfileName = argv[2];
00026 
00027     if(readRAW(fileName, volume)) {
00028         volume.setFileName(outfileName);
00029         volume.write();
00030     } else {
00031         cout << "Error: Could convert file " << fileName  << endl;
00032         return -1;
00033     }
00034 
00035     cout << "done." << endl;
00036     return 0;
00037 }
00038 
00039 void usage(const char* exe)
00040 {
00041     const char *file = strrchr(exe,'/');
00042     if(!file) 
00043     {
00044         file = strrchr(exe,'\\');
00045         if(file) file++;
00046         else file = exe;
00047     } else file++;
00048 
00049     cout << "usage:  " << file << " inputmask outputfile startID " 
00050          << "endID [incrementID]" << endl << endl;
00051     cout << "inputmask    format string with ID, e.g., \"c_vm%i.fre.Z\" "<<endl;
00052     cout << "outputfile   name of vud file including extension"<<endl;
00053     cout << "startID      file ID number of first slice" << endl;
00054     cout << "endID        file ID numer of last slice, has to be greater than "
00055          << "startID" << endl;
00056     cout << "incrementID  stepping if only every nth slice should be read. "
00057          << "(default is 1)" << endl;
00058 }
00059 
00060 bool readnumber(const char* str, int& number)
00061 {
00062     char *endp;
00063     errno = 0;
00064     number = strtol(str,&endp,10);
00065     if(errno || 
00066        endp != str+strlen(str)) return false;
00067     return true;
00068 }
00069 

Generated on Wed Dec 15 21:20:30 2004 for vuVolume by  doxygen 1.3.9.1