diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-22 16:55:13 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-22 16:55:13 (GMT) |
commit | ece3115e81fa8cbf2bbd5c2b92510e5b5759a1b2 (patch) | |
tree | 52ba69b593878036ac97065325fcc7afa19d2365 /tksao | |
parent | 15a560029b86a2c6022ad27896111573011d3891 (diff) | |
download | blt-ece3115e81fa8cbf2bbd5c2b92510e5b5759a1b2.zip blt-ece3115e81fa8cbf2bbd5c2b92510e5b5759a1b2.tar.gz blt-ece3115e81fa8cbf2bbd5c2b92510e5b5759a1b2.tar.bz2 |
simplify wcs code
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/basecommand.C | 13 | ||||
-rw-r--r-- | tksao/frame/fitsimage.C | 34 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 5 | ||||
-rw-r--r-- | tksao/frame/frblt.C | 3 |
4 files changed, 8 insertions, 47 deletions
diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index 4871fba..87c513b 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -562,7 +562,7 @@ void Base::crop3dCmd(double z0, double z1, Coord::CoordSystem sys, return; // center in IMAGE - Vector3d cc = Vector3d(ptr->getWCSCRPIX(sys),1) * Translate3d(-.5,-.5,-.5); + Vector3d cc = Vector3d(ptr->center(),1) * Translate3d(-.5,-.5,-.5); Vector3d wcc = ptr->mapFromRef(cc,sys,sky); Vector3d min = ptr->mapToRef(Vector3d(wcc[0],wcc[1],z0),sys,sky); Vector3d max = ptr->mapToRef(Vector3d(wcc[0],wcc[1],z1),sys,sky); @@ -1419,11 +1419,10 @@ void Base::getCrop3dCmd(Coord::CoordSystem sys, Coord::SkyFrame sky) currentContext->getDataParams(currentContext->secMode()); // need to move from edge to center of pixel - Vector3d rmin = - Vector3d(ptr->getWCSCRPIX(sys),zparams->zmin) * Translate3d(.5,.5,.5); + Vector3d rmin = Vector3d(ptr->center(),zparams->zmin) * Translate3d(.5,.5,.5); // need to move from edge to center of pixel Vector3d rmax = - Vector3d(ptr->getWCSCRPIX(sys),zparams->zmax) * Translate3d(-.5,-.5,-.5); + Vector3d(ptr->center(),zparams->zmax) * Translate3d(-.5,-.5,-.5); Vector3d min = ptr->mapFromRef(rmin,sys,sky); Vector3d max = ptr->mapFromRef(rmax,sys,sky); @@ -1778,7 +1777,7 @@ void Base::getFitsSliceFromImageCmd(int ss, Coord::CoordSystem sys, { if (currentContext->cfits) { FitsImage* ptr = currentContext->fits; - Vector3d dd = Vector3d(ptr->getWCSCRPIX(sys),ss) * Translate3d(-.5,-.5,-.5); + Vector3d dd = Vector3d(ptr->center(),ss) * Translate3d(-.5,-.5,-.5); Vector3d out = ptr->mapFromRef(dd,sys,sky); printDouble(out[2]); } @@ -1791,7 +1790,7 @@ void Base::getFitsSliceToImageCmd(double dd, Coord::CoordSystem sys, { if (currentContext->cfits) { FitsImage* ptr = currentContext->fits; - Vector3d cc = Vector3d(ptr->getWCSCRPIX(sys),1) * Translate3d(-.5,-.5,-.5); + Vector3d cc = Vector3d(ptr->center(),1) * Translate3d(-.5,-.5,-.5); Vector3d wcc = ptr->mapFromRef(cc,sys,sky); Vector3d oo = ptr->mapToRef(Vector3d(wcc[0],wcc[1],dd),sys,sky); Vector3d out = oo * Translate3d(.5,.5,.5); @@ -2866,7 +2865,7 @@ void Base::sliceCmd(double dd, Coord::CoordSystem sys, Coord::SkyFrame sky) return; FitsImage* ptr = currentContext->fits; - Vector3d cc = Vector3d(ptr->getWCSCRPIX(sys),1) * Translate3d(-.5,-.5,-.5); + Vector3d cc = Vector3d(ptr->center(),1) * Translate3d(-.5,-.5,-.5); Vector3d wcc = ptr->mapFromRef(cc,sys,sky); Vector3d oo = ptr->mapToRef(Vector3d(wcc[0],wcc[1],dd),sys,sky); Vector3d out = oo * Translate3d(.5,.5,.5); diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index bf4c8ba..0b12fb4 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -89,7 +89,6 @@ FitsImage::FitsImage(Context* cx, Tcl_Interp* pp) wcsCel_ =NULL; wcsCelLon_ =NULL; wcsCelLat_ =NULL; - wcsCRPIX_ =NULL; wcsSize_ =NULL; wcsHPX_ =0; @@ -169,8 +168,6 @@ FitsImage::~FitsImage() if (wcsCelLat_) delete [] wcsCelLat_; - if (wcsCRPIX_) - delete [] wcsCRPIX_; if (wcsSize_) delete [] wcsSize_; @@ -1068,9 +1065,6 @@ void FitsImage::initWCS(FitsHead* hd) delete [] wcsCelLat_; wcsCelLat_ =NULL; - if (wcsCRPIX_) - delete [] wcsCRPIX_; - wcsCRPIX_ =NULL; if (wcsSize_) delete [] wcsSize_; wcsSize_ =NULL; @@ -1098,7 +1092,6 @@ void FitsImage::initWCS(FitsHead* hd) wcsCel_ = ptr->wcsCel_; wcsCelLon_ = ptr->wcsCelLon_; wcsCelLat_ = ptr->wcsCelLat_; - wcsCRPIX_ = ptr->wcsCRPIX_; wcsSize_ = ptr->wcsSize_; wcsHPX_ = ptr->wcsHPX_; @@ -1136,7 +1129,6 @@ void FitsImage::initWCS(FitsHead* hd) wcsInit(hasWCSAST); wcsCelInit(hasWCSAST); - wcsCRPIXInit(hd); wcsHPXInit(); // init wcsState @@ -2591,14 +2583,6 @@ void FitsImage::updatePS(Matrix3d ps) // WCS -Vector FitsImage::getWCSCRPIX(Coord::CoordSystem sys) -{ - if (!wcsCRPIX_ || sys<Coord::WCS) - return Vector(); - else - return wcsCRPIX_[sys-Coord::WCS]; -} - double FitsImage::getWCSSize(Coord::CoordSystem sys) { if (!wcsSize_ || sys<Coord::WCS) @@ -3103,24 +3087,6 @@ void FitsImage::wcsHPXInit() } } -void FitsImage::wcsCRPIXInit(FitsHead* hd) -{ - // init wcsCel_ array - if (wcsCRPIX_) - delete [] wcsCRPIX_; - - wcsCRPIX_ = new Vector[MULTWCS]; - - Vector cc = center(); - char crpix1[] = "CRPIX1 "; - char crpix2[] = "CRPIX2 "; - for (int ii=0; ii<MULTWCS; ii++) { - crpix1[6] = !ii ? ' ' : ii+'@'; - crpix2[6] = !ii ? ' ' : ii+'@'; - wcsCRPIX_[ii] = Vector(hd->getReal(crpix1,cc[0]),hd->getReal(crpix2,cc[1])); - } -} - void FitsImage::wcsSizeInit() { // init wcsSize_ array diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index 7bd7b7d..c166bf2 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -115,7 +115,6 @@ class FitsImage { int* wcsCel_; int* wcsCelLon_; int* wcsCelLat_; - Vector* wcsCRPIX_; double* wcsSize_; WCSState* wcsState_; @@ -151,7 +150,6 @@ class FitsImage { void wcsInit(int); void wcsCelInit(int); - void wcsCRPIXInit(FitsHead*); void wcsHPXInit(); void wcsSizeInit(); void wcsPhyInit(); @@ -407,8 +405,7 @@ class FitsImage { const char* getWCSAxisSymbol(Coord::CoordSystem, int); double getWCSSize(Coord::CoordSystem); - Vector getWCSCRPIX(Coord::CoordSystem); - double calcWCSSize(Coord::CoordSystem); + double calcWCSSize(Coord::CoordSystem); int hasWCS(Coord::CoordSystem); int hasWCSCel(Coord::CoordSystem); diff --git a/tksao/frame/frblt.C b/tksao/frame/frblt.C index 6a6c2c8..17361f4 100644 --- a/tksao/frame/frblt.C +++ b/tksao/frame/frblt.C @@ -284,8 +284,7 @@ int Base::markerAnalysisPlot3d(Marker* pp, double** x, double** y, SETSIGBUS for (int kk=0; kk<srcd; kk++) { double ss = kk+.5+.5+zparams->zmin; - Vector3d dd = Vector3d(ptr->getWCSCRPIX(sys),ss) * - Translate3d(-.5,-.5,-.5); + Vector3d dd = Vector3d(ptr->center(),ss) * Translate3d(-.5,-.5,-.5); Vector3d out = ptr->mapFromRef(dd,sys,sky); (*x)[kk] = out[2]; |