A 35-year-old Aboriginal woman from a remote community reports a chronic productive cough with daily green sputum and dyspnoea on exertion. She has had multiple episodes of "chest infections" treated with oral antibiotics since childhood. On examination she has widespread coarse crackles and digital clubbing. Chest X-ray suggests ring shadows at the lung bases. What is the most appropriate investigation to confirm the suspected diagnosis?