I would like to look at the code that implements
FillingTransform. Does Mathematica provide any way to do this?
In general, @Jacob Akkerboom is correct: one cannot usually view the source code for arbitrary Mathematica functions. In this particular case, however, we find an exception.
FillingTransform (* trigger auto-load *) ClearAttributes[FillingTransform, ReadProtected] Begin["Image`MorphologicalOperationsDump`"] Information[FillingTransform]
we observe a call to
iFillingTransform (i.e. the implementation of
FillingTransform; this naming convention is commonly encountered among recently added functions). Thereafter,
reveals a number of checks on the arguments and setup for a call to
oFillingTransform. If one does
then the complete implementation becomes visible. Although I won't reproduce that here for obvious reasons, the basic idea is a combination of
GeodesicDilation with some image arithmetic to mask off each hole in turn.