65{
66 char rwcname[256]="\0", edbname[256]="\0", mapname[256]="\0", grsname[256]="\0";
67 char options[256]="\0";
68 bool addmap(false),addgrs(false);
69
70 bool printusage=(argc<3)?true:false;
71 for (int i = 1; i < argc; i++) {
72 if (!strcmp(argv[i], "-map")) {
73 if (i + 1 <= argc - 1) { sprintf(mapname,argv[++i]); addmap=true; }
74 else printusage=true;
75 }
76 else if (!strcmp(argv[i], "-grs")) {
77 if (i + 1 <= argc - 1) { sprintf(grsname,argv[++i]); addgrs=true; }
78 else printusage=true;
79 }
80 else if (!strcmp(argv[i], "-nocl")) strcat(options,"NOCL") ;
81 else if (!strcmp(argv[i], "-asum")) strcat(options,"SUM") ;
82 else if (!strcmp(argv[i], "-clframe")) strcat(options,"CLFRAME") ;
83 else {
84 sprintf(rwcname,argv[i++]);
85 sprintf(edbname,argv[i]);
86 }
87 }
88 if(printusage) {
89 cout<< "usage: rwc2edb <input file (.rwc|.rwd|.txt)> <output file (.root)> [options] "<<endl;
90 cout << "\n options: -nocl = do not add the clusters" << endl;
91 cout << " -clframe = fill clusters.eFrame (default empty) -> +4% file size" << endl;
92 cout << " -map filename = add the fiducial marks file (.map) (only mswindows)" << endl;
93 cout << " -grs filename = merge raw data (.rwd) and grains (.txt) " << endl;
94 cout << " (if only grains: rwc2edb fname.txt fname.root)" << endl;
95 cout << " -asum = encode the sum of cluster areas in the segment puls" << endl;
96 cout << " (puls = (sum of clust areas)*1000 + (number of grains)" << endl;
97 return 0;
98 };
99
100 bool testrun = false;
101 bool txtrun = false ;
102 if(rwcname[strlen(rwcname)-1]=='d') testrun=true;
103 if(rwcname[strlen(rwcname)-1]=='t') txtrun =true;
104
106 outrun =
new EdbRun(edbname,
"CREATE");
107
108 if(testrun)
109 {
110
111 cout<<"TestRun"<<endl;
112 int fragID = 0;
113 AddRWD(outrun, rwcname, fragID, options);
114
115 if (addgrs)
116 {
117 char grsoutname[256];
118 strncpy( grsoutname + strlen(rwcname)-3, "grs", 3);
119 sprintf( grsoutname,"%s.root",grsoutname);
120
122 outrun2 =
new EdbRun(grsoutname,
"CREATE");
123
127 }
128 }
129 else if(txtrun)
130 {
131
133 }
134 else
135 {
136
137 printf("options 1: %s\n", options);
138 AddRWC(outrun, rwcname,
true,options);
139 if (addmap)
AddMAP(outrun, mapname);
140 }
143
144 if (testrun) return 0;
145}
void Close()
Definition: EdbRun.cxx:439
void Print() const
Definition: EdbRun.cxx:580
int AddGrainsTXT(EdbRun *run, char *txtname)
Definition: libDataConversion.cpp:340
int AddMAP(EdbRun *run, char *mapname)
Definition: libDataConversion.cpp:311
int AddRWD(EdbRun *run, char *rwdname, int fragID, const char *options)
Definition: libDataConversion.cpp:176
int AddRWC(EdbRun *run, char *rwcname, int bAddRWD, const char *options)
Definition: libDataConversion.cpp:64