Skip to content

Commit

Permalink
Firefly-1311: Merge PR #1429 from FIREFLY-1311-hips-smoothing
Browse files Browse the repository at this point in the history
Firefly-1311: fixed: hips tile should not be smoothed at highest resolution
  • Loading branch information
robyww authored Sep 14, 2023
2 parents b717be6 + 1cf8d14 commit c5992fe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
6 changes: 6 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [Notes on next version](next-release-details.md)

## Version 2023.2
- 2023.2.1 - (Sept 14, 2023)
- docker tag: `latest`, `2023.2`, `2023.2.1`
- 2023.2.0 - (Aug 25, 2023)
- docker tag: `2023.2.0`

Expand Down Expand Up @@ -36,6 +38,10 @@
- [All Bug Fixes](https://github.com/caltech-ipac/firefly/pulls?q=is%3apr+milestone%3a2023.2+label%3abug)
- [All PRs](https://github.com/caltech-ipac/firefly/pulls?q=is%3apr++milestone%3a2023.2+)

##### _Patches 2023.2_
- 2023.2.1
- Fixed: HiPS tile pixels should not be smoothed at highest resolution: [Firefly-1311](https://github.com/Caltech-IPAC/firefly/pull/1429)
- Small bug fixes related to SHA Release [PR](https://github.com/Caltech-IPAC/firefly/pull/1425), [PR](https://github.com/Caltech-IPAC/firefly/pull/1425)

## Version 2023.1
- 2023.1.5 - (June 15, 2023)
Expand Down
4 changes: 2 additions & 2 deletions src/firefly/js/visualize/HiPSUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ export function getHiPSNorderlevel(plot, limitToImageDepth= false) {
if (screenPixArcsecSize> 100) return {useAllSky:true, norder:3};

let norder= getNOrderForPixArcSecSize(screenPixArcsecSize);
let maxOrder= Number(plot.hipsProperties?.hips_order);

if (limitToImageDepth) {
let maxOrder= Number(plot.hipsProperties?.hips_order);
if (!maxOrder) {
const hipsPixelScale= Number(plot.hipsProperties?.hips_pixel_scale);
maxOrder= hipsPixelScale ? getNOrderForPixArcSecSize(hipsPixelScale*3600) : 3;
}
norder= Math.min(norder, maxOrder);
}
return {norder, useAllSky:false};
return {norder, useAllSky:false, isMaxOrder:norder===maxOrder};

}

Expand Down
5 changes: 4 additions & 1 deletion src/firefly/js/visualize/iv/HiPSRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ const colorId = (plot) => plot?.colorTableId ?? -1;
* @param isBaseImage
* @param screenRenderEnabled
* @param hipsColorOps
* @param {boolean} isMaxOrder - true if the order drawing is max order
* @return {{drawTile(*=, *=): undefined, drawTileImmediate(*=, *, *=): void, abort(): void}}
*/
export function makeHipsRenderer(screenRenderParams, totalCnt, isBaseImage, screenRenderEnabled, hipsColorOps) {
export function makeHipsRenderer(screenRenderParams, totalCnt, isBaseImage, screenRenderEnabled,
hipsColorOps, isMaxOrder) {

let renderedCnt=0;
let abortRender= false;
let firstRenderTime= 0;
let renderComplete= false;
const {offscreenCanvas, plotView}= screenRenderParams;
const offscreenCtx = offscreenCanvas.getContext('2d');
offscreenCtx.imageSmoothingEnabled = !isMaxOrder;
const allImageCancelFuncs= [];
let plotTaskId;

Expand Down
18 changes: 10 additions & 8 deletions src/firefly/js/visualize/iv/HiPSTileDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function createHiPSDrawer(targetCanvas, GPU) {
const {viewDim}= plotView;
let transitionNorder;

const {norder, useAllSky}= getHiPSNorderlevel(plot, true);
const {norder, useAllSky, isMaxOrder}= getHiPSNorderlevel(plot, true);
const {fov,centerWp}= getPointMaxSide(plot,viewDim);
if (!centerWp) return;
const tilesToLoad= findCellOnScreen(plot,viewDim,norder, fov, centerWp);
Expand Down Expand Up @@ -79,12 +79,12 @@ export function createHiPSDrawer(targetCanvas, GPU) {

if (drawTiming!==DrawTiming.IMMEDIATE) {
drawTransitionalImage(fov,centerWp,targetCanvas,plot, plotView,norder, transitionNorder, hipsColorOps,
opacity, tilesToLoad);
opacity, tilesToLoad, true, isMaxOrder);
}

const offscreenCanvas = makeOffScreenCanvas(plotView,plot,drawTiming!==DrawTiming.IMMEDIATE);
abortLastDraw= drawDisplay(targetCanvas, offscreenCanvas, plot, plotView, norder, hipsColorOps,
tilesToLoad, useAllSky, opacity, drawTiming);
tilesToLoad, useAllSky, opacity, drawTiming, true, isMaxOrder);
lastDrawNorder= norder;
lastFov= fov;
};
Expand Down Expand Up @@ -116,9 +116,9 @@ function drawTransitionalImage(fov, centerWp, targetCanvas, plot, plotView,
const tilesToLoad3= findCellOnScreen(plot,viewDim,3, fov, centerWp);
const offscreenCanvas = makeOffScreenCanvas(plotView,plot,false);
drawDisplay(targetCanvas, offscreenCanvas, plot, plotView, 2, hipsColorOps, tilesToLoad2, true,
opacity, DrawTiming.IMMEDIATE, false);
opacity, DrawTiming.IMMEDIATE, false, false);
drawDisplay(targetCanvas, offscreenCanvas, plot, plotView, 3, hipsColorOps, tilesToLoad3, false,
opacity, DrawTiming.IMMEDIATE);
opacity, DrawTiming.IMMEDIATE, true, false);
}
else {
let lookMore= true;
Expand All @@ -129,7 +129,7 @@ function drawTransitionalImage(fov, centerWp, targetCanvas, plot, plotView,
const hasSomeTiles= tilesToLoad.some( (tile)=> findTileCachedImage(createImageUrl(plot,tile),colorTableId,bias,contrast));
if (hasSomeTiles || testNorder===3) { // if there are tiles or we need to do the allsky
drawDisplay(targetCanvas, offscreenCanvas, plot, plotView, testNorder, hipsColorOps, tilesToLoad, testNorder===3,
opacity, DrawTiming.IMMEDIATE, false);
opacity, DrawTiming.IMMEDIATE, false, false);
lookMore= false;
}
}
Expand Down Expand Up @@ -157,17 +157,19 @@ const fovEqual= (fov1,fov2) => Math.trunc(fov1*10000) === Math.trunc(fov2*10000)
* @param opacity
* @param drawTiming
* @param screenRenderEnabled
* @param {boolean} [isMaxOrder] true if this norder is the max order
*/
function drawDisplay(targetCanvas, offscreenCanvas, plot, plotView, norder, hipsColorOps, tilesToLoad, useAllSky, opacity,
drawTiming= DrawTiming.ASYNC, screenRenderEnabled= true) {
drawTiming= DrawTiming.ASYNC, screenRenderEnabled= true, isMaxOrder=false) {
if (!targetCanvas) return noOp;
const {viewDim}= plotView;
const boundingBox= computeBounding(primePlot(plotView),viewDim.width,viewDim.height);// should use main plot not overlay plot
const offsetX= boundingBox.x>0 ? boundingBox.x : 0;
const offsetY= boundingBox.y>0 ? boundingBox.y : 0;

const screenRenderParams= {plotView, plot, targetCanvas, offscreenCanvas, opacity, offsetX, offsetY};
const drawer= makeHipsRenderer(screenRenderParams, tilesToLoad.length, !plot.asOverlay, screenRenderEnabled, hipsColorOps);
const drawer= makeHipsRenderer(screenRenderParams, tilesToLoad.length, !plot.asOverlay,
screenRenderEnabled, hipsColorOps, isMaxOrder);

if (plot.blank) {
drawer.renderToScreen();
Expand Down

0 comments on commit c5992fe

Please sign in to comment.