Watershed segmentation

Hi there! I would like to know how Watershed algorithm computes on 3D images, like CT images using Segment Editor extension. Does it go through every 2D layer on the register or does it computes all the image register? Some repository where I can found the code?

Thank you so much!