DicomDatabase: faster databaseForContext function