diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-23 20:08:44 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-23 20:08:44 (GMT) |
commit | 31a570efb6179e84e2f79cc0ed838865e15c31ec (patch) | |
tree | 82a7c8bd4c6607f69a8173135ff907e5a857ba16 | |
parent | eaa8d67d7fdc69e5e2f761285b6639f9393fa6fd (diff) | |
download | blt-31a570efb6179e84e2f79cc0ed838865e15c31ec.zip blt-31a570efb6179e84e2f79cc0ed838865e15c31ec.tar.gz blt-31a570efb6179e84e2f79cc0ed838865e15c31ec.tar.bz2 |
region plot2d now extends across mosaic boundries
-rw-r--r-- | ds9/doc/release/r8.0.html | 1 | ||||
-rw-r--r-- | tksao/frame/frblt.C | 78 |
2 files changed, 42 insertions, 37 deletions
diff --git a/ds9/doc/release/r8.0.html b/ds9/doc/release/r8.0.html index cb38e28..23e2ace 100644 --- a/ds9/doc/release/r8.0.html +++ b/ds9/doc/release/r8.0.html @@ -34,6 +34,7 @@ <li><tt>08.22.2018 WCS: reimplemented all wcs support based on AST.</tt></li> <li><tt>08.22.2018 CUBE: plot3d current slice is coordinated with cube dialog box.</tt></li> <li><tt>08.22.2018 BIN: fixed a problem in the case of a RGB image has a binned layer, changing bin parameters in other layers caused cursor movement.</tt></li> + <li><tt>08.22.2018 REGION: plot2d now extends across mosaic boundries.</tt></li> <li><tt><b>09.03.2018 RELEASE version 8.0rc</b></tt></li> </ol> </ol> diff --git a/tksao/frame/frblt.C b/tksao/frame/frblt.C index 17361f4..2e99d5e 100644 --- a/tksao/frame/frblt.C +++ b/tksao/frame/frblt.C @@ -116,17 +116,10 @@ int Base::markerAnalysisPlot2d(Marker* pp, double** x, double** y, Coord::CoordSystem sys, Coord::SkyFrame sky, Marker::AnalysisMethod method) { - // does not extend across mosaic boundries - // uses currentContext - FitsImage* ptr = isInCFits(pp->getCenter(),Coord::REF,NULL); - if (!ptr) - ptr = currentContext->cfits; - - FitsBound* params = ptr->getDataParams(currentContext->secMode()); - - Vector vv = p2-p1; + Vector vv = p2-p1; int num = vv.length() +1; - Vector s = vv.normalize(); + Vector ss = vv.normalize(); + Vector uu = Vector(-ss[1],ss[0]); int cnt[num]; *x = (double*)malloc(num*sizeof(double)); @@ -134,52 +127,65 @@ int Base::markerAnalysisPlot2d(Marker* pp, double** x, double** y, *xc = (double*)malloc(num*sizeof(double)); *yc = (double*)malloc(num*sizeof(double)); + int mosaic = isMosaic(); + FitsImage* sptr = currentContext->cfits; + FitsBound* params = sptr->getDataParams(currentContext->secMode()); + + if (width==0) + width =1; + // main loop SETSIGBUS - for (long ii=0; ii<num; ii++) { - Vector t = p1 + s*ii; + for (int ii=0; ii<num; ii++) { + int found=0; (*x)[ii] = ii+1; (*y)[ii] = 0; + (*xc)[ii] = ii+1; + (*yc)[ii] = 0; cnt[ii] = 0; - Vector tv = ptr->mapFromRef(t, sys, sky); - (*xc)[ii] = tv[0]; - (*yc)[ii] = tv[1]; + for (int jj=0; jj<width; jj++) { + Vector tt = p1 + ss*ii + uu*jj; - Vector z = t * ptr->refToData; - - if (z[0]>=params->xmin && z[0]<params->xmax && - z[1]>=params->ymin && z[1]<params->ymax) { - - // check for nan - double v = ptr->getValueDouble(z); - if (isfinite(v)) { - (*y)[ii] = v; - cnt[ii] = 1; + if (mosaic) { + sptr = currentContext->cfits; + params = sptr->getDataParams(currentContext->secMode()); } - Vector ss = Vector(-s[1],s[0]); - - for (long jj=1; jj<width; jj++) { - Vector tt = p1 + s*ii + ss*jj; - - Vector zz = tt * ptr->refToData; - + do { + Vector zz = tt * sptr->refToData; if (zz[0]>=params->xmin && zz[0]<params->xmax && zz[1]>=params->ymin && zz[1]<params->ymax) { - double vvalue = ptr->getValueDouble(zz); + if (!found) { + Vector tv = sptr->mapFromRef(tt, sys, sky); + (*xc)[ii] = tv[0]; + (*yc)[ii] = tv[1]; + found =1; + } + // check for nan - if (isfinite(vvalue)) { - (*y)[ii] += vvalue; + double dd = sptr->getValueDouble(zz); + if (isfinite(dd)) { + (*y)[ii] += dd; cnt[ii]++; } + break; + } + else { + if (mosaic) { + sptr = sptr->nextMosaic(); + if (sptr) + params = sptr->getDataParams(currentContext->secMode()); + } } } + while (mosaic && sptr); } } + CLEARSIGBUS // average if needed if (method == Marker::AVERAGE) @@ -187,8 +193,6 @@ int Base::markerAnalysisPlot2d(Marker* pp, double** x, double** y, if (isfinite((*y)[ii]) && cnt[ii]!=0) (*y)[ii] /= cnt[ii]; - CLEARSIGBUS - return num; } |