
Find and filter patients using predicate functions
Source:R/filtering.R
find_and_filter_patients.RdFind desired Patient/Study/Series/Instance in an Orthanc server. Predicate
functions (filters) take a single Patient/Study/Series/Instance as the
first argument and return a single TRUE or FALSE for whether the
resource should be kept or discarded, respectively. If mirai::daemons()
has been used to set persistent background processes, this function will
apply filters in parallel (over patients) using all available processes.
Usage
find_and_filter_patients(
client,
patient_filter = NULL,
study_filter = NULL,
series_filter = NULL,
instance_filter = NULL,
progress = rlang::is_interactive(),
...
)Arguments
- client
Orthanc client.
- patient_filter
Predicate function to filter Patients.
- study_filter
Predicate function to filter Studys.
- series_filter
Predicate function to filer Series.
- instance_filter
Predicate function to filter Instances.
- progress
Whether to show progress bars. By default, progress bars are enabled in interactive sessions (i.e., if
rlang::is_interactive()returnsTRUE).- ...
Named-arguments to declare in the environment of the predicate functions, if performing filtering in parallel with
mirai. If your predicate functions require access to objects in the global environment, ] you must pass them to...so they are available on each background worker when running in parallel (i.e., whenmirai::daemons()has been set).
Value
A list of filtered Patients.
Details
This function builds a series of tree structures. Each tree corresponds to a patient. The layers in the tree correspond to:
Patient -> Studies -> Series -> Instances
Examples
if (FALSE) { # \dontrun{
client <- Orthanc$new("https://orthanc.uclouvain.be/demo")
find_and_filter_patients(
client = client,
patient_filter = \(pt) pt$is_stable
)
} # }