The present invention relates to methods for producing an aerosol and may be useful in chemical, petrochemical and pharmaceutical industries, as well as in household applications, in medicine. The image processor has various editing routines, including a segmentation routine that builds a graph associated with the image and uses a graph cut algorithm to cut the graph into segments. Any particular stage of the multiple stage path resolution may be skipped under certain conditions.