I'm not sure if you're allowed to legally 'use the algorithm from cutout filter in one of your modules' and I'm not sure about the copyrights associated. But from what I know, I think nobody (atleast here) will reveal the 'algorithm' used in the filter.

Hi. You’ve posted your question in a forum that is for beginners trying to learn the basics of Photoshop. I'm moving your question to the Photoshop General Discussion forum for specialized attention to your situation.