The Flywheel reaper queries the scanner at regular intervals for new data items. It examines the available items and decides whether they are ready to be entered into the Flywheel database. MR scanners take some time to acquire and reconstruct data. To avoid reaping while acquisition and reconstruction are in process, the reaper monitors the data, waiting until they are no longer changing.
The reaper checks the "state" of an "item" to see if it has "changed". For DICOM, an item is a Series (defined by SeriesInstanceUID), state is the number of images in that series (NumberOfSeriesRelatedInstances), and change is an increase in that number.
The reaper tests when a DICOM Series is ready for entering the database using this logic:
- Has the number of files for this item changed since the last time it checked? If yes, it assumes the scan is still in progress and waits.
- If the item has not changed since the last time it checked, has it already been reaped? If yes, wait.
- If the item hasn't changed and hasn't already been reaped, it is reaped; it will continue to be monitored.
- An automatic re-reap is triggered by a change of state of a monitored and previously reaped item.
N.B. The definitions for "item", "state", and "change" vary for different data types or modalities.