2. Target finding by macroMS

macroMS works with newer versions of Chrome and Firefox that are launched after 2017. For large number of samples >10,000, higher-end desktop PC is needed.
User interface:
Navigating image
Mouse scrolling is used for zooming in/out. Clicking 'Navigation' button at the top menu activates navigation where the arrow keys in the keyboard can be used to move the image. Also, the image viewer has the navigator window at the bottom left corner. Clicking and dragging the red box enables moving to the needed location.
Note to Chrome users: clicking the 'Navigation' button may move the image to the top of the browser window, occluding the top menu. To prevent this, zoom out a little by pressing Ctrl key and minus '-' key.
Selecting fiducials for an image obtained from a flatbed scanner:
When the macroMS page for the image opens, three fiducial points should be indicated. Click ‘Edit fiducials’ button, and click a feature that is visible both in the image and in the video feed within the MALDI ToF MS instrument. Such features include three of the four corner edges of the ITO glass or any small objects (<300 μm) that are very near the three corner edges of the ITO glass such as the center of 'X' mark etched by a knife, or even salt particles. Both of below are fine.
Selecting fiducials for an image obtained from camera:
Perspective transformation depends on accurate indication of the corner edge points of the rectangular area containing the sample targets. In other words, conntecting the four fiducial points should result in a rectangle. Four corner edge points of the rectangular area (i.e. an ITO slide) should be marked by fiducial points. Alternatively four laser etch marks that are in precisely rectangular arrangements work, as long as they are visible both in the image and the MS instrument video feed. The ratio between the width and the height of the rectangle should be inputted into the text field. For example, if the width and height of the slide are 100mm and 50mm, the input value would be 2.0. Two signicant figures is enough accuracy for the ratio value.
Generating target list
Feature recognition needs white(r) sample and dark background. To achieve this, thresholding and inversing the image can be performed. Adjust the threshold value as needed. The button with up/down arrow mark is for switching between thresholded and the original image. After thresholding, set the parameters for feature recognition and click 'Perform feature finding'. The identified targets will appear as green target boxes (called "blobs") on the image viewer. The center of the target boxes will be where MALDI-ToF-MS laser will target. Blobs above 7,000 can slow down the response time. Example process of thresholding and target finding are shown below.
Target boxes can be manually edited by mouse. Activate the target edit mode by clicking the 'Edit blobs' radio button. Clicking on a spot will add a target box, meaning MALDI-MS will target the new spot. Clicking on a target box removes the box, meaning MALDI-MS will not target the spot. To remove multiple target boxes at a location, click the 'Box remove' radio button where mouse drag+drop will remove boxes over the location.
(Optional) Open the filter tab by clicking the filter radio button at the top bar, example shown below. The found features can be filtered by size, circularity, and distance to the nearest neighbor. The histogram plot opens when the filter button is clicked. The upper limit and the lower limit for filter can be set at the histogram by mouse drag/drop. Alternatively, these bounds can be set by typing in the values. Click the View filtered button to view the result of filter operation. Finalize button must be clicked to permanently remove features.
The distance filter is disabled by default. It can be activated after measuring distance among the currently identified targets which take calculation time (more than 1 minute / 4000 samples). This distance measurement is performed by clicking the 'Set up distance filter' button. Upon click, the server starts distance measurement using the currently found list of the targets, and the distance filter mode will be available after completion.
Circular pack is for case when the center area of the sample is prohibitively thick for MALDI ionization. Circular pack results in 4 spots around the target boxes. The offset defines the distance from the center of the box: positive number means additional distance away from the center.
(Optional) importing target list from other software
There are other software that generate target lists from an input image such as OpenCFU. To load targets generated from these software, the following file can be generated. The first and second column are X and Y pixel coordinate of the center of the target box, third column is the radius of the target box in pixel unit. The optional fourth column is the group number classifying each sample. Up to 1000 targets can be imported. The file has to be as a tab-deliminated CSV file or text file which can be generated from Excel. First the image analyzed by the external software is uploaded to macroMS, then the CSV file can be inputted into the macroMS for the input by clicking 'Load CSV' button in the web page.
Note: depending on the software, the value of the third column may need to be added to or subtracted from the first and the second column. This is because the software may report the coordinate for the top left corner edge of the target box instead of the center of the box.
Save functions:
Savepoint: The current target list can be temporarily saved by clicking the 'Savepoint' button. You can return to the saved list by clicking the 'revert' button. However, if the user refreshes or closes the web page, the saved items will be lost.
Save session: targets and fiducials can be saved into the server for later visit by clicking the 'Save session' button. If the selected fiducial points are relatively small invisible items unlike the corner edge points of the ITO glass, there is a possibility that these points are difficult to find using the MALDI instrument sample video feed. For this case, the web page for the image can be visited again to change the fiducial points. This can be useful when the PC performing the initial round of target searching is different than the PC for performing the final edits for fiducial points using the live video feed from the MALDI device (i.e. the control station for MALDI instrument). After clicking 'Save session' button, the web address for the page should be recorded by the user, and the link is available for 24 hours from the point when the image was submitted.
Coordinate (geometry) file generation
Parameters relating to generating geometry file are located together:
'Mirror across vertical axis' checkbox is to enable imaging ITO slide with the sample side facing away from the scanner. This is to prevent the samples touching the surface of the scanner glass when the samples have to face downwards. macroMS performs virtual flip of the coordinates of the found samples when generating the coordinate file. It is a vertical flip, so make sure the glass is flipped vertically not horizontally (see the diagram in section 1 of this manual).
MALDI path optimization checkbox activates MALDI path optimization by traveling salesman path algorithm. It reduces distance traveled to target all samples, reducing analysis time and potential heating on the device stage motor. The optimization is recommended when the number of targets is above 5000. The TSP optimization process takes up to 1 minute. If unchecked, a custom path optimization algorithm is used which completes immediately. For a test with 3100 samples, unoptimized set, TSP algorithm, and the custom algorithm resulted in travel distance of 1020, 38, 114 units, respectively.
If the image is obtained by a camera and needs perspective transformation, the ratio between the width and height of the rectangular area defined by the four fiducial points is needed. For example, if the width of ITO glass is 75mm and height is 50mm and the four corner edge points of the ITO glass are used as finducial points, then the value is 1.5. The width of ITO glass is the horizontal length of the glass at the orientation when mounted on MALDI plate.
The downloaded out.xeo file should be copied into the folder that holds geometry files for flexControl software. (i.e. D:\Methods\GeometryFiles)
Minor note about fiducial marks
Green target box can be converted into fiducial mark by clicking in fiducial edit mode. If a fiducial mark is converted from a target box that was generated by feature recognition and not by manual clicking, and if another feature recognition is performed, new target box generated for the spot will hide the fiducial mark. The fiducial point will still exist at the spot.