# Strategy 1: Drop — remove unreadable or empty images def is_valid_image(path): try: img = cv2.imread(path, cv2.IMREAD_GRAYSCALE) if img is None: return False if img.mean() < 5: # nearly black return False if img.shape[0] < 50 or img.shape[1] < 50: # too small return False return True except Exception: return False # Strategy 2: Impute — rare for images, but possible (e.g., in painting to fill in missing patches). Generally avoided for diagnostic data. # Strategy 3: Flag — track which patients are missing which modalities, # and let the model condition on availability. Common in multi-modal healthcare ML.