A method for providing phototherapy to a GI tract including using a capsule imager to scan at least a portion of a GI tract, estimating a location of a diseased portion of the GI tract, and based, at least in part, on the estimated location, using a phototherapy capsule to provide phototherapeutic light to the diseased portion.A swallowable capsule for providing phototherapy to a GI tract including a power supply, a camera unit, one or more light sources emitting in a range including visible and Near Infra Red (NIR), and a control unit for calculating an effective dose to the GI tract by controlling the one or more light sources, a communication unit for transmitting images from the camera unit to an out-of-body receiver and for receiving control commands from an out-of-body transmitter.Related apparatus and methods are also described.