# I am being tasked with building an image processing GUI and need to set geometries within an image. Need some instruction on where to start.

1 view (last 30 days)
Marshall on 6 Jan 2016
Answered: Image Analyst on 19 Jan 2016
Hello I have been tasked to replicate an existing software that works with image processing of images obtained from Transmission Electron Microscopes. This software does all kinds of things, from assessing miller indices of the cell to correcting the distortions that result from, thermal drift, siesmic activity and electrical anomalies that may affect the sample stage during the data collection process of STEM. I am using matlab, which I would consider myself a novice user of, at best. THe type of image produced by the TEM is a lattice of sorts, as you would imagine an atomic lattice to be. Basically sphere’s in some sort of repeating pattern in all directions. Here is a good example, each group of four cells forms a sort of rhombus, indicating a specific unit cell structure specific to this material whatever it may be.
I whipped up a quick GUI to do qualitative shear transformations and ended up with results like hwat we see in the picture below. I thought this would be enough , but I was tasked with further expansion to a much more precise and quantitative transformation.latticenew2.jpg
What is being asked is to determine the transformation matrix of an image based on two specific vectors of some certain number of atom length. I will use paint to illustrate :
The first task is too be able to point and click on one of the atomic positions and have the program outline the positions of some intensity. Then by selecting the same number of atoms in the effective x and y directions a block of unit cells can then be mapped:
After obtaining what I am going to call a lattice unit I have some sort of function that measure the parameters of that lattice unit:
And then after specifying the parameters and doing the transformation achieving a new lattice looking more like the original.
So more than anything I would like a few pointers on where to get started with the peak identification, I think this would start with some sort of image threshholding? As well as the identification of the middle of the peaks and the automation of drawing vectors from the middle of the identified peaks.
I would also like some pointers on doing the actual transformation based on the lengths of the different parameters specified. That would be very cool!
Thanks

Pavel Dey on 19 Jan 2016
I think you need to perform some thresholding operation before detecting the pattern. You may either perform thresholding using the functions like 'gray2ind' or'grayslice'. See the documentation below
Or you may also use 'stdfilt' to determine local standard deviation. It will divide the image into separate regions based on the variation of intensity. See documentation here
There are similar other function also. Select appropriate function whichever is suitable for your application.
Now if you detect those regions in the image where the white spheres are, you may use 'regionprops' function to find out the centroids of these regions.
Once you find that out you may use 'insertShape' function to draw any shape on the image. I am not very certain of the nature of images produces by TEM. But if the white spherical regions lie on same line you can easily draw a rhombus from its corner points. Check the documentation link for 'insertShape' below
You may declare the argument 'position' as Polygon and pass the corner coordinates of the rhombus as suggested in the documentation.

Image Analyst on 19 Jan 2016
You can try the command imregionalmax(), which is meant for this kind of thing.