did the patient keep the worms? a morphological examination of them would allow the diagnosis. Did the patient remember the shape, size and colour of the worms? It could be a case Ascaris lumbricoides infection. Alternatively, examination of stools should be performed looking for parasite eggs.
The above responses are very useful in clarifying the problem and providing a solution to the medical problem. Generally speaking this is not strange as there are worms that invade the intestinal lumen like roundworms (nematodes) which can be expelled through the mouth or anus under certain conditions (bowel irritation etc); and also tapeworms. There are other worms of medical importance which invade the skin e.g the filarial worms (Onchocerca) blood (Loa) and the lymphatic system (Wuchereria). The prevalence of the different species would depend on effectiveness of control and prevention campaigns including public hygiene standards and geographical location. Cases of expelling worms through the mouth are very rare these days because of the very successful control and prevention actions, including improved food and personal hygiene.
We described a case of Ascaris worms emerging orally (a known phenomenon in the area concerned) in the shaded box on the first page of the following free access (via the journal's website) publication: Fincham JE, Markus MB, Appleton CC, Evans AC, Arendse VJ, Dhansay MA, Schoeman S. 1998. Complications of worm infestation - serious, costly, predictable and preventable. South African Medical Journal 88 (8): 952-953.
As referred by other colleagues, Ascaris or hookworms are the most probable. However, it will be important to analyze the sputum by direct methods to confirm. Chest X-ray may also be useful.
Many of the nematodes' larvae will pass through the lungs during their migrational phase (about all except Trichuris and Enterobius). However, as you speak about "coughing them up", I suppose you are referring to worms, visible by the naked eye (adults worms then probably). In this case, ascaris (male adult) is most likely. You can confirm it by looking at the mouthparts, using a binocular loupe. Ascarid worms should have three lips. I'll attach a picture!
Pseudoterranova decipiens roundworm larvae are also a possibility, after eating raw or undercooked marine fish. We had a new case in Iceland just two days ago!
Ascariasis is known to migrate when patients are unwell. There are several pictures on google images of them emerging from various orifices... Strongyloides stercoralis could potentially come out in a respiratory tract sample...
Hello, I can not access the uploaded images. But beyond the parasites who have pulmonary cycle and therefore can eliminate larvae, there are those with a large tropism, as the case of Ascaris lumbricoides. Nematodes which has the high portion of the intestine as habitat, can be regurgitated and expelled when present the nausea or the vomiting. It should not be forgotten accidental infections, such as S. laryngeus, among others.
If the worm is macroscopic, Ascars is predicted. Look at the patient'safety history of fever or eating drugs which may stimulate the worm specially Ascaris.
Strongyloides is not usually seen grossly. The locality and history of patient is very important.
Of course, a final answer can be given only after morphometrical analysis of the worm and eventually its eggs, but Ascaris lumbricoides may be coughed up even if its habitat is the intestine. Immature worms/larvae or wondering females may be coughed out or they may get stuck in the throat.