本文整理汇总了C++中Cube::dimsequal方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::dimsequal方法的具体用法?C++ Cube::dimsequal怎么用?C++ Cube::dimsequal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::dimsequal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
void
cmp3d(Cube &c1,Cube &c2,Cube &mask,string spacer)
{
if (!(c1.dimsequal(c2))) {
printf("[I] vbcmp: %sdimensions don't match, can't compare.\n",spacer.c_str());
return;
}
if (mask.data && !(c1.dimsequal(mask))) {
printf("[I] vbcmp: %smask dimensions don't agree with images\n",spacer.c_str());
return;
}
double totaldiff,maxdiff=0.0,v1,v2,diff;
uint32 diffcount,voxelcount;
int i,j,k;
diffcount=0;
totaldiff=0.0;
int maxx=0,maxy=0,maxz=0;
voxelcount=c1.dimx * c1.dimy * c1.dimz;
// pre-count mask
if (mask.data) {
int newvoxelcount=0;
for (size_t i=0; i<voxelcount; i++)
if (mask.testValue(i))
newvoxelcount++;
voxelcount=newvoxelcount;
}
VB_Vector vec1(voxelcount),vec2(voxelcount);
uint64 ind=0;
for (i=0; i<c1.dimx; i++) {
for (j=0; j<c1.dimy; j++) {
for (k=0; k<c1.dimz; k++) {
if (mask.data)
if (!(mask.testValue(i,j,k))) continue;
v1=c1.GetValue(i,j,k);
v2=c2.GetValue(i,j,k);
// to support correlation, smush into vectors:
vec1[ind]=v1; vec2[ind]=v2; ind++;
if (v1 != v2) {
if (isnan(v1) && isnan(v2)) continue;
if (isinf(v1) && isinf(v2)) continue;
diffcount++;
diff=fabs(v1-v2);
totaldiff += diff;
if (diff>maxdiff) {
maxdiff=diff;
maxx=i;
maxy=j;
maxz=k;
}
}
}
}
}
if (!diffcount) {
printf("[I] vbcmp: %sthe data are identical\n",spacer.c_str());
}
else {
cout << format("[I] vbcmp: %sdifferent voxels: %ld of %ld (%.0f%%)\n")
% spacer % diffcount % voxelcount % ((diffcount*100.0)/voxelcount);
cout << format("[I] vbcmp: %smean difference: %.8f\n") % spacer % (totaldiff/diffcount);
cout << format("[I] vbcmp: %smax difference: %.8f (%d,%d,%d)\n")
% spacer % maxdiff % maxx % maxy % maxz;
cout << format("[I] vbcmp: %scorrelation between images: %g\n")%spacer%correlation(vec1,vec2);
}
}
示例2: if
int
main(int argc,char *argv[])
{
if (argc<2) {
vbcmap_help();
exit(0);
}
tokenlist args;
vector<string>filelist;
string dvname,ivname,outfile,maskfile,pfile,pmapname;
args.Transfer(argc-1,argv+1);
int part=1,nparts=1;
string perm_mat;
int perm_index=-1;
int minlesions=2;
bool f_yates=0;
bool f_fisher=0;
bool f_zscore=0;
bool f_flip=0;
bool f_fdr=0;
bool f_twotailed=0;
bool f_nodup=0;
float q=0;
for (size_t i=0; i<args.size(); i++) {
if (args[i]=="-v")
vbcmap_version();
else if (args[i]=="-h")
vbcmap_help();
else if (args[i]=="-2")
f_twotailed=1;
else if (args[i]=="-z")
f_zscore=1;
else if (args[i]=="-f")
f_flip=1;
else if (args[i]=="-x")
f_fisher=1;
else if (args[i]=="-y")
f_yates=1;
else if (args[i]=="-nodup")
f_nodup=1;
else if (args[i]=="-pfile" && i<args.size()-1) {
pfile=args[++i];
}
else if (args[i]=="-pmap" && i<args.size()-1) {
pmapname=args[++i];
}
else if (args[i]=="-m" && i<args.size()-1) {
maskfile=args[++i];
}
else if (args[i]=="-q" && i<args.size()-1) {
f_fdr=1;
q=strtod(args[++i]);
}
else if (args[i]=="-n" && i<args.size()-1) {
minlesions=strtol(args[++i]);
if (minlesions<2) minlesions=2;
}
else if (args[i]=="-op" && i<args.size()-2) {
perm_mat=args[++i];
perm_index=strtol(args[++i]);
}
else if (args[i]=="-p" && i<args.size()-2) {
part=strtol(args[++i]);
nparts=strtol(args[++i]);
}
else
filelist.push_back(args[i]);
}
if (filelist.size()!=3) {
vbcmap_help();
exit(112);
}
ivname=filelist[0];
dvname=filelist[1];
outfile=filelist[2];
Cube tmap,mask;
Tes ts;
VB_Vector depvar;
if (ts.ReadFile(ivname)) {
printf("[E] vbcmap: couldn't get grouping info from %s\n",ivname.c_str());
exit(101);
}
if (depvar.ReadFile(dvname)) {
printf("[E] vbcmap: couldn't get dependent variable info from %s\n",dvname.c_str());
exit(102);
}
// build our mask
ts.ExtractMask(mask);
if (maskfile.size()) {
Cube tmask;
if (tmask.ReadFile(maskfile)) {
printf("[E] vbcmap: couldn't read mask file %s\n",maskfile.c_str());
exit(103);
}
if (!(tmask.dimsequal(mask))) {
printf("[E] vbcmap: lesion maps and mask files have inconsistent dimensions\n");
//.........这里部分代码省略.........