Apparatus is provided, including a plurality of islets, and a hydrogel configured to macroencapsulate the plurality of islets. The hydrogel is implantable in a subcapsular space (21) of a kidney (22) of a subject and is shaped to define a planar configuration. Other applications are also described.