Refactoring #1487

Updated by pospelov over 3 years ago

The idea is that when it comes to importing real data, the most common operation is
to set up region of interest, which will be later simulated.

For the moment it can be done by masking-all and then unmasking, which is non-intuitive.

Region of interest can be used in Core too, as a hint to the simulation to return
intensity histogram already cuted down to region-of-interest.

Within this item:
* Implement ROI in core
* -Implement Implement ROI in mask editor- editor
* -Make Make zoom in/out logic respect presence of ROI (i.e. zoom out shows ROI, and not whole image)- image)

Suggestionns from Marina
pilatus_npx, pilatus_npy = 981, 1043 # detector size in pixels
pilatus_pixel_size = 0.172 # detector pixel size in mm
detector_distance = 3537.0 # sample-detector distance in mm
beam_xpos, beam_ypos = 604.8, 330.2 # beam center in pixels

def create_detector():
Creates and returns GALAXY detector
u0 = beam_xpos*pilatus_pixel_size # in mm
v0 = beam_ypos*pilatus_pixel_size # in mm
detector = RectangularDetector(pilatus_npx, pilatus_npx*pilatus_pixel_size, pilatus_npy, pilatus_npy*pilatus_pixel_size)
detector.setPerpendicularToDirectBeam(detector_distance, u0, v0)
# set the ROI to simulate
# detector.setROI(xmin, ymin, xmax, ymax, units)
# units tell in which units boundaries are given
detector.setROI(-0.2, 0.74, 0.2, 0.85, “QYQZ”)
# or like this:
#detector.setROI(-0.2, 0.74, 0.2, 0.85, IDetector2D.QYQZ)
return detector