Changeset 2617
- Timestamp:
- 08/01/12 17:40:15 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/EdgeMarker.cpp
r2615 r2617 72 72 73 73 // exclude WVR 74 vector<uInt> wvr ; 74 Block<uInt> wvr( st_->getIFNos().size() ) ; 75 uInt n = 0 ; 75 76 { 76 77 ROArrayColumn<uChar> flagCol( st_->table(), "FLAGTRA" ) ; … … 82 83 uInt nchan = flagCol( firstRow ).nelements() ; 83 84 if ( nchan == 4 ) 84 wvr .push_back( current );85 wvr[n++] = current ; 85 86 iter.next() ; 86 87 } 87 88 } 88 wvr_ = Vector<uInt>( wvr) ;89 wvr_.takeStorage( IPosition(1,n), wvr.storage(), COPY ) ; 89 90 90 91 if ( wvr_.nelements() > 0 ) { -
trunk/src/GenericEdgeDetector.cpp
r2615 r2617 215 215 const uInt maxiter = 100 ; 216 216 while ( n > 0 && niter < maxiter ) { 217 n = _labeling( apix_) ;217 n = _labeling() ; 218 218 os_ << LogIO::DEBUGGING 219 219 << "cycle " << niter << ": labeled " << n << " pixels" << LogIO::POST ; … … 226 226 } 227 227 228 uInt GenericEdgeDetector::_labeling( Matrix<uInt> &a)228 uInt GenericEdgeDetector::_labeling() 229 229 { 230 230 uInt n = 0 ; 231 231 for ( uInt ix = 0 ; ix < nx_ ; ix++ ) { 232 Vector<uInt> v( a .row( ix ) ) ;232 Vector<uInt> v( apix_.row( ix ) ) ; 233 233 uInt nx = __labeling( v ) ; 234 234 n += nx ; 235 235 } 236 236 for ( uInt iy = 0 ; iy < ny_ ; iy++ ) { 237 Vector<uInt> v( a .column( iy ) ) ;237 Vector<uInt> v( apix_.column( iy ) ) ; 238 238 uInt ny = __labeling( v ) ; 239 239 n += ny ; … … 290 290 if ( !elongated_ ) { 291 291 while ( n < nTrim && niter < maxiter ) { 292 uInt m = _trimming( apix_) ;292 uInt m = _trimming() ; 293 293 os_ << LogIO::DEBUGGING 294 294 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; … … 300 300 os_ << "1D triming along x-axis" << LogIO::POST ; 301 301 while ( n < nTrim && niter < maxiter ) { 302 uInt m = _trimming1DX( apix_) ;302 uInt m = _trimming1DX() ; 303 303 os_ << LogIO::DEBUGGING 304 304 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; … … 310 310 os_ << "1D triming along y-axis" << LogIO::POST ; 311 311 while ( n < nTrim && niter < maxiter ) { 312 uInt m = _trimming1DY( apix_) ;312 uInt m = _trimming1DY() ; 313 313 os_ << LogIO::DEBUGGING 314 314 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; … … 326 326 } 327 327 328 uInt GenericEdgeDetector::_trimming( Matrix<uInt> &a ) 329 { 330 uInt n = 0 ; 331 const uInt nx = a.nrow() ; 332 const uInt ny = a.ncolumn() ; 333 Block<uInt> flatIdxList( a.nelements() ) ; 328 uInt GenericEdgeDetector::_trimming() 329 { 330 uInt n = 0 ; 331 Block<uInt> flatIdxList( apix_.nelements() ) ; 334 332 uInt start ; 335 333 uInt end ; 336 334 uInt flatIdx ; 337 for ( uInt ix = 0 ; ix < nx ; ix++ ) {338 Vector<uInt> v( a .row( ix ) ) ;335 for ( uInt ix = 0 ; ix < nx_ ; ix++ ) { 336 Vector<uInt> v( apix_.row( ix ) ) ; 339 337 if ( allEQ( v, (uInt)0 ) ) { 340 338 continue ; 341 339 } 342 340 _search( start, end, v ) ; 343 uInt offset = start * nx ;341 uInt offset = start * nx_ ; 344 342 flatIdx = offset + ix ; 345 343 flatIdxList[n++] = flatIdx ; 346 344 if ( start != end ) { 347 offset = end * nx ;345 offset = end * nx_ ; 348 346 flatIdx = offset + ix ; 349 347 flatIdxList[n++] = flatIdx ; 350 348 } 351 349 } 352 for ( uInt iy = 0 ; iy < ny ; iy++ ) {353 Vector<uInt> v( a .column( iy ) ) ;350 for ( uInt iy = 0 ; iy < ny_ ; iy++ ) { 351 Vector<uInt> v( apix_.column( iy ) ) ; 354 352 if ( allEQ( v, (uInt)0 ) ) { 355 353 continue ; 356 354 } 357 uInt offset = iy * nx ;355 uInt offset = iy * nx_ ; 358 356 _search( start, end, v ) ; 359 357 flatIdx = offset + start ; … … 368 366 Sort::Ascending, 369 367 Sort::QuickSort | Sort::NoDuplicates ) ; 370 Vector<uInt> v( IPosition(1, nx*ny), a.data(), SHARE ) ;368 Vector<uInt> v( IPosition(1,apix_.nelements()), apix_.data(), SHARE ) ; 371 369 const uInt *idx_p = flatIdxList.storage() ; 372 370 for ( uInt i = 0 ; i < n ; i++ ) { … … 378 376 } 379 377 380 uInt GenericEdgeDetector::_trimming1DX( Matrix<uInt> &a)381 { 382 uInt n = 0 ; 383 const uInt nx = a .nrow() ;378 uInt GenericEdgeDetector::_trimming1DX() 379 { 380 uInt n = 0 ; 381 const uInt nx = apix_.nrow() ; 384 382 Vector<uInt> v1, v2 ; 385 383 uInt ix, jx ; 386 for ( ix = 0 ; ix < nx ; ix++ ) {387 v1.reference( a .row( ix ) ) ;384 for ( ix = 0 ; ix < nx_ ; ix++ ) { 385 v1.reference( apix_.row( ix ) ) ; 388 386 if ( anyNE( v1, n ) ) break ; 389 387 } 390 388 for ( jx = nx-1 ; jx > ix ; jx-- ) { 391 v2.reference( a .row( jx ) ) ;389 v2.reference( apix_.row( jx ) ) ; 392 390 if ( anyNE( v2, n ) ) break ; 393 391 } … … 399 397 } 400 398 401 uInt GenericEdgeDetector::_trimming1DY( Matrix<uInt> &a)402 { 403 uInt n = 0 ; 404 const uInt ny = a .ncolumn() ;399 uInt GenericEdgeDetector::_trimming1DY() 400 { 401 uInt n = 0 ; 402 const uInt ny = apix_.ncolumn() ; 405 403 Vector<uInt> v1, v2 ; 406 404 uInt iy, jy ; 407 for ( iy = 0 ; iy < ny ; iy++ ) {408 v1.reference( a .column( iy ) ) ;405 for ( iy = 0 ; iy < ny_ ; iy++ ) { 406 v1.reference( apix_.column( iy ) ) ; 409 407 if ( anyNE( v1, n ) ) break ; 410 408 } 411 409 for ( jy = ny-1 ; jy > iy ; jy-- ) { 412 v2.reference( a .column( jy ) ) ;410 v2.reference( apix_.column( jy ) ) ; 413 411 if ( anyNE( v2, n ) ) break ; 414 412 } … … 462 460 return ; 463 461 464 Vector<uInt> diff( len-1 ) ;462 Block<uInt> diff( len-1 ) ; 465 463 for ( uInt i = 0 ; i < len-1 ; i++ ) { 466 464 diff[i] = off_[i+1] - off_[i] ; -
trunk/src/GenericEdgeDetector.h
r2613 r2617 43 43 // internal methods 44 44 void setup() ; 45 casa::uInt _labeling( casa::Matrix<casa::uInt> &a) ;45 casa::uInt _labeling() ; 46 46 casa::uInt __labeling( casa::Vector<casa::uInt> &a ) ; 47 casa::uInt _trimming( casa::Matrix<casa::uInt> &a) ;48 casa::uInt _trimming1DX( casa::Matrix<casa::uInt> &a) ;49 casa::uInt _trimming1DY( casa::Matrix<casa::uInt> &a) ;47 casa::uInt _trimming() ; 48 casa::uInt _trimming1DX() ; 49 casa::uInt _trimming1DY() ; 50 50 casa::uInt _trimming1D( casa::Vector<casa::uInt> &a ) ; 51 51 void _search( casa::uInt &start,
Note:
See TracChangeset
for help on using the changeset viewer.