Author Topic: Image Math in CalcImage  (Read 6954 times)

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Image Math in CalcImage
« on: June 14, 2015, 12:13:38 PM »
Now this is a cool feature, I think!  But please tell me what you all think...   :)

I've just implemented a versatile method for performing image math on images of any type (raw data, quant, etc) in CalcImage. The math can be any simple algebraic equation that contains variables for each image and any constants required. Parentheses are supported, but only the operations of addition, subtraction, multiplication and division. 

This new CalcImage version is ready to download now using the PFE Help | Update Probe for EPMA menu...

I think the procedure is pretty straight forward but I will describe the steps:

1. Load into CalcImage the images that you want to perform image math on.  These could be arbitrary GRD or PrbImg images loaded using the File | Open GRD File or File | Import PrbImg File menus, or raw data images from a previously calculated CalcImage project file.

If you want to perform image math on quant images from a CalcImage project, after opening the project simply close all open images using the File | Close All Images menu and then click the Project | Open Images From Current Project menu and select the image types that you want to perform image math on, e.g., oxide, atomic percent, end members, etc, etc...

2. Now open the Calculate RGB and Perform Image Math window from the Processing menu.

3. Click the Perform Image Math calculations option and type in the math equation that you want to utilize without the result variable (it is implied) or equal sign. You can use any alphabetic characters, such as A, B or X, Y, Z, etc., etc.  For example "(A + B)/C + 50".

4. Now click the Select button and the software will prompt you to click on each image for the indicated equation variable from those images loaded in the main CalcImage window, for each image math variable one at a  time. Please wait until the program prompts you for the next image before clicking another image.

5. Now click the Calculate button and voila.



The calculated pixel values under the mouse cursor are displayed in the label field underneath the Calculate button.

Please feel free to post your own image math examples, I'm not sure that MgO wt% times Al2O3 wt% means anything significant geologically speaking!
« Last Edit: June 14, 2015, 08:08:28 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Ben Buse

  • Professor
  • ****
  • Posts: 498
Re: Image Math in CalcImage
« Reply #1 on: January 19, 2016, 01:35:08 AM »
Hi John,

What am I doing wrong I get the following:



To explain. I have a map of sulphur in steel and I want to subtract the measured background from it before quantifying it. So I opened image calculation selected the A, B, C images. Then for image A performed the operation A-739.9 it displays the recalculated picture all looks fine but when I click "Save as GRD" it comes up with message "File Not Found". I admit this is not what you'd normally do or its designed to do

Thanks

Ben

Ben Buse

  • Professor
  • ****
  • Posts: 498
Re: Image Math in CalcImage
« Reply #2 on: January 19, 2016, 01:56:02 AM »
I suspect its because I trying to do the wrong thing - for when I click save as bmp I get



i.e. image math is for and works in the context of RGB images. I will do it in surfer instead.
« Last Edit: January 19, 2016, 02:14:25 AM by Ben Buse »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Image Math in CalcImage
« Reply #3 on: January 19, 2016, 07:56:12 AM »
I suspect its because I trying to do the wrong thing - for when I click save as bmp I get



i.e. image math is for and works in the context of RGB images. I will do it in surfer instead.

Hi Ben,
It could be that you seem to be trying to process images on a network server?  It might not handle that well.

I will try test the saving of image math results, and maybe you try performing the operations using local files...

But why aren't you just quantifying the sulfur using CalcImage normally, as opposed to doing the subtraction by hand in the image math window?
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Ben Buse

  • Professor
  • ****
  • Posts: 498
Re: Image Math in CalcImage
« Reply #4 on: January 19, 2016, 09:17:22 AM »
Your right John,

It works well particularly if you type the equation 1st e.g. A-900 then you only need to select map A. My documents folder is an online folder which sometimes throws things particularly when its listed as ads.bris.ac.uk rather than drive o (i.e. network drive).

Good to know what problem was and easy solution - thanks.

The reason why - I was going to run MAN bkg but I couldn't find a blank (all the metal standards I had in the machine seemed to have 20 ppm sulphur and I was analysing 10-30 ppm sulphur on sample). Instead I took the offpeak backgrounds measured on the sample and subtracted them.  I am looking for very low sulphur 1.5 uA beam detection limit 2-4 ppm for quant points.

Ben

Probeman

  • Emeritus
  • *****
  • Posts: 2856
  • Never sleeps...
    • John Donovan
Re: Image Math in CalcImage
« Reply #5 on: January 19, 2016, 10:56:43 AM »
Your right John,

It works well particularly if you type the equation 1st e.g. A-900 then you only need to select map A. My documents folder is an online folder which sometimes throws things particularly when its listed as ads.bris.ac.uk rather than drive o (i.e. network drive).

Good to know what problem was and easy solution - thanks.

The reason why - I was going to run MAN bkg but I couldn't find a blank (all the metal standards I had in the machine seemed to have 20 ppm sulphur and I was analysing 10-30 ppm sulphur on sample). Instead I took the offpeak backgrounds measured on the sample and subtracted them.  I am looking for very low sulphur 1.5 uA beam detection limit 2-4 ppm for quant points.

Ben

Hi Ben,
Yes.

One should type in the equation first, and then browse for the files.  Why?

Because when you click the Browse button in the Image Math/RGB window, the application parses out the equation and searches for all image variables, e.g., A, B, C, etc.   

So for example, you type in (A+B)/C as your image math equation and click the Browse button, the app then identifies A, B and C as image variables and then prompts you for image A, image B and image C and then calculates the resulting image.

If you or anyone else, can think of a way to make this process more intuitive I'm sure it can be improved.
The only stupid question is the one not asked!

Anette von der Handt

  • Global Moderator
  • Professor
  • *****
  • Posts: 355
    • UMN Probelab
Re: Image Math in CalcImage
« Reply #6 on: November 17, 2016, 07:40:45 AM »
Hi John,

I finally tried it. Works great!

Thank you
Against the dark, a tall white fountain played.

Probeman

  • Emeritus
  • *****
  • Posts: 2856
  • Never sleeps...
    • John Donovan
Re: Image Math in CalcImage
« Reply #7 on: November 17, 2016, 08:33:53 AM »
The reason why - I was going to run MAN bkg but I couldn't find a blank (all the metal standards I had in the machine seemed to have 20 ppm sulphur and I was analysing 10-30 ppm sulphur on sample). Instead I took the offpeak backgrounds measured on the sample and subtracted them.  I am looking for very low sulphur 1.5 uA beam detection limit 2-4 ppm for quant points.

Hi Ben,
I wonder if your carbon rods in your carbon coater have some sulfur in them?  Sulfur is a common contaminant of carbon.

I once kept finding ~100 PPM of chlorine on every one of my standards. We finally tracked it down to a PVC hose used in the roughing line of our Edwards carbon coater.  We replaced that hose with food grade polyethylene, did a cleaning of the vacuum chamber and were back to zero chlorine levels again.
john
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 2856
  • Never sleeps...
    • John Donovan
Re: Image Math in CalcImage
« Reply #8 on: November 17, 2016, 08:35:46 AM »
Hi John,

I finally tried it. Works great!

Thank you

At first I thought you were responding to your recent slice/polygon/strip net intensity output request. 

But thank-you!  It is a cool feature, isn't it?
john
The only stupid question is the one not asked!

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Image Math in CalcImage
« Reply #9 on: January 28, 2019, 08:18:44 PM »
We recently re-wrote the image math code and GUI in CalcImage so it should be much more intuitive and easier to use now.

As you may know the ability to perform mathematical operations on images is accessed from the Image Processing menu in CalcImage as seen here:



The new code and GUI seen here:



now behaves by utilizing the currently opened Classify .DAT file (just like the RGB feature does). So when one clicks the Select button, the user simply checks the element checkboxes listed on the left, that correspond to the variables in the typed equation, where A = an element, B = an element, etc.



Please update PFE, try it out, and let us know what you think.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"