Author Topic: Align and Crop GRD Files  (Read 455 times)

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Align and Crop GRD Files
« on: March 16, 2017, 05:49:04 pm »
Here's a cool new feature suggested by Dan Ruscitto at GE. It was a bit of work to implement (I had to get a little help), but it works really nice I think.

Basically he wanted to align and crop the raw intensity images from multiple passes (say 10 elements in two spectrometer passes), acquired at high magnification during which the stage or sample had drifted slightly, so they could be quantified in better alignment.  It works with two or even more spectrometer mapping passes!

To perform this alignment and crop method open the Log Window from the Window menu in the main CalcImage window and select the new Align and Crop Raw Images menu as seen here:



Then open a reference image (typically a BSE image from the first spectrometer pass) using the Select Reference Image button, and then open a similar image from the 2nd spectrometer pass (again typically a BSE image from the second spectrometer pass), this time using the Select Overlay Image button. 

I created an artificial (very large) offset on some test images, so the idea is clear for everyone, though normally I would expect only a few pixels of drift in x or y.  Right now the code is limited to 10% drift, but we could allow for larger offsets if necessary...



Then using the mouse drag or the offset updown controls, we adjust the overlay image until it is perfectly aligned with the reference image as seen here:



Then we click the Save Overlay Offsets button to store the overlay for the alignment of this spectrometer pass (the second spectrometer pass).  If there is a third or fourth spectrometer pass again we select an overlay image from that spectrometer pass (you must keep the original reference image!), and again align it to the reference image and again, click the save Overlay Offsets button to save the alignment for this next spectrometer pass. The app remembers the alignments of each overlay for you automatically...

Once we have our spectrometer passes all aligned, we simply click the Crop All Images button and the software will go through all the images in the list and crop them all to the same size!  The cropped images are saved to a sub folder so your original images don't get over written (because they will have the same names as the original images!).

Finally this isn't a necessary step but just for fun I loaded the cropped reference and overlay images in (from the _Crop subfolder), and you can see that the images are perfectly aligned and a little smaller...



This is just a first cut at the feature, but I think it's pretty cool.  Here is the general order of operations:

1. Acquire your standards in PFE and your x-ray maps in Probe Image.

2. Create a new project in CalcImage as usual (using the project wizard), selecting the PFE run and the images from the PI run.  This converts everything to GRD files.

3. Now use the Clone menu in the CalcImage menu to clone the project to another folder.

4. Run the align and crop procedure above on the images in the cloned project folder. This will create a "_Crop" sub folder.

5. Now copy the cropped images into the cloned project folder (overwriting the existing images, but we still have the original uncropped x-rays maps!).

6. Run the quant on the cropped images.

Let me know what you all think...
john
« Last Edit: March 16, 2017, 05:52:47 pm by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Gareth D Hatton

  • Professor
  • ****
  • Posts: 50
Re: Align and Crop GRD Files
« Reply #1 on: March 17, 2017, 02:49:53 am »
This looks like a really cool feature  8) and will really help with the assignment of phases in Classify.

Probeman

  • Emeritus
  • *****
  • Posts: 1874
  • Never sleeps...
    • John Donovan
Re: Align and Crop GRD Files
« Reply #2 on: March 17, 2017, 09:49:20 am »
This looks like a really cool feature  8) and will really help with the assignment of phases in Classify.

Hi Gareth,
Just curious, but how much stage/sample drift at high magnification do you usually see on your instrument?

I'm sure the answer is "it depends", but do you think that a 10% adjustment range is sufficient?
john
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 1874
  • Never sleeps...
    • John Donovan
Re: Align and Crop GRD Files
« Reply #3 on: March 18, 2017, 08:56:29 am »
Not sure if this is useful but I loaded a BSE image as the reference image and an x-ray map as the overlay image in the Align and Crop window and you get a sort of "composite" image like this:



Adjusting the opacity slider one can obtain this:



If this "composite" image might be worth capturing I could add a "copy to clipboard" button... what do you all think?
john
The only stupid question is the one not asked!

Anette von der Handt

  • Global Moderator
  • Professor
  • *****
  • Posts: 237
    • UMN Probelab
Re: Align and Crop GRD Files
« Reply #4 on: March 20, 2017, 09:10:41 am »
Yes, please!
Against the dark, a tall white fountain played.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Re: Align and Crop GRD Files
« Reply #5 on: March 20, 2017, 10:53:02 pm »
Yes, please!

Ok, I added a Copy To Clipboard button to the Align and Crop window.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Probeman

  • Emeritus
  • *****
  • Posts: 1874
  • Never sleeps...
    • John Donovan
Re: Align and Crop GRD Files
« Reply #6 on: March 21, 2017, 05:49:02 pm »
Yes, please!

Now you must post a cool example of why this is useful!    :D
The only stupid question is the one not asked!

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Re: Align and Crop GRD Files
« Reply #7 on: March 23, 2017, 04:54:41 pm »
On the new align and crop feature in CalcImage described here:

http://probesoftware.com/smf/index.php?topic=41.msg5752#msg5752

I realized that it's a little ambiguous as to exactly what stage coordinates should be utilized in the final cropped map outputs.  Each map has the same stage coordinates to begin with, but because the sample or beam may have drifted during the multiple spectrometer passes (if not why are you aligning and cropping!), so they are close, but not exactly in agreement (due to the degree of alignment necessary).

Now since we want the cropped maps to all have the same stage coordinates, what is a programmer to do?  I decided to just apply the total change in stage extents, based on the reference (base) image, by taking the common offsets and applying that to all cropped images.  This means that the cropped images sizes (width and height) are very accurate, and as for the absolute stage positions... well, when the sample is drifting, who's to say!
john
« Last Edit: March 23, 2017, 05:05:09 pm by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Re: Align and Crop GRD Files
« Reply #8 on: April 15, 2017, 11:19:22 am »
The newest version of PFE (CalcImage) fixes the "missing image" warning in the align and crop code when you have different numbers of maps per acquisition (for multiple spectrometer passes when you map more elements than you have spectrometers).

Also this new version now automatically copies specified subsequent (spectrometer pass) acquisitions (for the replicate to TDI conversion) to the \TDI folder for creating a new project in CalcImage for beam sensitive samples.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Aurelien Moy

  • Student
  • *
  • Posts: 1
Re: Align and Crop GRD Files
« Reply #9 on: December 06, 2018, 03:20:52 pm »
Hi,

We just downloaded the most recent version of Probe for EPMA and we noticed that some work has been done on polygon extraction. We are doing some high resolution quantitative maps that require to overlay two passes. However, between the first pass and the second pass, we sometime have beam drift or beam jumps that can be quite large. There is a feature in CalcImage to overlay two maps and crop them to correct this problem. But because of our big shifts, their is sometime not enough freedom to move the overlaying the map.

Is there any way to provide a cropping tool so we can crop a rectangular (or more complicated shape) area once the two maps have been overlayed ?

Thanks,

Aurélien
« Last Edit: December 06, 2018, 05:43:14 pm by John Donovan »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Re: Align and Crop GRD Files
« Reply #10 on: December 06, 2018, 05:51:24 pm »
Hi,

We just downloaded the most recent version of Probe for EPMA and we noticed that some work has been done on polygon extraction. We are doing some high resolution quantitative maps that require to overlay two passes. However, between the first pass and the second pass, we sometime have beam drift or beam jumps that can be quite large. There is a feature in CalcImage to overlay two maps and crop them to correct this problem. But because of our big shifts, their is sometime not enough freedom to move the overlaying the map.

Is there any way to provide a cropping tool so we can crop a rectangular (or more complicated shape) area once the two maps have been overlayed ?

Thanks,

Aurélien

Hi Aurélien,
There's nothing special about cropping rectangular or even polygon scans.  Here is an example of aligning and cropping a rectangular polygon scan:



and here it is aligned:



If you have need for alignments greater than this, you have bigger problems than I can help with. For example, if the instrument is drifting at this rate, straight lines will appear as as diagonal lines!

I think you need to get your instrument fixed!     :'(

If I am not understanding something please let me know what I am missing.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2424
  • Other duties as assigned...
    • Probe Software
Re: Align and Crop GRD Files
« Reply #11 on: January 30, 2019, 11:22:32 am »
As you may know, we recently moved the Align and Crop menu to a new Convert menu in the main CalcImage window as seen here:



This Align and Crop window is useful when your x-ray map acquisitions require more elements than you have WDS spectrometers, e.g., 10 elements on a 5 spectrometer instrument, therefore 2 map acquisitions are required, and your instrument is experiencing significant stage or beam drift over time.

The following example shows a high magnification x-ray map acquisition for 5 elements, and then two more on a 2nd map acquisition.  This was on a JEOL FEG EPMA instrument at PNNL (thanks to Nathan Canfield), where you can see that the x-ray resolution is quite impressive at 8 keV. Unfortunately the sample (or beam?) wasn't perfectly stable so the two 20 hour acquisitions showed a small amount of drift not only between the two acquisitions, but also even within each acquisition as seen here, once the two images are aligned on the specific region of interest:



It makes sense the the alignment of these two acquisitions only works well in a specific vertical region because it was a beam scan map acquisition and so the pixel data is acquired top to bottom. Fortunately however, the center area is what they are mostly interested in, but it is worth mentioning that one could rename the /Crop folder after each align and crop operation (e.g., /Crop1, /Crop2, etc.), focusing on different areas, thus allowing separate quantifications on each /Crop sub folder.

One simply needs to copy the existing .CIP (CalcImage Project file) and .MDB file to each /Crop sub folder and re-quant each.

It is also worth mentioning that we fixed a small bug that sometimes caused an error, if some spectrometers in subsequent map acquisitions did not have an element acquired, during the align and crop operation.  Update PFE to the latest version and you should be all OK.
« Last Edit: January 30, 2019, 12:13:58 pm by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"