This technique could lead to treatments for conditions like depression.