diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-08-31 19:48:36 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-08-31 19:48:36 (GMT) |
commit | 6aa5684aa8722a09f7ccbf0025c2cabeca5c51a2 (patch) | |
tree | fcf3c0a882664f1268ba8a35bbd3861823973697 /tksao/frame | |
parent | 42df44fe70135c5af8258a089c18f3377c76db8a (diff) | |
download | blt-6aa5684aa8722a09f7ccbf0025c2cabeca5c51a2.zip blt-6aa5684aa8722a09f7ccbf0025c2cabeca5c51a2.tar.gz blt-6aa5684aa8722a09f7ccbf0025c2cabeca5c51a2.tar.bz2 |
new AST support
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/base.C | 37 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 2 |
2 files changed, 22 insertions, 17 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 7a56b3a..da1f527 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -629,8 +629,7 @@ Matrix Base::calcAlignWCS(FitsImage* fits1, FitsImage* fits2, Vector orpix2 = fits2->wcs2pix(orval2,sys2,sky) * imageToData; - return - Translate(-orpix2) * + return Translate(-orpix2) * flip * Scale(zoom) * Rotate(rotation) * @@ -652,31 +651,39 @@ Matrix Base::calcAlignWCS(FitsImage* fits1, FitsImage* fits2, astClearStatus; // just to make sure astBegin; // start memory management - int s1 = sys1-Coord::WCS; - int s2 = sys2-Coord::WCS; + int ss1 = sys1-Coord::WCS; + int ss2 = sys2-Coord::WCS; Matrix rr; - if ((s1>=0 && fits1->ast_ && fits1->ast_[s1]) && - (s2>=0 && fits2->ast_ && fits2->ast_[s2])) { - AstFrameSet* wcs1 = (AstFrameSet*)astCopy(fits1->ast_[s1]); - AstFrameSet* wcs2 = (AstFrameSet*)astCopy(fits2->ast_[s2]); + if ((ss1>=0 && fits1->ast_ && fits1->ast_[ss1]) && + (ss2>=0 && fits2->ast_ && fits2->ast_[ss2])) { + AstFrameSet* wcs1 = (AstFrameSet*)astCopy(fits1->ast_[ss1]); + AstFrameSet* wcs2 = (AstFrameSet*)astCopy(fits2->ast_[ss2]); astInvert(wcs1); astInvert(wcs2); - AstFrameSet* cvt = (AstFrameSet*)astConvert(wcs1, wcs2, "SKY"); + AstFrameSet* cvt = (AstFrameSet*)astConvert(wcs1, wcs2, ""); if (cvt != AST__NULL) { astInvert(cvt); - Vector ll; Vector cc1 = fits1->center(); - astTran2(fits1->ast_[s1], 1, cc1.v, cc1.v+1, 1, ll.v, ll.v+1); + astTran2(fits1->ast_[ss1], 1, cc1.v, cc1.v+1, 1, ll.v, ll.v+1); Vector ur; Vector cc2 = fits2->center(); - astTran2(fits2->ast_[s2], 1, cc2.v, cc2.v+1, 1, ur.v, ur.v+1); + astTran2(fits2->ast_[ss2], 1, cc2.v, cc2.v+1, 1, ur.v, ur.v+1); double fit[6]; double tol = 1; - if (astLinearApprox(cvt, ll.v, ur.v, tol, fit) != AST__BAD) - if (fit[2] != 0 && fit[5] !=0) - rr = Matrix(fit[2],fit[4],fit[3],fit[5],fit[0],fit[1]); + if (astLinearApprox(cvt, ll.v, ur.v, tol, fit) != AST__BAD) { + // fix the fit from AST + if (fit[2] == 0) { + fit[2] =1; + fit[0] =0; + } + if (fit[5] ==0) { + fit[5] =1; + fit[1] =0; + } + rr = Matrix(fit[2],fit[4],fit[3],fit[5],fit[0],fit[1]); + } } } diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index 61f7bc7..3122f46 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -54,9 +54,7 @@ class WCSx { }; class FitsImage { -#ifdef NEWWCS friend class Base; -#endif protected: Context* context_; // pointer to context |