Applications of optimization to medical imaging