Skip to content

Commit

Permalink
LIMS-1569: Use old method to get resolution & ice rings if not using …
Browse files Browse the repository at this point in the history
…dials
  • Loading branch information
Mark Williams committed Dec 3, 2024
1 parent 74ed86e commit 750e1e9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
4 changes: 3 additions & 1 deletion api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function setupApplication($mode): Slim
$facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link,
$dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone,
$valid_components, $enabled_container_types, $ifsummary, $synchweb_version, $redirects,
$shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments;
$shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments,
$dials_rest_url;
$app->contentType('application/json');
$options = $app->container['options'];
$app->response()->body(json_encode(array(
Expand All @@ -95,6 +96,7 @@ function setupApplication($mode): Slim
'synchweb_version' => $synchweb_version,
'shipping_service_app_url' => $use_shipping_service_redirect || $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null,
'shipping_service_app_url_incoming' => $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null,
'dials_rest_url' => $dials_rest_url,
'redirects' => $redirects
)));
});
Expand Down
56 changes: 49 additions & 7 deletions client/src/js/modules/dc/views/imageviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ define(['jquery', 'marionette',
'slidechange @ui.zoom': 'slideChangeZoom',
'keypress @ui.num': 'keyPressNum',

'click @ui.res': 'doThreshold',
'click @ui.ice': 'doThreshold',
'click @ui.res': 'doIceOrRes',
'click @ui.ice': 'doIceOrRes',
'click @ui.invert': 'doInvert',
'click @ui.threshold': 'doThreshold',
'click @ui.threshold': 'reloadImage',

'click button[name=next]': 'next',
'click button[name=prev]': 'prev',
Expand Down Expand Up @@ -407,6 +407,11 @@ define(['jquery', 'marionette',
this.ctx.setTransform(this.scalef,0,0,this.scalef,this.offsetx,this.offsety)
var r = this.detectVerticalSquash(this.img)
this.ctx.drawImage(this.img, 0, 0, this.width, this.height/r)

if (!app.options.get("dials_rest_url")) {
if (this.ui.res.is(':checked')) this._draw_res_rings()
if (this.ui.ice.is(':checked')) this._draw_ice_rings()
}
},


Expand Down Expand Up @@ -441,9 +446,9 @@ define(['jquery', 'marionette',
// Apply image adjustments
adjust: function() {
if (this.brightness == 0 && this.contrast == 0 && !(this.invert_change || this.ui.invert.is(':checked'))) return

this.c.revert()
if (this.ui.invert.is(':checked')) {
if (this.invert_change) {
this.c.invert()
//_plot_profiles(lastx, lasty)
}
Expand All @@ -469,7 +474,36 @@ define(['jquery', 'marionette',
this.c.reloadCanvasData()
this.c.resetOriginalPixelData()
},




// Draw ice rings
_draw_ice_rings: function() {
var rings = [3.897, 3.669,3.441,2.671,2.249,2.07,1.95,1.92,1.88,1.72]

this.ctx.strokeStyle='blue';
for (var i = 0; i < rings.length; i++) {
this.ctx.beginPath();
var rad = this._res_to_dist(rings[i])/this.ps*this.imscale
this.ctx.arc(this.model.get('XBEAM')/this.ps*this.imscale,this.model.get('YBEAM')/this.ps*this.imscale,rad,0,2*Math.PI);
this.ctx.stroke();
}
},

// Draw resolution rings
_draw_res_rings: function() {
this.ctx.strokeStyle = 'black';
this.ctx.font = this.imscale < 1 ? '10px Arial' : '30px Arial';

for (var i = 0; i < 5; i++) {
var rad = (((this.height-10)/2)/5)*(i+1)
this.ctx.beginPath();
this.ctx.arc(this.model.get('XBEAM')/this.ps*this.imscale,this.model.get('YBEAM')/this.ps*this.imscale,rad,0,2*Math.PI);
this.ctx.stroke();
this.ctx.fillText(this._dist_to_res(rad*this.ps/this.imscale).toFixed(2) + 'A',this.model.get('XBEAM')/this.ps*this.imscale-(this.low ? 10 : 40 ),this.model.get('YBEAM')/this.ps*this.imscale-rad+(this.low ? 10 : 40));
}
},


// Plot spot profile
_plot_profiles: function(xp, yp) {
Expand Down Expand Up @@ -760,7 +794,15 @@ define(['jquery', 'marionette',
this._dra()
},

doThreshold: function() {
doIceOrRes: function() {
if (app.options.get("dials_rest_url")) {
this.reloadImage()
} else {
this._dra()
}
},

reloadImage: function() {
this.load(this.n)
}

Expand Down

0 comments on commit 750e1e9

Please sign in to comment.