1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
|
Author: Andreas Tille <tille@debian.org>
Last-Update: Tue, 15 Jan 2019 12:05:43 +0100
Description: Fix call of overloaded 'round(float)' is ambiguous
--- a/src/ptx2/tractvolsx.h
+++ b/src/ptx2/tractvolsx.h
@@ -138,7 +138,7 @@ namespace TRACTVOLSX{
}
else{
float rtmp=(float)rand()/float(RAND_MAX) * float(fibvec.size()-1);
- return (fibvec[ (int)round(rtmp) ]);
+ return (fibvec[ (int)roundf(rtmp) ]);
}
}
@@ -147,7 +147,7 @@ namespace TRACTVOLSX{
return 0;
}
if(mode==3){//sample all
- return int(round((float)(nfibres-1)*(float)rand()/float(RAND_MAX)));
+ return int(roundf((float)(nfibres-1)*(float)rand()/float(RAND_MAX)));
}
else{
if(mode==1){//sample all>thresh
@@ -163,7 +163,7 @@ namespace TRACTVOLSX{
}
else{
float rtmp=(float)rand()/float(RAND_MAX) * float(fibvec.size()-1);
- return (fibvec[ (int)round(rtmp) ]);
+ return (fibvec[ (int)roundf(rtmp) ]);
}
}
else if(mode==2){//sample all>thresh in proportion of f (default)
@@ -314,7 +314,7 @@ namespace TRACTVOLSX{
return th_ph_f;
}
- int samp=(int)round((float)rand()/float(RAND_MAX)*(float)(nsamples-1))+1;
+ int samp=(int)roundf((float)rand()/float(RAND_MAX)*(float)(nsamples-1))+1;
float theta=0,phi=0;
float dotmax=0,dottmp=0;
--- a/src/ptx2/streamlines.cc
+++ b/src/ptx2/streamlines.cc
@@ -82,8 +82,8 @@
incode = incode % mult;
length_val = incode;
- fibcnt1=(int)round((float)(fibre_prop1*0.001*fibre_count));
- fibcnt2=(int)round((float)(fibre_prop2*0.001*fibre_count));
+ fibcnt1=(int)roundf((float)(fibre_prop1*0.001*fibre_count));
+ fibcnt2=(int)roundf((float)(fibre_prop2*0.001*fibre_count));
length_tot=float(length_val*fibre_count);
nsamples=(int)fibre_count;
}
@@ -135,8 +135,8 @@
decode(code2, nsamples, fibcnt1, fibcnt2, length_tot);
//Update Values
- fibcnt1+=(int)round(props[0]*n);
- fibcnt2+=(int)round(props[1]*n);
+ fibcnt1+=(int)roundf(props[0]*n);
+ fibcnt2+=(int)roundf(props[1]*n);
length_tot+=(dist*n);
nsamples+=n;
@@ -657,9 +657,9 @@ namespace TRACT{
false,m_seeds.get_refvol(),m_mask,xyz_seeds);
Matrix F(3,3),Jw(3,3);
- int x=(int)round((float)xyz_dti(1));
- int y=(int)round((float)xyz_dti(2));
- int z=(int)round((float)xyz_dti(3));
+ int x=(int)roundf((float)xyz_dti(1));
+ int y=(int)roundf((float)xyz_dti(2));
+ int z=(int)roundf((float)xyz_dti(3));
Jw << m_jacx(x,y,z,0) << m_jacx(x,y,z,1) << m_jacx(x,y,z,2)
<< m_jacy(x,y,z,0) << m_jacy(x,y,z,1) << m_jacy(x,y,z,2)
<< m_jacz(x,y,z,0) << m_jacz(x,y,z,1) << m_jacz(x,y,z,2);
@@ -703,9 +703,9 @@ namespace TRACT{
m_diff_path.clear();
x=xst;y=yst;z=zst;
m_part.change_xyz(x,y,z);
- x_p=(int)round(m_part.x());
- y_p=(int)round(m_part.y());
- z_p=(int)round(m_part.z());
+ x_p=(int)roundf(m_part.x());
+ y_p=(int)roundf(m_part.y());
+ z_p=(int)roundf(m_part.z());
// x_p=(int)round(x);y_p=(int)round(y);z_p=(int)round(z);
float pathlength=0;
@@ -740,9 +740,9 @@ namespace TRACT{
//loopchecking
///////////////////////////////////
if(opts.loopcheck.value()){
- lcx=(int)round(m_part.x()/m_lcrat);
- lcy=(int)round(m_part.y()/m_lcrat);
- lcz=(int)round(m_part.z()/m_lcrat);
+ lcx=(int)roundf(m_part.x()/m_lcrat);
+ lcy=(int)roundf(m_part.y()/m_lcrat);
+ lcz=(int)roundf(m_part.z()/m_lcrat);
oldrx=m_loopcheck(lcx,lcy,lcz,0);
oldry=m_loopcheck(lcx,lcy,lcz,1);
oldrz=m_loopcheck(lcx,lcy,lcz,2);
@@ -755,7 +755,7 @@ namespace TRACT{
x=m_part.x();y=m_part.y();z=m_part.z();
xyz_dti <<x<<y<<z;
- x_p=(int)round(x);y_p=(int)round(y);z_p=(int)round(z);
+ x_p=(int)roundf(x);y_p=(int)roundf(y);z_p=(int)roundf(z);
// now find xyz in seeds space
if(cnt>=0){
@@ -766,9 +766,9 @@ namespace TRACT{
}
}
- x_s =(int)round((float)xyz_seeds(1));
- y_s =(int)round((float)xyz_seeds(2));
- z_s =(int)round((float)xyz_seeds(3));
+ x_s =(int)roundf((float)xyz_seeds(1));
+ y_s =(int)roundf((float)xyz_seeds(2));
+ z_s =(int)roundf((float)xyz_seeds(3));
// how prefdir works:
@@ -1369,9 +1369,9 @@ namespace TRACT{
int offset=-1;
bool restarted=false;
for(unsigned int i=0;i<m_path.size();i++){
- x_s=(int)round((float)m_path[i](1));
- y_s=(int)round((float)m_path[i](2));
- z_s=(int)round((float)m_path[i](3));
+ x_s=(int)roundf((float)m_path[i](1));
+ y_s=(int)roundf((float)m_path[i](2));
+ z_s=(int)roundf((float)m_path[i](3));
// check here if back to seed
if(i>0 && (m_path[i]-m_path[0]).MaximumAbsoluteValue()==0){
//m_lastpoint(x_s,y_s,z_s)+=1;
@@ -1437,9 +1437,9 @@ namespace TRACT{
// // Fill last point
// int i=m_path.size()-1;
- // x_s=(int)round((float)m_path[i](1));
- // y_s=(int)round((float)m_path[i](2));
- // z_s=(int)round((float)m_path[i](3));
+ // x_s=(int)roundf((float)m_path[i](1));
+ // y_s=(int)roundf((float)m_path[i](2));
+ // z_s=(int)roundf((float)m_path[i](3));
// m_lastpoint(x_s,y_s,z_s)+=1;
// In network mode, update network matrix
@@ -1455,9 +1455,9 @@ namespace TRACT{
vector<ColumnVector> crossedvox;
bool hascrossed=false;
for(unsigned int i=0;i<m_path.size();i++){
- x_s=(int)round((float)m_path[i](1));
- y_s=(int)round((float)m_path[i](2));
- z_s=(int)round((float)m_path[i](3));
+ x_s=(int)roundf((float)m_path[i](1));
+ y_s=(int)roundf((float)m_path[i](2));
+ z_s=(int)roundf((float)m_path[i](3));
m_beenhere(x_s,y_s,z_s)=0;
// back to first point? keep going
@@ -1586,9 +1586,9 @@ namespace TRACT{
float pathlength=0;
for(unsigned int i=0;i<m_path.size();i++){
pathlength+=opts.steplength.value();
- x_s=(int)round((float)m_path[i](1));
- y_s=(int)round((float)m_path[i](2));
- z_s=(int)round((float)m_path[i](3));
+ x_s=(int)roundf((float)m_path[i](1));
+ y_s=(int)roundf((float)m_path[i](2));
+ z_s=(int)roundf((float)m_path[i](3));
// check here if back to seed
if(i>0 && (m_path[i]-m_path[0]).MaximumAbsoluteValue()==0){
pathlength=0;
@@ -1674,9 +1674,9 @@ namespace TRACT{
d=opts.steplength.value();
xyz_lr=vox_to_vox(m_path[i],m_seedsdim,m_lrdim,m_I);
- x_lr=(int)round((float)xyz_lr(1));
- y_lr=(int)round((float)xyz_lr(2));
- z_lr=(int)round((float)xyz_lr(3));
+ x_lr=(int)roundf((float)xyz_lr(1));
+ y_lr=(int)roundf((float)xyz_lr(2));
+ z_lr=(int)roundf((float)xyz_lr(3));
Concol2=m_lookup2(x_lr,y_lr,z_lr);
if(Concol2>0){
@@ -1743,9 +1743,9 @@ namespace TRACT{
ColumnVector xyz_lr(3);
for(unsigned int i=0;i<m_path.size();i++){
xyz_lr=vox_to_vox(m_path[i],m_seedsdim,m_lrdim,m_I);
- m_beenhere2((int)round((float)xyz_lr(1)),
- (int)round((float)xyz_lr(2)),
- (int)round((float)xyz_lr(3)))=0;
+ m_beenhere2((int)roundf((float)xyz_lr(1)),
+ (int)roundf((float)xyz_lr(2)),
+ (int)roundf((float)xyz_lr(3)))=0;
}
}
@@ -1753,9 +1753,9 @@ namespace TRACT{
ColumnVector xyz(3);
for(unsigned int i=0;i<m_diff_path.size();i++){
xyz<<m_diff_path[i](1)<<m_diff_path[i](2)<<m_diff_path[i](3);
- m_beenhere4((int)round((float)xyz(1)),
- (int)round((float)xyz(2)),
- (int)round((float)xyz(3)))=0;
+ m_beenhere4((int)roundf((float)xyz(1)),
+ (int)roundf((float)xyz(2)),
+ (int)roundf((float)xyz(3)))=0;
}
}
@@ -1772,9 +1772,9 @@ namespace TRACT{
d=opts.steplength.value();
xyz<<m_diff_path[i](1)<<m_diff_path[i](2)<<m_diff_path[i](3);
- x=(int)round((float)xyz(1));
- y=(int)round((float)xyz(2));
- z=(int)round((float)xyz(3));
+ x=(int)roundf((float)xyz(1));
+ y=(int)roundf((float)xyz(2));
+ z=(int)roundf((float)xyz(3));
Conrow4=m_lookup4(x,y,z);
if(Conrow4>0){
@@ -1797,9 +1797,9 @@ namespace TRACT{
d=opts.steplength.value();restarted=true;
offset-=1;
}
- x=(int)round(float(m_diff_path[i](1)));
- y=(int)round(float(m_diff_path[i](2)));
- z=(int)round(float(m_diff_path[i](3)));
+ x=(int)roundf(float(m_diff_path[i](1)));
+ y=(int)roundf(float(m_diff_path[i](2)));
+ z=(int)roundf(float(m_diff_path[i](3)));
if(m_beenhere4(x,y,z)==0){
rows.push_back(m_lookup4(x,y,z));
@@ -2067,7 +2067,7 @@ namespace TRACT{
// randfib==1 - random sampling of fibres bigger than fthresh
// randfib==2 random sampling of fibres bigger than fthresh in proporthion to their f-values.
float tmp=rand()/float(RAND_MAX) * float(m_counter.get_stline().nfibres()-1);
- fibst = (int)round(tmp);
+ fibst = (int)roundf(tmp);
}
// random jitter of seed point inside a sphere
--- a/src/ptx2/csv.cc
+++ b/src/ptx2/csv.cc
@@ -88,9 +88,9 @@ bool CSV::has_crossed(const ColumnVector
// x1 and x2 in voxel space
int ix,iy,iz;
if(nvols>0){
- ix=(int)round((float)x2(1));
- iy=(int)round((float)x2(2));
- iz=(int)round((float)x2(3));
+ ix=(int)roundf((float)x2(1));
+ iy=(int)roundf((float)x2(2));
+ iz=(int)roundf((float)x2(3));
if(roivol(ix,iy,iz)!=0){
for(int i=1;i<=nvols;i++){
@@ -114,9 +114,9 @@ bool CSV::has_crossed(const ColumnVector
vector< pair<int,int> > localtriangles;
for(unsigned int i=0;i<crossed.size();i++){
- int val=surfvol((int)round((float)crossed[i](1)),
- (int)round((float)crossed[i](2)),
- (int)round((float)crossed[i](3)))-1;
+ int val=surfvol((int)roundf((float)crossed[i](1)),
+ (int)roundf((float)crossed[i](2)),
+ (int)roundf((float)crossed[i](3)))-1;
if(val<0)continue;
localtriangles.insert(localtriangles.end(),triangles[val].begin(),triangles[val].end());
@@ -179,9 +179,9 @@ bool CSV::has_crossed_roi(const ColumnVe
// start by looking at volume roi
if(nvols>0){
- ix=(int)round((float)x2(1));
- iy=(int)round((float)x2(2));
- iz=(int)round((float)x2(3));
+ ix=(int)roundf((float)x2(1));
+ iy=(int)roundf((float)x2(2));
+ iz=(int)roundf((float)x2(3));
if(roivol(ix,iy,iz)!=0){
for(int i=1;i<=nvols;i++){
@@ -201,9 +201,9 @@ bool CSV::has_crossed_roi(const ColumnVe
vector< pair<int,int> > localtriangles;
for(unsigned int i=0;i<crossed.size();i++){
//OUT(crossed[i].t());
- int val=surfvol((int)round((float)crossed[i](1)),
- (int)round((float)crossed[i](2)),
- (int)round((float)crossed[i](3)))-1;
+ int val=surfvol((int)roundf((float)crossed[i](1)),
+ (int)roundf((float)crossed[i](2)),
+ (int)roundf((float)crossed[i](3)))-1;
if(val<0)continue;
localtriangles.insert(localtriangles.end(),triangles[val].begin(),triangles[val].end());
}
@@ -254,9 +254,9 @@ bool CSV::has_crossed_roi(const ColumnVe
// start by looking at volume roi
if(nvols>0){
- ix=(int)round((float)x2(1));
- iy=(int)round((float)x2(2));
- iz=(int)round((float)x2(3));
+ ix=(int)roundf((float)x2(1));
+ iy=(int)roundf((float)x2(2));
+ iz=(int)roundf((float)x2(3));
if(roivol(ix,iy,iz)!=0){
for(int i=1;i<=nvols;i++){
@@ -276,9 +276,9 @@ bool CSV::has_crossed_roi(const ColumnVe
for(unsigned int i=0;i<crossed.size();i++){
//OUT(crossed[i].t());
- int val=surfvol((int)round((float)crossed[i](1)),
- (int)round((float)crossed[i](2)),
- (int)round((float)crossed[i](3)))-1;
+ int val=surfvol((int)roundf((float)crossed[i](1)),
+ (int)roundf((float)crossed[i](2)),
+ (int)roundf((float)crossed[i](3)))-1;
if(val<0)continue;
localtriangles.insert(localtriangles.end(),triangles[val].begin(),triangles[val].end());
}
@@ -382,9 +382,9 @@ int CSV::coord_sign(const int& loc,const
line_crossed_voxels(line,crossed);
vector< pair<int,int> > localtriangles;
for(unsigned int i=0;i<crossed.size();i++){
- int val=surfvol((int)round((float)crossed[i](1)),
- (int)round((float)crossed[i](2)),
- (int)round((float)crossed[i](3)))-1;
+ int val=surfvol((int)roundf((float)crossed[i](1)),
+ (int)roundf((float)crossed[i](2)),
+ (int)roundf((float)crossed[i](3)))-1;
if(val<0)continue;
localtriangles.insert(localtriangles.end(),triangles[val].begin(),triangles[val].end());
}
@@ -476,17 +476,17 @@ void CSV::init_surfvol(){
}
void CSV::update_surfvol(const vector<ColumnVector>& v,const int& tid,const int& meshid){
for(unsigned int i=0;i<v.size();i++){// loop over voxels crossed by triangle tid
- int val = surfvol((int)round((float)v[i](1)),
- (int)round((float)v[i](2)),
- (int)round((float)v[i](3)));
+ int val = surfvol((int)roundf((float)v[i](1)),
+ (int)roundf((float)v[i](2)),
+ (int)roundf((float)v[i](3)));
if(val==0){//this voxel hasn't been labeled yet
vector< pair<int,int> > t(1);
t[0].first=meshid; // remember which mesh this triangle is in
t[0].second=tid; // triangle id within that mesh
triangles.push_back(t); // add to set of triangles that cross voxels
- surfvol((int)round((float)v[i](1)),
- (int)round((float)v[i](2)),
- (int)round((float)v[i](3)))=(int)triangles.size();
+ surfvol((int)roundf((float)v[i](1)),
+ (int)roundf((float)v[i](2)),
+ (int)roundf((float)v[i](3)))=(int)triangles.size();
}
else{// voxel already labeled as "crossed"
pair<int,int> mypair(meshid,tid);
@@ -627,9 +627,9 @@ void CSV::reset_values(const vector<int>
void CSV::add_value(const int& loc,const float& val){
if(loctype[loc]==VOLUME){
// is locind the right thing to do here?
- int x=(int)round((float)loccoords[loc](1));
- int y=(int)round((float)loccoords[loc](2));
- int z=(int)round((float)loccoords[loc](3));
+ int x=(int)roundf((float)loccoords[loc](1));
+ int y=(int)roundf((float)loccoords[loc](2));
+ int z=(int)roundf((float)loccoords[loc](3));
hitvol(vol2mat(x,y,z),locsubroi[loc]+1) += val;
}
else if(loctype[loc]==SURFACE){
@@ -646,9 +646,9 @@ void CSV::add_value(const int& loc,const
void CSV::set_value(const int& loc,const float& val){
if(loctype[loc]==VOLUME){
// is locind the right thing to do here?
- int x=(int)round((float)loccoords[loc](1));
- int y=(int)round((float)loccoords[loc](2));
- int z=(int)round((float)loccoords[loc](3));
+ int x=(int)roundf((float)loccoords[loc](1));
+ int y=(int)roundf((float)loccoords[loc](2));
+ int z=(int)roundf((float)loccoords[loc](3));
hitvol(vol2mat(x,y,z),locsubroi[loc]+1) = val;
}
else if(loctype[loc]==SURFACE){
@@ -664,9 +664,9 @@ void CSV::set_value(const int& loc,const
float CSV::get_value(const int& loc)const{
if(loctype[loc]==VOLUME){
// is locind the right thing to do here?
- int x=(int)round((float)loccoords[loc](1));
- int y=(int)round((float)loccoords[loc](2));
- int z=(int)round((float)loccoords[loc](3));
+ int x=(int)roundf((float)loccoords[loc](1));
+ int y=(int)roundf((float)loccoords[loc](2));
+ int z=(int)roundf((float)loccoords[loc](3));
return(hitvol(vol2mat(x,y,z),locsubroi[loc]+1));
}
else if(loctype[loc]==SURFACE){
@@ -1088,7 +1088,7 @@ bool CSV::is_near_surface(const ColumnVe
for(float z=pos(3)-zstep;z<=pos(3)+zstep;z++){
d=(pos(1)-x)*(pos(1)-x)+(pos(2)-y)*(pos(2)-y)+(pos(3)-z)*(pos(3)-z);
if(d>d2)continue;
- int ind=surfvol((int)round(x),(int)round(y),(int)round(z))-1;
+ int ind=surfvol((int)roundf(x),(int)roundf(y),(int)roundf(z))-1;
if(ind<0)continue;
// potential surface detected
float curdist;
@@ -1123,13 +1123,13 @@ bool CSV::is_near_surface(const ColumnVe
void CSV::find_crossed_voxels(const ColumnVector& P1,const ColumnVector& P2,vector<ColumnVector>& crossed){
crossed.clear();
- float x1 = round((float)P1(1));
- float y1 = round((float)P1(2));
- float z1 = round((float)P1(3));
-
- float x2 = round((float)P2(1));
- float y2 = round((float)P2(2));
- float z2 = round((float)P2(3));
+ float x1 = roundf((float)P1(1));
+ float y1 = roundf((float)P1(2));
+ float z1 = roundf((float)P1(3));
+
+ float x2 = roundf((float)P2(1));
+ float y2 = roundf((float)P2(2));
+ float z2 = roundf((float)P2(3));
float dx = (x2 - x1)*_xdim;
float dy = (y2 - y1)*_ydim;
@@ -1143,9 +1143,9 @@ void CSV::find_crossed_voxels(const Colu
int sy = (int)sign(dy);
int sz = (int)sign(dz);
- int x = (int)round((float)x1);
- int y = (int)round((float)y1);
- int z = (int)round((float)z1);
+ int x = (int)roundf((float)x1);
+ int y = (int)roundf((float)y1);
+ int z = (int)roundf((float)z1);
ColumnVector curVox(3);
float xd,yd,zd;
@@ -1232,19 +1232,19 @@ void CSV::find_crossed_voxels(const Colu
void CSV::line_crossed_voxels(float line[2][3],vector<ColumnVector>& crossed)const{
//Tracer_Plus tr("CSV::line_crossed_voxels");
crossed.clear();
- int minx=(int)round(line[0][0]);
- int miny=(int)round(line[0][1]);
- int minz=(int)round(line[0][2]);
+ int minx=(int)roundf(line[0][0]);
+ int miny=(int)roundf(line[0][1]);
+ int minz=(int)roundf(line[0][2]);
int maxx=minx,maxy=miny,maxz=minz;
int i=0;int tmpi;
do{
- tmpi=(int)round(line[i][0]);
+ tmpi=(int)roundf(line[i][0]);
minx=tmpi<minx?tmpi:minx;
maxx=tmpi>maxx?tmpi:maxx;
- tmpi=(int)round(line[i][1]);
+ tmpi=(int)roundf(line[i][1]);
miny=tmpi<miny?tmpi:miny;
maxy=tmpi>maxy?tmpi:maxy;
- tmpi=(int)round(line[i][2]);
+ tmpi=(int)roundf(line[i][2]);
minz=tmpi<minz?tmpi:minz;
maxz=tmpi>maxz?tmpi:maxz;
i++;
@@ -1282,20 +1282,20 @@ void CSV::line_crossed_voxels(float line
// this one searches within the bounding box of the triangle for voxels crossed by the whole triangle
void CSV::tri_crossed_voxels(float tri[3][3],vector<ColumnVector>& crossed){
- int minx=(int)round(tri[0][0]);
- int miny=(int)round(tri[0][1]);
- int minz=(int)round(tri[0][2]);
+ int minx=(int)roundf(tri[0][0]);
+ int miny=(int)roundf(tri[0][1]);
+ int minz=(int)roundf(tri[0][2]);
int maxx=minx,maxy=miny,maxz=minz;
crossed.clear();
int i=0;int tmpi;
do{
- tmpi=(int)round(tri[i][0]);
+ tmpi=(int)roundf(tri[i][0]);
minx=tmpi<minx?tmpi:minx;
maxx=tmpi>maxx?tmpi:maxx;
- tmpi=(int)round(tri[i][1]);
+ tmpi=(int)roundf(tri[i][1]);
miny=tmpi<miny?tmpi:miny;
maxy=tmpi>maxy?tmpi:maxy;
- tmpi=(int)round(tri[i][2]);
+ tmpi=(int)roundf(tri[i][2]);
minz=tmpi<minz?tmpi:minz;
maxz=tmpi>maxz?tmpi:maxz;
i++;
--- a/src/ptx2/ccops.cc
+++ b/src/ptx2/ccops.cc
@@ -167,7 +167,7 @@ void do_kmeans(const Matrix& data,Column
// initialise with far-away trick
// start with a random class centre. then each new class centre is
// as far as possible from the cog of the previous classes
- means.Column(1) = data.Row(round(rand()/float(RAND_MAX)*float(n-1))+1).t();
+ means.Column(1) = data.Row(roundf(rand()/float(RAND_MAX)*float(n-1))+1).t();
ColumnVector cog(d);
for(int cl=2;cl<=k;cl++){
cog = sum(means.SubMatrix(1,d,1,cl-1),2);
@@ -257,7 +257,7 @@ void do_fuzzy(const Matrix& data,Matrix&
// initialise with far-away trick
// start with a random class centre. then each new class centre is
// as far as possible from the cog of the previous classes
- means.Column(1) = data.Row(round(rand()/float(RAND_MAX)*float(n-1))+1).t();
+ means.Column(1) = data.Row(roundf(rand()/float(RAND_MAX)*float(n-1))+1).t();
ColumnVector cog(d);
for(int cl=2;cl<=k;cl++){
cog = sum(means.SubMatrix(1,d,1,cl-1),2);
--- a/src/ptx2/fdt_matrix_split.cc
+++ b/src/ptx2/fdt_matrix_split.cc
@@ -158,9 +158,9 @@ void vol2mat(const volume<float>& mask,M
counter++;
seed_xyz << x << y << z;
mask3_xyz = vox_to_vox(seed_xyz,seed_dims,mask3_dims,xfm);
- xx=(int)round(float(mask3_xyz(1)));
- yy=(int)round(float(mask3_xyz(2)));
- zz=(int)round(float(mask3_xyz(3)));
+ xx=(int)roundf(float(mask3_xyz(1)));
+ yy=(int)roundf(float(mask3_xyz(2)));
+ zz=(int)roundf(float(mask3_xyz(3)));
if(mask3(xx,yy,zz)!=0)
coords(counter,1) = lu(xx,yy,zz);
else
@@ -297,9 +297,9 @@ int do_split_matrix(){
for(int loc=1;loc<=targets->nLocs();loc++){
if(targets->isVol(i)){
coords = targets->get_loc_coords(loc);
- x=(int)round((float)coords(1));
- y=(int)round((float)coords(2));
- z=(int)round((float)coords(3));
+ x=(int)roundf((float)coords(1));
+ y=(int)roundf((float)coords(2));
+ z=(int)roundf((float)coords(3));
if(!mask3->isInRoi(x,y,z))continue;
for(int j=0;j<mask3->nVols();j++)
--- a/src/ptx2/surf2volume.cc
+++ b/src/ptx2/surf2volume.cc
@@ -105,15 +105,15 @@ int main(int argc, char** argv){
// pos=csv.get_vertex_as_vox(0,i);
// dir=csv.get_normal_as_vox(0,i);
-// odir((int)round((float)pos(1)),
-// (int)round((float)pos(2)),
-// (int)round((float)pos(3)),0)=dir(1);
-// odir((int)round((float)pos(1)),
-// (int)round((float)pos(2)),
-// (int)round((float)pos(3)),1)=dir(2);
-// odir((int)round((float)pos(1)),
-// (int)round((float)pos(2)),
-// (int)round((float)pos(3)),2)=dir(3);
+// odir((int)roundf((float)pos(1)),
+// (int)roundf((float)pos(2)),
+// (int)roundf((float)pos(3)),0)=dir(1);
+// odir((int)roundf((float)pos(1)),
+// (int)roundf((float)pos(2)),
+// (int)roundf((float)pos(3)),1)=dir(2);
+// odir((int)roundf((float)pos(1)),
+// (int)roundf((float)pos(2)),
+// (int)roundf((float)pos(3)),2)=dir(3);
// }
// odir.setDisplayMaximumMinimum(1,-1);
--- a/src/ptx2/surf_proj.cc
+++ b/src/ptx2/surf_proj.cc
@@ -262,9 +262,9 @@ int main(int argc,char *argv[]){
else
data_vox = NewimageCoord2NewimageCoord(data2surf_warp,false,refvol,data[0],xx);
- ix = (int)round((float)data_vox(1));
- iy = (int)round((float)data_vox(2));
- iz = (int)round((float)data_vox(3));
+ ix = (int)roundf((float)data_vox(1));
+ iy = (int)roundf((float)data_vox(2));
+ iz = (int)roundf((float)data_vox(3));
for(int j=0;j<data.tsize();j++){
vals[j].push_back(data(ix,iy,iz,j));
@@ -280,9 +280,9 @@ int main(int argc,char *argv[]){
else
data_vox = NewimageCoord2NewimageCoord(data2surf_warp,false,refvol,data[0],xx);
- ix = (int)round((float)data_vox(1));
- iy = (int)round((float)data_vox(2));
- iz = (int)round((float)data_vox(3));
+ ix = (int)roundf((float)data_vox(1));
+ iy = (int)roundf((float)data_vox(2));
+ iz = (int)roundf((float)data_vox(3));
for(int j=0;j<data.tsize();j++){
vals[j].push_back(data(ix,iy,iz,j));
--- a/src/ptx2/surf_prop_dir.cc
+++ b/src/ptx2/surf_prop_dir.cc
@@ -177,9 +177,9 @@ int main(int argc,char *argv[]){
<<x(3)+s/(nsteps-1)*step/surfdim(3)*n(3);
dti_vox = vox_to_vox(x,surfdim,outdim,surf2out);
- ix = (int)round((float)dti_vox(1));
- iy = (int)round((float)dti_vox(2));
- iz = (int)round((float)dti_vox(3));
+ ix = (int)roundf((float)dti_vox(1));
+ iy = (int)roundf((float)dti_vox(2));
+ iz = (int)roundf((float)dti_vox(3));
dyads(ix,iy,iz,0) = n(1);
dyads(ix,iy,iz,1) = n(2);
--- a/src/ptx2/surf_samp.cc
+++ b/src/ptx2/surf_samp.cc
@@ -206,9 +206,9 @@ int main(int argc,char *argv[]){
else
data_vox = NewimageCoord2NewimageCoord(data2surf_warp,false,refvol,data,xx);
- ix = (int)round((float)data_vox(1));
- iy = (int)round((float)data_vox(2));
- iz = (int)round((float)data_vox(3));
+ ix = (int)roundf((float)data_vox(1));
+ iy = (int)roundf((float)data_vox(2));
+ iz = (int)roundf((float)data_vox(3));
surfdata(ind,s+1)=data(ix,iy,iz);
|