本文整理汇总了C++中Cube::SetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::SetFileName方法的具体用法?C++ Cube::SetFileName怎么用?C++ Cube::SetFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::SetFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Extractor::init(tokenlist &args)
{
// defaults
xvflag=0;
newdim[0]=41;
newdim[1]=51;
newdim[2]=27;
newcube.voxsize[0]=3.75;
newcube.voxsize[1]=3.75;
newcube.voxsize[2]=5.00;
newcube.origin[0]=21;
newcube.origin[1]=31;
newcube.origin[2]=10;
original.ReadFile(args[0]);
if (args.size()==1)
newcube.SetFileName((string)"m"+original.GetFileName());
if (args.size()==2 || args.size()==3) {
newcube.SetFileName(args[1]);
if (args.size()==3) {
xval=strtol(args[2]);
xvflag=1;
}
}
if (args.size()==11 || args.size()==12) {
newcube.SetFileName(args[1]);
newdim[0]=strtol(args[2]);
newdim[1]=strtol(args[3]);
newdim[2]=strtol(args[4]);
newcube.voxsize[0]=strtod(args[5]);
newcube.voxsize[1]=strtod(args[6]);
newcube.voxsize[2]=strtod(args[7]);
newcube.origin[0]=strtol(args[8]);
newcube.origin[1]=strtol(args[9]);
newcube.origin[2]=strtol(args[10]);
if (args.size()==12) {
xval=strtol(args[11]);
xvflag=1;
}
}
newcube.SetVolume(newdim[0],newdim[1],newdim[2],original.datatype);
}
示例2: receive_3d
//.........这里部分代码省略.........
if (!c)
complain(ERROR_NOMEM);
//----------------------------------------------
// Store the user header into the Cube object.
//
for (i=0; i < total_header_items; i++) {
c->header.push_back (user_header[i]);
}
//----------------------------------------------
// Now we process specific user header data
// that we know have equivalents in the Tes object.
//
for (i=0; i < total_header_items; i++) {
const char *s = user_header[i].c_str();
char *s2 = s ? strchr(s, ':') : NULL;
if (s2 && '*' == *s2)
continue;
#ifdef DEBUG
fprintf(stderr, "putdata got user header line: %s\n", s);
#endif
if (!s2) s2 = s ? strchr (s, '=') : NULL;
if (s2) {
*s2++ = 0;
if (!strcasecmp (s, "VoxSizes(xyz)")) {
double x,y,z;
if (3 == sscanf (s2, "%lg %lg %lg", &x,&y,&z)) {
c->voxsize[0] = x;
c->voxsize[1] = y;
c->voxsize[2] = z;
} else {
WARNING("invalid voxsizes from user header.");
}
}
else
if (!strcasecmp (s, "Origin(xyz)")) {
int x,y,z;
if (3 == sscanf (s2, "%d %d %d", &x,&y,&z)) {
c->origin[0] = x;
c->origin[1] = y;
c->origin[2] = z;
} else {
WARNING("invalid origin from user header.");
}
}
else
if (!strcasecmp (s, "Orientation")) {
c->orient = s2;
}
else
if (!strcasecmp (s, "Scale")) {
// float f = atof(s2);
// c->scalefactor = f ? f : 1.0;
}
else
if (!strcasecmp (s, "ByteOrder")) {
c->filebyteorder = atoi(s2)? ENDIAN_BIG : ENDIAN_LITTLE;
}
}
}
//----------------------------------------------
// Get the data
//
ulong chunk_size = dimx * dimy * dimz * datasize;
unsigned char *chunk = (unsigned char*) malloc (chunk_size);
if (!chunk)
complain(ERROR_NOMEM);
if (chunk_size != fread (chunk,1,chunk_size,f))
complain(ERROR_READFAIL);
fclose (f);
read_completed = true;
c->data = chunk;
//----------------------------------------------
// Write the Cube to a file.
//
c->SetFileName (path);
#ifdef DEBUG
fprintf(stderr, "Calling write cube to file %s\n", path);
#endif
c->WriteFile ();
//----------------------------------------------
// Return the success code
//
f = fopen (fifo_to_idl, "wb");
if (!f)
return 0;
fprintf (f, "0\n");
fflush(f);
fclose(f);
delete c;
return 0;
}