Skip to content

Commit 5787b6b

Browse files
MattPritNKatti2011
authored andcommitted
[LIMS-129]Fix: Fix Pilatus 12M resolution in image viewer (#474)
* LIMS-129: Add resolution calculation for Pilatus 12M * LIMS-129: Remove DC model print statement
1 parent ed873b9 commit 5787b6b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

client/src/js/modules/dc/views/imageviewer.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ define(['jquery', 'marionette',
9494
this.onResize = _.debounce(this.onResize, 200)
9595
this.draw = _.debounce(this.draw, 10)
9696
this.readjust = _.debounce(this.readjust, 200)
97-
98-
// console.log(this.model)
9997

10098
this.n = options.n || 1
10199
this.img = new XHRImage()
@@ -718,14 +716,26 @@ define(['jquery', 'marionette',
718716
_xy_to_dist: function(x, y) {
719717
return Math.sqrt(Math.pow(Math.abs(x*this.ps/this.imscale-this.model.get('XBEAM')),2)+Math.pow(Math.abs(y*this.ps/this.imscale-this.model.get('YBEAM')),2))
720718
},
721-
719+
720+
_xy_to_res: function(x, y) {
721+
if (this.model.get('DETECTORMODEL') === "Pilatus 12M") {
722+
x_mm = this.ps * x / this.imscale - this.model.get('XBEAM')
723+
y_mm = this.ps * y / this.imscale - this.model.get('YBEAM')
724+
r_det = 250
725+
theta = Math.acos(r_det * Math.cos(y_mm / r_det) / Math.sqrt(r_det * r_det + x_mm * x_mm))
726+
wavelength = this.model.get('WAVELENGTH')
727+
res = wavelength / (2 * Math.sin(theta / 2))
728+
return res
729+
}
730+
return this._dist_to_res(this._xy_to_dist(x,y))
731+
},
722732

723733
// Set cursor position and resolution
724734
_cursor: function(x, y) {
725735
var posx = (x/this.scalef)-(this.offsetx/this.scalef)
726736
var posy = (y/this.scalef)-(this.offsety/this.scalef)
727737

728-
var res = this._dist_to_res(this._xy_to_dist(posx,posy))
738+
var res = this._xy_to_res(posx, posy)
729739

730740
this.ui.resc.text(res.toFixed(2))
731741
},

0 commit comments

Comments
 (0)