Development of spatial algorithms to generate digital images of microstructures