A new iterative algorithm for pixilated and continuous scintillating crystal