Changeset 2639
- Timestamp:
- 08/09/12 16:09:09 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/GenericEdgeDetector.cpp
r2637 r2639 17 17 #include <casa/Arrays/ArrayIO.h> 18 18 #include <casa/Utilities/GenSort.h> 19 20 #include <coordinates/Coordinates/DirectionCoordinate.h> 19 21 20 22 #include "GenericEdgeDetector.h" … … 99 101 100 102 setup() ; 103 // using DirectionCoordinate 104 Matrix<Double> xform(2,2) ; 105 xform = 0.0 ; 106 xform.diagonal() = 1.0 ; 107 DirectionCoordinate coord( MDirection::J2000, 108 Projection( Projection::SIN ), 109 cenx_, ceny_, 110 dx_, dy_, 111 xform, 112 0.5*Double(nx_-1), 113 0.5*Double(ny_-1) ) ; 101 114 Double *pdir_p = new Double[dir_.nelements()] ; 102 115 pdir_.takeStorage( dir_.shape(), pdir_p, TAKE_OVER ) ; 103 116 uInt len = time_.nelements() ; 104 117 Bool b ; 105 Double * px_p = pdir_p;106 Double * py_p = pdir_p + 1;107 const Double *dir_p = dir_.getStorage( b );108 const Double *x_p = dir_p;109 const Double *y_p = dir_p + 1;118 Double *dir_p = dir_.getStorage( b ) ; 119 Double *wdir_p = dir_p ; 120 Vector<Double> world ; 121 Vector<Double> pixel ; 122 IPosition vshape( 1, 2 ) ; 110 123 for ( uInt i = 0 ; i < len ; i++ ) { 111 *px_p = pcenx_ + ( *x_p - cenx_ ) / dx_ ; 112 *py_p = pceny_ + ( *y_p - ceny_ ) / dy_ ; 113 px_p += 2 ; 114 py_p += 2 ; 115 x_p += 2 ; 116 y_p += 2 ; 117 } 118 dir_.freeStorage( dir_p, b ) ; 124 world.takeStorage( vshape, wdir_p, SHARE ) ; 125 pixel.takeStorage( vshape, pdir_p, SHARE ) ; 126 coord.toPixel( pixel, world ) ; 127 pdir_p += 2 ; 128 wdir_p += 2 ; 129 } 130 dir_.putStorage( dir_p, b ) ; 119 131 } 120 132 … … 131 143 cenx_ = 0.5 * ( xmin + xmax ) ; 132 144 ceny_ = 0.5 * ( ymin + ymax ) ; 133 decCorr_ = 1.0 /cos( ceny_ ) ;145 Double decCorr = cos( ceny_ ) ; 134 146 135 147 uInt len = time_.nelements() ; 136 148 Matrix<Double> dd = dir_.copy() ; 137 149 for ( uInt i = len-1 ; i > 0 ; i-- ) { 138 dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * decCorr_ ; 150 //dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * decCorr ; 151 dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * cos( 0.5*(dd(1,i-1)+dd(1,i)) ) ; 139 152 dd(1,i) = dd(1,i) - dd(1,i-1) ; 140 153 } … … 152 165 Double med = median( dr, False, True, True ) ; 153 166 dy_ = med * width_ ; 154 dx_ = dy_ * decCorr_;167 dx_ = dy_ / decCorr ; 155 168 156 169 nx_ = uInt( ceil( wx / dx_ ) ) ; -
trunk/src/GenericEdgeDetector.h
r2632 r2639 62 62 casa::Double dx_ ; 63 63 casa::Double dy_ ; 64 casa::Double decCorr_ ;65 64 66 65 // storage for detection
Note:
See TracChangeset
for help on using the changeset viewer.