If you can find a way to convert $I(d)$ into $I(x)$, where $x$ is the spatial coordinate, then you can simply define an expression with $I$ as your right hand side. As an example: suppeose that $I(x) = exp(-||x||^2)$. then your code would have to be
f = Expression('exp(-x[0]^2 - x[1]^2)')
a = ... # define bilinar form
L =f*dx
after that, you simply call the solver routines of your choice.
Two more remarks:
* I'm not 100% sure about the Expression()
syntax but can't test it because it is broken on my computer
* To the best of my knowledge converting $I(d)$ into $I(x)$ for arbitrary geometries can only be achieved by solving the so-called eikonal equation. Note the part in the introduction of the wikipedia page where it says "In the special case when $F=1$, the solution gives the signed distance from $\partial \Omega$"