summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-11-29 20:39:06 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-11-29 20:39:06 (GMT)
commit71de900004e273c1e4241b6f85c2c430bc9d1343 (patch)
treea49623f5397bfa609be5eb13514700916b014ba1
parent2fae22a3f3d74c05f47cb9349836459589ae5f19 (diff)
downloadblt-71de900004e273c1e4241b6f85c2c430bc9d1343.zip
blt-71de900004e273c1e4241b6f85c2c430bc9d1343.tar.gz
blt-71de900004e273c1e4241b6f85c2c430bc9d1343.tar.bz2
update AST WCS
-rw-r--r--tksao/frame/fitsimage.C55
-rw-r--r--tksao/frame/fitsimage.h32
2 files changed, 44 insertions, 43 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 7d1a3e6..cdb6f80 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -106,9 +106,9 @@ FitsImage::FitsImage(Context* cx, Tcl_Interp* pp)
dataToImage3d = Translate3d( .5, .5, .5);
manageWCS_ =1;
- wcs_ =NULL;
wcsx_ =NULL;
#ifndef NEWWCS
+ wcs_ =NULL;
ast_ =NULL;
#else
newast_ =NULL;
@@ -168,13 +168,6 @@ FitsImage::~FitsImage()
delete analysisdata_;
}
- if (wcs_) {
- for (int ii=0; ii<MULTWCSA; ii++)
- if (manageWCS_ && wcs_[ii])
- wcsfree(wcs_[ii]);
- delete [] wcs_;
- }
-
if (wcsx_) {
for (int ii=0; ii<MULTWCS; ii++)
if (manageWCS_ && wcsx_[ii])
@@ -183,6 +176,13 @@ FitsImage::~FitsImage()
}
#ifndef NEWWCS
+ if (wcs_) {
+ for (int ii=0; ii<MULTWCSA; ii++)
+ if (manageWCS_ && wcs_[ii])
+ wcsfree(wcs_[ii]);
+ delete [] wcs_;
+ }
+
if (ast_) {
for (int ii=0; ii<MULTWCSA; ii++)
if (manageWCS_ && ast_[ii])
@@ -1060,16 +1060,6 @@ void FitsImage::iisSetFileName(const char* fn)
void FitsImage::initWCS()
{
// free up wcs and ast arrays
- if (wcs_) {
- for (int ii=0; ii<MULTWCSA; ii++)
- if (manageWCS_ && wcs_[ii])
- wcsfree(wcs_[ii]);
- delete [] wcs_;
- }
- wcs_ = new WorldCoor*[MULTWCSA];
- for (int ii=0; ii<MULTWCSA; ii++)
- wcs_[ii] = NULL;
-
if (wcsx_) {
for (int ii=0; ii<MULTWCS; ii++)
if (manageWCS_ && wcsx_[ii])
@@ -1081,6 +1071,16 @@ void FitsImage::initWCS()
wcsx_[ii] = NULL;
#ifndef NEWWCS
+ if (wcs_) {
+ for (int ii=0; ii<MULTWCSA; ii++)
+ if (manageWCS_ && wcs_[ii])
+ wcsfree(wcs_[ii]);
+ delete [] wcs_;
+ }
+ wcs_ = new WorldCoor*[MULTWCSA];
+ for (int ii=0; ii<MULTWCSA; ii++)
+ wcs_[ii] = NULL;
+
if (ast_) {
for (int ii=0; ii<MULTWCSA; ii++)
if (manageWCS_ && ast_[ii])
@@ -1107,12 +1107,12 @@ void FitsImage::initWCS()
FitsImage* sptr = ptr->nextSlice();
while (sptr) {
if (sptr == this) {
- for (int ii=0; ii<MULTWCSA; ii++)
- wcs_[ii] = ptr->wcs_[ii];
for (int ii=0; ii<MULTWCS; ii++)
wcsx_[ii] = ptr->wcsx_[ii];
#ifndef NEWWCS
for (int ii=0; ii<MULTWCSA; ii++)
+ wcs_[ii] = ptr->wcs_[ii];
+ for (int ii=0; ii<MULTWCSA; ii++)
ast_[ii] = ptr->ast_[ii];
#else
newast_ = ptr->newast_;
@@ -1142,6 +1142,7 @@ void FitsImage::initWCS()
prim = image_->primary() && image_->inherit() ? image_->primary() : NULL;
}
+#ifndef NEWWCS
// wcsinit is sloooowwww! so try to figure it out first
// look first for default WCS. Let wcsinit figure it out since there can
// be many different non-standard wcs's present
@@ -1184,13 +1185,11 @@ void FitsImage::initWCS()
astinit(ii, hd, prim);
-#ifndef NEWWCS
if (DebugAST)
astShow(ast_[ii]);
-#endif
}
}
-#ifdef NEWWCS
+#else
astinit(hd, prim);
if (DebugAST && newast_)
astShow(newast_);
@@ -1330,6 +1329,7 @@ void FitsImage::initWCS0(const Vector& pix)
prim = image_->primary() && image_->inherit() ? image_->primary() : NULL;
}
+#ifndef NEWWCS
int ii = Coord::WCS0-Coord::WCS;
if (wcs_[ii])
wcsfree(wcs_[ii]);
@@ -1351,15 +1351,14 @@ void FitsImage::initWCS0(const Vector& pix)
if (DebugWCS)
wcsShow(wcs_[ii]);
-#ifndef NEWWCS
if (ast_[ii])
astAnnul(ast_[ii]);
ast_[ii] = NULL;
astinit0(ii, hd, prim);
if (DebugAST)
astShow(ast_[ii]);
-#endif
}
+#endif
}
void FitsImage::load()
@@ -2330,12 +2329,12 @@ void FitsImage::resetWCS()
void FitsImage::resetWCS0()
{
+#ifndef NEWWCS
int ii = Coord::WCS0-Coord::WCS;
if (wcs_[ii])
wcsfree(wcs_[ii]);
wcs_[ii] = NULL;
-#ifndef NEWWCS
if (ast_[ii])
astAnnul(ast_[ii]);
ast_[ii] = NULL;
@@ -3595,6 +3594,7 @@ double FitsImage::wcs2pixx(double in, Coord::CoordSystem sys, int aa)
// WCS/AST support
+#ifndef NEWWCS
void FitsImage::wcsShow(WorldCoor* ww)
{
if (!ww)
@@ -3638,7 +3638,6 @@ void FitsImage::wcsShow(WorldCoor* ww)
cerr << "wcs->distcode=" << ww->distcode << endl;
}
-#ifndef NEWWCS
void FitsImage::astinit(int ss, FitsHead* hd, FitsHead* prim)
{
if (!wcs_[ss]) {
@@ -4279,6 +4278,7 @@ AstFrameSet* FitsImage::fits2ast(FitsHead* hd)
return frameSet;
}
+#ifndef NEWWCS
AstFrameSet* FitsImage::buildast(int ss, FitsHead* hd, FitsHead* prim)
{
if (DebugAST)
@@ -4988,3 +4988,4 @@ void FitsImage::putFitsCard(void* chan, const char* key, double value)
if (DebugAST)
cerr << str.str().c_str() << endl;
}
+#endif
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index 2256dd7..38872f6 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -111,9 +111,9 @@ class FitsImage {
int address[FTY_MAXAXES];
int manageWCS_;
- WorldCoor** wcs_; // wcs list
WCSx** wcsx_; // xth Axis WCS
#ifndef NEWWCS
+ WorldCoor** wcs_; // wcs list
AstFrameSet** ast_; // ast frameset;
#else
AstFrameSet* newast_; // ast frameset;
@@ -123,34 +123,26 @@ class FitsImage {
Matrix wcsToRef_; // iraf/wcs matrix
+ private:
+ char* root(const char*);
+ char* strip(const char*);
+
protected:
void reset();
-
+ Vector getHistCenter();
+ void smooth(pthread_t*, t_smooth_arg*);
void process(const char*, int);
void initCompress();
void initNRRD();
void initENVI();
void initBin();
void initHPX();
+
void initWCS();
#ifndef NEWWCS
void initWCSPhysical();
-#endif
- Vector getHistCenter();
-
- char* root(const char*);
- char* strip(const char*);
-
- void smooth(pthread_t*, t_smooth_arg*);
-
void wcsShow(WorldCoor*);
void astinit(int, FitsHead*, FitsHead*);
-#ifdef NEWWCS
- void astinit(FitsHead*, FitsHead*);
-#endif
- void astinit0(int, FitsHead*, FitsHead*);
- int checkWCS(Vector&);
- AstFrameSet* fits2ast(FitsHead*);
AstFrameSet* buildast(int, FitsHead*, FitsHead*);
AstFrameSet* buildast0(int, FitsHead*, FitsHead*);
void wcs2ast(int, FitsHead*, FitsHead*, void*);
@@ -159,6 +151,12 @@ class FitsImage {
void putFitsCard(void* chan, const char* key, const char* value);
void putFitsCard(void* chan, const char* key, int value);
void putFitsCard(void* chan, const char* key, double value);
+#else
+ void astinit(FitsHead*, FitsHead*);
+#endif
+ void astinit0(int, FitsHead*, FitsHead*);
+ int checkWCS(Vector&);
+ AstFrameSet* fits2ast(FitsHead*);
public:
char* fileName;
@@ -385,8 +383,10 @@ class FitsImage {
void processKeywordsFitsSection();
int processKeywordsIRAF(FitsImage*);
+#ifndef NEWWCS
WorldCoor* getWCS(Coord::CoordSystem sys)
{return (wcs_ && wcs_[sys-Coord::WCS]) ? wcs_[sys-Coord::WCS] : NULL;}
+#endif
const char* getWCSName(Coord::CoordSystem);
Coord::Orientation getWCSOrientation(Coord::CoordSystem, Coord::SkyFrame);
double getWCSRotation(Coord::CoordSystem, Coord::SkyFrame);