szkafander / lattice_fringe

hrtem lattice fringe image analysis algorithms - developed for carbon nanostructure analysis
11 stars 2 forks source link

Matlab Code Documentation #2

Closed Math2126 closed 2 years ago

Math2126 commented 2 years ago

Hi,

first of all thanks for the code! Do u have some more detailed documentation for the Matlab code?

Regards,

M

szkafander commented 2 years ago

Hi,

Not at this time. I’m happy to help you or answer questions though. What exactly are you looking for?

On 2022. Apr 26., Tue at 12:58, Math2126 @.***> wrote:

Hi,

first of all thanks for the code! Do u have some more detailed documentation for the Matlab code?

Regards,

M

— Reply to this email directly, view it on GitHub https://github.com/szkafander/lattice_fringe/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKF5JGMYOHR42HOJDR37PNDVHAVFZANCNFSM5UMULWWQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

szkafander commented 2 years ago

Please read and study the papers cited in the repo description. The newest paper will answer your question on parameters. If you have questions after that, let me know. Thanks.

On 2022. Apr 27., Wed at 13:59, Math2126 @.***> wrote:

Hello,

thanks for the fast reply! For my masters thesis I need to analyze some fringe lengths. I'm new to this topic and wanted to know, how you chose the algorithm parameters. The same goes for the selectivity in line 48. For the nmperpix I didn't know where the "(195-31)" came from. I just measured 164 pix for the 5nm size, which equals the same. I'm sorry for the unknowledgment at the moment, but I really wanna understand the code as it is really good for my project.

— Reply to this email directly, view it on GitHub https://github.com/szkafander/lattice_fringe/issues/2#issuecomment-1111370884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKF5JGOWUS2JK2Q3FR3KRILVHGFC5ANCNFSM5UMULWWQ . You are receiving this because you commented.Message ID: @.***>

Math2126 commented 2 years ago

How do I improve fringe length detection? In my sample there are graphite structures which are easily 10-20nm, yet the code doesn't recognize them. You said in the text, that u got a similar problem. Do I just need to adapt the parameters ?

szkafander commented 2 years ago

The answer is "probably", but 10-20 nm does not sound like typical samples that this code was made for. I can better help you if you share your image.

Math2126 commented 2 years ago

26insert_6 Kopie

I needed to convert the .tif file to Jpeg Since Github doesn't support .tif. File is attached. Thanks for your help!

szkafander commented 2 years ago

This looks like a flake of graphene or a graphite grain. Not the typical sample that you would use this code for.

A couple thoughts:

  1. The typical application is amorphous / semi-crystalline carbon, with many disordered layers of varying length. In those cases, an automatic algorithm like mine helps you find the distribution of length without having to manually measure thousands of fringes.
  2. In this sample, a distribution of fringe length is meaningless, since the layers span the entire grain. Fringe length = the size of the grain.
  3. The layers are in and out of focus across their length, that's why the algo splits up the segments. All similar codes would do this, unless there is a specific stitching step. For large crystalline samples, it is usually impossible to focus the entire grain.

Instead of fringe length measurement, I would approach this differently. Detect crystalline domains using orientation filtering (see part II. of my CNF paper), and quantify the size of the domains. Fringe length = the size of the domains. Unless of course all of your samples look like single-crystal grains, because in that case, fringe length = grain size, and you're done.

Part II. of the CNF paper is not implemented here yet. I will add it at some point.

Math2126 commented 2 years ago

The samples I got are usually mixed of graphene and amorphous structures. Additionally the image is not properly focused. As you mentioned it becomes harder for the algorithm for more complex nanostructures. Looking at my sample picture I'm unsure which preprocessing I need to do additionally. I tried Gabor orientation filtering as u suggested but for now I'm unsure how to implement the results with your algorithm. The main question for me is, if there is any chance to get good results for my samples using an automatic algorithm even if I'm using FFT and orientation filtering before? If not, do you have any suggestions how I get the best results for tortuosity, spacing and length?

szkafander commented 2 years ago

lattice_fringe is made for processing well-focused HRTEM of soot, Carbon Black, char and similar samples. See the 2021 Carbon paper for more.

The fringe detection routine that lattice_fringe implements does not work well with long, straight layers. With that said, lattice_fringe is mostly about the Gabor filtering method; the package implements Yehliu et al's fringe detection method merely for completion. It is a simplistic implementation. The original authors might have a better version. I might add support for straight layers in the future too. Or, feel free to submit a PR. Also, there are many versions and iterations of this approach, just look around in the literature.

With that, I do not think that you can use lattice_fringe out-of-the-box to process your images. There are two reasons:

  1. If you have mostly straight layers, why calculate length and tortuosity in the first place? As I said, I would use the grain size as a measure of length, and tortuosity should be unity (no curvature). If you are looking to get the grain size itself, use the symmetry filtering approach from Part 2 of my 2013 CNF paper ("Novel framework of..."). If you can't figure it out, let me know and I can help you offline. As for spacing, the Gabor filtering method for spacing will give you accurate results - try that. If you run into trouble, I can help you set up the parameters.

  2. If you have an amorphous structure, or want to get accurate spacing measurement, you need to have good focusing to get meaningful and consistent results. I don't think you can circumvent that requirement.

In any case, let's take this offline. Feel free to contact me via email.

Math2126 commented 2 years ago

Hello,

thanks for the fast reply! For my masters thesis I need to analyze some fringe lengths. I'm new to this topic and wanted to know, how you chose the algorithm parameters. The same goes for the selectivity in line 48. For the nmperpix I didn't know where the "(195-31)" came from. I just measured 164 pix for the 5nm size, which equals the same. I'm sorry for the unknowledgment at the moment, but I really wanna understand the code as it is really good for my project.

Regards,

Math

On Tue, Apr 26, 2022 at 11:03 AM Pal Toth @.***> wrote:

Hi,

Not at this time. I’m happy to help you or answer questions though. What exactly are you looking for?

On 2022. Apr 26., Tue at 12:58, Math2126 @.***> wrote:

Hi,

first of all thanks for the code! Do u have some more detailed documentation for the Matlab code?

Regards,

M

— Reply to this email directly, view it on GitHub https://github.com/szkafander/lattice_fringe/issues/2, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKF5JGMYOHR42HOJDR37PNDVHAVFZANCNFSM5UMULWWQ

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/szkafander/lattice_fringe/issues/2#issuecomment-1110096201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY46EEVRXDI7P7SBF32AGNTVHAVXRANCNFSM5UMULWWQ . You are receiving this because you authored the thread.Message ID: @.***>