XSCAN Image Processor software main window
Introduction
The XSCAN image processing software is designed to work in the XSCAN IMS program as part of image acquisition, as a callable utility within the XSCAN IMS program or as a standalone executable. This program will process either XMAN or XSCAN images.
Users Modes Summary
The XSCAN Image Processing software is available within the XSCAN IMS acquisition program as part of inline acquisition, as a utility callable from the Instrument drop down menu and as a standalone utility. Here is a list of the functional differences:
Inline | Utility | Standalone |
---|---|---|
|
|
|
Using the Program
The program can be launched from the Start Menu or by double clicking the desktop shortcut for the standalone executable (Figure 1).
Figure 1. XSCAN Image Processor icon
The Utility version is launched from the IMS menu under Instruments > CAMERA: Process Utility. Inline mode is automatically open after completing acquisition.
Standalone and Utility
When the program launches it will open a file dialog box where you can select the raw image file. Only TIF images were the filename ends in "_R.tif" or "_RAW.tif" will be shown. Select the image and click OPEN (Figure 2).
Figure 2. Selecting an image when the program launches
You can also open an image at any time by clicking the Open Image button (Figure 3).
Figure 3. Open Image button
If the image data is corrupted you may see the following dialog box where you can correct the data (Figure 4). Input with red marks is needed for a correct Sample_ID and Text_ID. Input with the green marks is needed for creating the virtual ruler.
Figure 4. Metadata input window in case of corrupted image data
When the image opens you see the original image in the RAW image display and the masked image in the MASK display window. You will also see the histogram of the original image and the Mask Threshold Profile plot (Figure 5).
Figure 5. Display windows when an image opens
Masking
The Mask Threshold Profile plot (Figure 6) is a single row of pixels taken from the original image. The initial row when an image is open is 1000 and shows as a black line on the RAW image display (Figure 6, a).
The user can select any row in the image by using the scrollbars to adjust the image and then just clicking on the image. The profile will appear and the Mask Threshold Profile plot will update.
You want to select a typical (representative) profile from the image to set the mask threshold value. The masking threshold is set by moving the pink horizontal cursor (Figure 6, b).
Figure 6. Selecting the mask threshold profile
It is important to set the mask for good processing results. The value should be set to remove the core liner/dividers and miscellaneous "stuff" but not so low that you reduce the edges of the core. When you make changes to the threshold you will see changes in the image mask and the green ROI (region of interest) box which shows how the image will be cropped.
If you see lines or bands in the image like shown in Figure 7, lower the threshold values. Horizontal lines or bands are the image sensors in the camera.
Figure 7. Image sensors (yellow arrow) in the camera
Cropping
The Crop Image button (Figure 8) is only enabled when the length of the green ROI box is within +/- 2 cm of the scanned length or when the user has disable the length check by selecting Override Crop Restrictions checkbox (Figure 8).
Figure 8. Crop Image button and Override Crop Restrictions checkbox
The crop width is fixed to 2200 pixels (XSCAN images) or 1539 pixels (XMAN Images) and will be centered on the Mask image. If not centered adjust the threshold cursor in the Mask Threshold Profile plot until it does. Top and bottom is based on the top and bottom of the masked image (shown in white in the Mask display window). This can lead to a crop length that is shorter than the scan length for partial core images. Use the Lock to Top and Lock to Bottom checkboxes to correct this issue (Figure 9).
Figure 9. Lock to Top and Lock to Bottom checkboxes
If you don't see the crop box, adjust the mask threshold level cursor until it appears.
ROI box adjustment by user
The user can adjust the green ROI box (Figure 10) by different techniques:
- Use mouse, click and drag only the top and bottom lines of the ROI box. Dragging the sides or by the corner are ignored.
- If the bottom and top are locked (like in Figure 9) any attempt to drag them is ignored.
- If the image has been processed and ready to save, any attempt to drag a ROI onto the Mask image is ignored. You must click the Uncrop Image button first (Figure 11).
Figure 10. Adjusting the green ROI box (i.e., crop box)
Figure 11. Uncrop Image button
Crop Status
The length of the crop ROI is compared to the scanned length as recorded in the Sample_ID information. If the cropped length is within +/- 2 cm of the scan length the crop boundary is accepted ("Good Crop" in Figure 10) and Crop Image button is enabled (Figure 8).
If it is out of range you see the issue in the Status message (e.g., "Too short") and the Crop Image button is disabled (Figure 12).
You can override the status be selecting the Override Crop Restrictions checkbox.
Figure 12. Out of range ROI box warning
Cropping is undone if :
- Click the Uncrop Image button
- Move the Mask threshold level cursor (pink line)
- Click the Lock to Top or Lock to Bottom checkboxes
- Change the selection of the SUB-IMAGE PROCESS checkbox
Processing an image
Important: Processing can only start after the image has been cropped. Until then the Process Image button (Figure 13) is disabled.
There are three methods developed for processing X-ray images. The goal is to remove the bulk attenuation caused by the thickness profile and leave only the attenuation variation due to attenuation caused by particles (element make-up) and the arranged fabric of those particles within the core due to sedimentary or igneous process.
All three methods calculate a bulk attenuation profile (baseline, red line in the Baseline Profile plot, Figure 13) that is then subtracted from the material’s original attenuation profile (blue line in the Baseline Profile plot, Figure 13).
Figure 13. Process Image button and Baseline Profile plot
Then the user selects a range of the values from the results (histogram) of the subtraction, which is then expanded into the U16 image space between 10,000 and 55,000. The expansion is done by calculating a look-up table (LUT) from the select range of values in the histogram (Figure 14).
Figure 14. Difference histogram and corresponding LUT
Select one of the three methods (Figure 15). For By Profile and By Smoothing methods you will also set the LOW PASS value for the smoothing operator (cursor on the left in Figure 15). The smaller the value the greater the smoothing. By Low Pass method works differently. This will be discussed in detail in the Methods section in the Appendix of the document.
Figure 15. Processing methods
Now click the Process Image button (Figure 16, a). You will see the resulting processed image in the Process display window (Figure 16, b), the histogram of the subtraction results (Figure 16, c) and the expansion LUT plot (Figure 16, d) based on the current settings.
Figure 16. Processing an image
Note: The pros and cons of each method will be discussed in detail at the end of this document in the Appendix.
Image Enhancement
In the EXPANDED DIFFERENCE Histogram you will see two verticals cursors, one purple, the other blue (Figure 17). These are used to create the Look-up Table which is applied to the processed image to enhance selected parts of the image.
There are two methods to adjust these cursors:
- The user can use the mouse to drag the cursors (make sure to select the left button of the graph pallet, Figure 17).
- Or use the STD-DEV PRESET slider to set the cursors as a function of the standard deviation from the mean (Figure 17). Set the slider to 0.4 will place the cursors at 40% from the mean. And, setting the slider to 2.5 will set the cursors 250% from the mean. The cursors will never pass the min or max values of the histogram.
- Or a combination of both.
Figure 17. Image Enhancement options
The GAMMA slider (Figure 17) is used to apply a gamma correction to the LUT using this formula: x^y = exp (y * ln(x)). For each value in the original LUT (x) we apply the slider value (y).
| ||
| ||
|
Rapid Process Testing
To quickly test different processing settings and method you can set the program to process on the image shown in the RAW display window by selecting the Sub-Image Process checkbox (Figure 18). This is most useful for the By Low Pass and By Smoothing process as these processes take time to perform.
Figure 18. Sub-Image Process checkbox
When used for the By Profile (method with the Hold Sub-Image Baseline button checked - Figure 19) it will use the correction (i.e., baseline profile) for the whole image but the resulting image histogram must always be different because the histogram is based on the entire image.
Figure 19. Settings for the By Profile method rapid process testing
How to:
- Use the scroll bars in the RAW display window to select the test image and then select SUB-IMAGE PROCESS checkbox (Figure 18). Now only the portion of the image will be used. In this mode you can not save any images or data - the buttons are disabled.
- Processing has two basic steps: 1) profile correction (image flattening) and 2) histogram (of the entire image) enhancement. The second step causes the sub-image interval to change from what was seen in the sub-image process alone. Manually changing the histogram cursors can sometimes help (Figure 17).
- To change the test image use the scroll bars to reposition the image and then uncheck and re-check the SUB-IMAGE PROCESS checkbox.
- When you are satisfied with the results un-select the checkbox and click the Process Image button.
- Then click the Save Image button (Figure 20) or start a batch process by clicking on the Batch Process button (Figure 21).
Figure 20. Save Image button
Figure 21. Batch Process option
Note: When a core has different materials, another approach is to re-image the hard and soft rock intervals as separate images using the ROI setting of the XSCAN (in the Sample Information window of IMS) or use a software such as Adobe Photoshop to split the image into two parts and process separately. Keep in mind that only .tiff image can be processed.
Saving an image
Once you are satisfied with the processing settings, the processed image can be saved.
Inline mode
- The Raw image (.tif image) must be saved - this cannot be changed.
- Other formats and auxiliary data are selected by defaults but can be unselected.
- Files are saved to the C:\DATA and C:\AUX_DATA folders.
Utility and Standalone mode
- Because you must open an existing raw image, the Save RAW Image checkbox is unchecked by default (Figure 22). Selecting this checkbox will save a copy of the raw image and create a new load file for MUT.
- The program will default to save auxiliary data (length and width), a processed image without ruler and a second image with a virtual ruler added. The respective three checkboxes are checked (Figure 22).
- Files are saved to the C:\PROCESSED IMAGES and C:\PROCESSED AUX_DATA folders.
Figure 22. Default settings for saving an image in the standalone mode
Note: If you select to save the raw image, a standard MUT load file will be created (i.e., a .XSCAN file). If the raw image is not saved then abbreviated version of the MUT is made sufficient to load the new images into ASMAN.
Files
Image and load files will be saved to a folder on the C: drive, called PROCESSED IMAGES folder. Auxiliary files will be saved to PROCESSED AUX_DATA folder (Figure 23).
Figure 23. Folders created for saved files
Note: MUT will need to be configured to load the files from these directories. Do not drag to the C:\DATA\IN folder or to the C:\AUX_DATA folders on a workstation as the path in the load file is hard coded.
Widths and Lengths Auxiliary Data files
The data contained in these files can be used to filter other IMS track data (such as the NGRL). When combined with rotational images this can be used to estimate material volumes. The plot shown below (Figure 24) is shown on the WIDTHS & LENGTHS tab of the main window of the software and is updated on every crop execution.
Figure 24. Mask of hard rock pieces and edges (left edges in cyan and right edges in purple)
From the Mask image, the width and length of pieces are measured. In a full core there will only be one piece. From this data two files are saved to the auxiliary data folder.
The length file contains the discrete length (cm) of pieces found in the image (Figure 25). A full section (e.g., APC core) will be considered as one piece.
Figure 25. Length Auxiliary Data file
The width file contains list of width (cm) for the left and right hand edges, and the width of the pieces (Figure 26).
Figure 26. Width Auxiliary Data file
Batch Processing
Batch processing will automatically load all "raw" image files and process them all according to the values as set in the application.
Before clicking Batch Process button, first open a typical image from the folder of images and go through all of the processing step as mentioned above in the "Processing an image" section except don’t click the Save Image button. Now click Batch Process button. The program will open the folder and count the number of raw image files to process (Figure 27).
Figure 27. Finding files for a Batch processing
Click DO IT to start processing or CANCEL. The BATCH PROCESS window will show the progress of the batch processing (Figure 28).
Figure 28. Batch Process window
You can click the ABORT button which will stop processing on the next image. When complete you will be returned to the main window.
APPENDIX: Additional Information
Method Details
By Profile
The baseline profile is the mean value of each column (along the core) of pixels. It is independent of the mask threshold profile.
A low band pass filter is applied based on the value the user sets on LOW PASS slider.
Normally this is ~0.010 (or 1E-2). Each row of pixels is subtracted from this baseline and the resulting values scaled to a range of 10000 to 55000 (Figure A1).
Figure A1. Baseline Profile plot
This method is fast and will show good results provided the section has a uniform cross-section along the entire length. If the material has crack, gaps or gouges, a vertical (along core) banding can occur in the image.
It works well for APC cores but can be used on RCB and XCB cores provided they have a uniform cross-section.
Because a single baseline is used against the entire section, density changes relative to the baseline will appear as changes in the grey scale background. Values close to the baseline will appear darker. Using the GAMMA slide can really improve the image.
Example in Figure A2: This is a section that has been sampled for a thin section billet (light grey area on the image). Notice the horizontal steaks above and below the cut line (yellow arrows).
The baseline shown in red is applied to every row in the image creating the dark streak on the left (with the By Profile method).
Figure A2. Section sampled for a thin section billet and its impact on the image - By Profile method
Figure A3 is the same section using the By LOW PASS method. Each row in the image has its own baseline and the streak does not propagate.
Figure A3. Section sampled for a thin section billet and its impact on the image - By Low Pass method
By Low Pass
A 2 dimension smoothing kernel is applied to the image multiple times to create a smooth (low bias pass) image. Then the two images are subtracted and the resulting image scaled to a range of 10000 to 55000. This creates local correction pixel-by-pixel and dos not require uniform cross-section. It is ideal for RCB and XCB cores that are irregular pieces.
This method will work on uniform cores (APC) but it is slower and will not show density variations along the line as the By PROFILE method.
By Smoothing
Similar to the By Profile method but it calculates a baseline for each row of pixels that is smoothed by the value set on the LOW PASS slider. Normally this is ~0.001 (or 1E-3).
This method is very slow and show horizontal streaks in the image.
APC Comparison
By Profile | By Low Pass | By Smoothing |
RCB Igneous Comparison
By Profile | By Low Pass | By Smoothing |
Processing Time for 150-cm section using 13th Gen Intel(R) Core(TM) i9-13900KF @ 3.00 GHZ (flex)
- By Profile: 2-sec
- By Low Pass: 10-sec
- By Smoothing: 43-sec
Your speed and mileage may vary.
Baseline profile plot
What is displayed in the BASELINE Profile plot depends on the processing method:
- By Profile: Red line is the mean profile of the entire section (or just sub-image). The blue line is this profile smoothed by the low pass value selected on the slider and then shifted up by 10%
- By Low Pass: Red line is the profile of the smooth image and the blue is the profile of the raw image.
- By Smoothing: same as By Profile
For the By Profile method, if the baseline is taken in the sub-processed region, and frozen, the settings selected during the sub-process would be applied to the whole section. The other methods work differently.
How to save a quick image
Right click any of the Process image display and a pop-up context menu appears (Figure A4). Click Save Image.
Use the file dialog box to select the folder and image filename. Type the file extension to select the image format (Figure A4). The Original and Process U16 image cannot be saved as bmp, tiff, or jpeg (all other formats work) because it is a U16 image while the other are U8 images.
Figure A4. How to save an image quickly
Note: Clear ROI: This removes any lines drawn on the image using the drawing tools. If the user removes the profile line from the raw image this will not change the profile data. The program will retain the position.