flowchart TD
Start([開始]) --> IncCount[累加掃描影像計數]
IncCount --> ModeCheck{檢查掃描模式}
ModeCheck -- 新案 (smNew) --> NewMode[根據顯示模式尋找 ISB 並載入影像]
ModeCheck -- 取代 (smReplace) --> ReplaceMode[將影像載入當前顯示的 ISB]
ModeCheck -- 插入 (smInsert) --> InsertMode[尋找 ISB 並以符合頁面模式載入影像]
ModeCheck -- 範本 (smSample) --> SampleMode[尋找 ISB 並載入影像]
NewMode --> End([結束])
ReplaceMode --> End
InsertMode --> End
SampleMode --> End