Program for microstructure photographs analysis and particles dimensions evaluation
- Run structure_editor.py
- Open structure image
- Create markup
- Build and export histogram
Program has classic window with all tools in Top Menu.
Use "File" -> "Open" to select structure image. Only one image can be opened at a time.
Markup Tools are available at "Selection" -> "Create Selection" section.
After creating markup you can edit it with tools from "Selection" -> "Edit Selection" section.
When markup is done and unit line is selected use "Statistics" -> "Build Graph and Table" to create histogram and table with structures discription.
Use "Statistics" -> "Save graph" to export histogram in *.png *.bmp *.jpg *.jpeg formats.
Use "Statistics" -> "Save table" to export table in *.png *.csv formats.
You can navigate between pages by selecting tab on the top.
-
"Circle selection".
Use this tool to select circle shaped structures like spheres. Press at structure's center and drag the circle to the border. -
"Circle selection with outodetection".
Use this tool to select one circle and program will detect all circles with +-15% radius. -
"Select all circles".
This tool selects circles of all radii. For this option it is better to use the "Distance transform" method. -
"Ellipse selection".
Use this tool to select ellipse shaped structures. Press and drag the first axis from begin to end. Press and drag the second axis, it will be drawn perpendicular in the middle automatically. -
"Polyhedron selection".
Use this tool to select polyhedron shaped structures. Create edges by press and drag from one vertex to other. When you when you bring the end to an already existing vertex, it is automatically connected.
When you are done click "Finish" botton on the top. Select bounding figure and draw it. Parameters of drawn bounding figure will be used in table. -
"Amorphous selection".
Use this tool to select amorphous structures. Use cursor to draw a bounder by hand. Than select bounding figure or choose option to use area of hand-drawn figure. -
"Select unit line".
Use this tool to select unit line. Press and drag to drow line above unit line. Than enter its length and scale (you can type in whatever you want).
-
"Distance Transform" is used to detect touching and overlapping circles in flat pictures. Algorithm uses distanceTransform OpenCV method. More explanation is available in this question.
-
"Filter2d" is used for non-flat (spherical) structures in noisy pictures with shadows. It uses FIlter2D OpenCV method to convert image and match it with sample. Note: you might try use other kernel matrix and circle sample radius to apply it in your scenes. More explanation is available in this question.
-
"HoughCircles" is used with simple scenes. It uses HoughCircle OpenCV transform.
Histogram is creating with seaborn.displot
Data that is used for it is presented in the Table.
You can export histogram in *.png *.bmp *.jpg *.jpeg fromats.
Use PyInstaller to create an executable from Python project. Example manual.
Notes
I've faced false-trojan warnings on Windows system. I managed to solve it with this answer and this step-by-step manual. Also, make sure that you have all Python dependencies installed.
# MacOS
python3.8 -m PyInstaller \
--clean \
--onefile \
--windowed \
--add-data 'config.json:.' \
-i "icons/icns/icon5_1.icns" \
-n 'Structure Editor' \
structure_editor.py
# Windows
PyInstaller \
--clean \
--onefile \
--windowed \
--add-data 'config.json;.' \
-i 'icons\icns\icon5_1.icns' \
-n 'Structure Editor' \
'structure_editor.py'On MacOS make sure you disabled GateKeeper to allow programms from unverified developers to run created application.
Program is registered with the Federal Service on Intellectual Property Registration form RU 2022663303