Skip to content

Commit

Permalink
fix bugs in imexam plugins using a rotated line to defined the image …
Browse files Browse the repository at this point in the history
…section
  • Loading branch information
ericmandel committed May 16, 2019
1 parent da021d6 commit a18c2ed
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 33 deletions.
9 changes: 6 additions & 3 deletions js9-allinone.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ JS9.globalOpts = {
reduceMosaic: "js9", // "js9" or "shrink" ("js9" seems to be faster)
reduceRegcnts: true, // reduce image when doing counts in regions?
plot3d: {cube:"*:*:all", mode:"avg", areaunits:"pixels", color: "green"}, // plot3d options: avg/sum, pixels/arcsecs
imexamLineHeight: 1, // "height" of line region section
copyWcsPosFormat: "$ra $dec $sys", // format for copy wcs pos to clipboard
floatPrecision: 6, // precision for floatToString()
mouseActions: ["display value/position", "change contrast/bias", "pan the image"],// 0,1,2 mousepress
Expand Down
2 changes: 1 addition & 1 deletion js9.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions js9plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -12502,7 +12502,10 @@ function reg2section(xreg) {
(xreg.pts[0].x - xreg.pts[1].x)) +
((xreg.pts[0].y - xreg.pts[1].y) *
(xreg.pts[0].y - xreg.pts[1].y)));
xreg.height = 1;
xreg.height = JS9.globalOpts.imexamLineHeight || 1;
xreg.angle = Math.atan2(xreg.pts[1].y - xreg.pts[0].y,
xreg.pts[1].x - xreg.pts[0].x);
xreg.angle = xreg.angle * 180 / Math.PI;
} else {
xreg.width = maxx - minx;
xreg.height = maxy - miny;
Expand All @@ -12527,7 +12530,7 @@ exports.getRegionData = function (im, xreg) {
var imag;

if ( xreg.angle && xreg.angle !== 0 ) {
imag = ndops.zeros([xreg.width, xreg.height]);
imag = ndops.zeros([xreg.height, xreg.width]);

ndops.rotate(imag, im_2d, xreg.angle/57.29577951, xreg.y, xreg.x);
} else {
Expand Down
47 changes: 22 additions & 25 deletions plugins/imexam/imexam.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
<div class="helpLogo"><img src="../../images/js9logo.png" alt="js9"></div>
<div class="helpContainer">

<p>
<a name="rgstat"></a>
<h3>Region Statistics </h3>
<h3>JS9 Imexam Plugins</h3>

A rectangular box of image pixels is selected and some statistical values
are computed from the data. The selected box may be rotated for box and
ellipse regions.
These tasks perform various types of image analysis using a rectangular box
surrounding the selected region. That is, the actual region shape is ignored
and the analysis reflects a rectangular section of image pixels. The selected
section can be rotated for box, ellipse, and line regions. For a line region,
the width is the length of the line, while the height is set to the value of
the JS9.globalOpts.imexamLineHeight parameter (default is 1).

<p>
<b>N.B.:</b> Currently the region shape is ignored and the values reflect a rectangular section of image pixels.
<p>
<a name="rgstat"></a>
<h3>Region Statistics</h3>

A rectangular box of image pixels is selected and some statistical
values are computed from the data.

<blockquote>
<h4>Notes</h4>
Expand Down Expand Up @@ -54,21 +58,18 @@ <h4>Notes</h4>
<a name="xyproj"></a>
<h3>X and Y Projection Plot</h3>

A rectangular box of image pixels is selected and the projection along the
region's X or Y axis is plotted. The sum, average or median of the projected
pixels may be selected. The selected box may be rotated for box and ellipse
regions.

A rectangular box of image pixels is selected and the projection along
the region's X (width) or Y (height) axis is plotted. The sum,
average, or median of the projected pixels may be selected.

<p>
<a name="r_proj"></a>
<h3>Radial Profile</h3>

A rectangular box of image pixels is selected and the pixels values are
plotted against their respective radii. A Gaussian is fit to the radial profile
data and the result is also plotted. The fitted results of the 4 parameter fit
are displayed with the plot. The selected box may be rotated for box and
ellipse regions.
A rectangular box of image pixels is selected and the pixels values
are plotted against their respective radii. A Gaussian is fit to the
radial profile data and the result is also plotted. The fitted
results of the 4 parameter fit are displayed with the plot.

<p>
The center pixel from which the radii are computed is determined from the
Expand All @@ -80,12 +81,9 @@ <h3>Radial Profile</h3>
<a name="rghist"></a>
<h3>Pixel Value Histogram</h3>

A rectangular box of image pixels is selected and a histogram of the values
is plotted. The selected box may be rotated for box and
ellipse regions.

The selected pixels are binned into 250 bins between the minimum and maximum value
found in the selected region.
A rectangular box of image pixels is selected and a histogram of the
values is plotted. The selected pixels are binned into 250 bins
between the minimum and maximum value found in the selected region.

<p>
<a name="enener"></a>
Expand Down Expand Up @@ -122,7 +120,6 @@ <h3>Encircled Energy</h3>
<h3>3d Surface Plot</h3>

A rectangular box of image pixels is selected and plotted as a surface.
The selected box may be rotated for box and ellipse regions.

</div>
</body>
Expand Down
7 changes: 5 additions & 2 deletions plugins/imexam/imexam.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,10 @@ function reg2section(xreg) {
(xreg.pts[0].x - xreg.pts[1].x)) +
((xreg.pts[0].y - xreg.pts[1].y) *
(xreg.pts[0].y - xreg.pts[1].y)));
xreg.height = 1;
xreg.height = JS9.globalOpts.imexamLineHeight || 1;
xreg.angle = Math.atan2(xreg.pts[1].y - xreg.pts[0].y,
xreg.pts[1].x - xreg.pts[0].x);
xreg.angle = xreg.angle * 180 / Math.PI;
} else {
xreg.width = maxx - minx;
xreg.height = maxy - miny;
Expand All @@ -582,7 +585,7 @@ exports.getRegionData = function (im, xreg) {
var imag;

if ( xreg.angle && xreg.angle !== 0 ) {
imag = ndops.zeros([xreg.width, xreg.height]);
imag = ndops.zeros([xreg.height, xreg.width]);

ndops.rotate(imag, im_2d, xreg.angle/57.29577951, xreg.y, xreg.x);
} else {
Expand Down

0 comments on commit a18c2ed

Please sign in to comment.