You cannot implement such low-level image processing in Python. They would be way too slow. For example to iterate through a tiny 100x100x100 image you would do 1 million iterations. In C++ or other low-level languages this would take a fraction of a second, while in Python in can take minutes.
Instead, you need to think about how you can implement a feature using high-level operations. For example, you can do the projection that you described above by copying the entire shape shifted by one pixel, repeated 100 times, and it would be magnitudes faster than implement iterating through each pixel of the image.
I guess you are still working on this:
I would recommend to have a look at the existing Slicer module for almost the same task (GitHub - PerkLab/BreastReconstruction: Tool for breast reconstruction surgery planning) because we already have this kind of projection implemented in it.