We
describe an open-source and widely adaptable Python library
that recognizes morphological features and domains in images collected
via scanning probe microscopy. π-Conjugated polymers (CPs) are
ideal for evaluating the Materials Morphology Python (m2py) library
because of their wide range of morphologies and feature sizes. Using
thin films of nanostructured CPs, we demonstrate the functionality
of a general m2py workflow. We apply numerical methods to enhance
the signals collected by the scanning probe, followed by Principal
Component Analysis (PCA) to reduce the dimensionality of the data.
Then, a Gaussian Mixture Model segments every pixel in the image into
phases, which have similar material-property signals. Finally, the
phase-labeled pixels are grouped and labeled as morphological domains
using either connected components labeling or persistence watershed
segmentation. These tools are adaptable to any scanning probe measurement,
so the labels that m2py generates will allow researchers to individually
address and analyze the identified domains in the image. This level
of control, allows one to describe the morphology of the system using
quantitative and statistical descriptors such as the size, distribution,
and shape of the domains. Such descriptors will enable researchers
to quantitatively track and compare differences within and between
samples.