What is the cause of pulmonary edema?

Pulmonary edema is caused either because of direct injury to lung parenchyma or because of the heart's inability to function adequately which then later forces fluids into the air sacs of the lungs.