  One of the main challenges in times of sanitary emergency is to quickly
develop computer aided diagnosis systems with a limited number of available
samples due to the novelty, complexity of the case and the urgency of its
implementation. This is the case during the current pandemic of COVID-19. This
pathogen primarily infects the respiratory system of the afflicted, resulting
in pneumonia and in a severe case of acute respiratory distress syndrome. This
results in the formation of different pathological structures in the lungs that
can be detected by the use of chest X-rays. Due to the overload of the health
services, portable X-ray devices are recommended during the pandemic,
preventing the spread of the disease. However, these devices entail different
complications (such as capture quality) that, together with the subjectivity of
the clinician, make the diagnostic process more difficult and suggest the
necessity for computer-aided diagnosis methodologies despite the scarcity of
samples available to do so. To solve this problem, we propose a methodology
that allows to adapt the knowledge from a well-known domain with a high number
of samples to a new domain with a significantly reduced number and greater
complexity. We took advantage of a pre-trained segmentation model from brain
magnetic resonance imaging of a unrelated pathology and performed two stages of
knowledge transfer to obtain a robust system able to segment lung regions from
portable X-ray devices despite the scarcity of samples and lesser quality. This
way, our methodology obtained a satisfactory accuracy of $0.9761 \pm 0.0100$
for patients with COVID-19, $0.9801 \pm 0.0104$ for normal patients and $0.9769
\pm 0.0111$ for patients with pulmonary diseases with similar characteristics
as COVID-19 (such as pneumonia) but not genuine COVID-19.
