Image analysis of polycrystalline solar cells and modeling of intergranular and transgranular cracking