Noninvasive optical characterization of hydrogels