-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest-OMERO.R
37 lines (29 loc) · 1.46 KB
/
test-OMERO.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
setup <- read.csv("setup.csv", comment.char = "#", header = TRUE)
host <- as.character(setup[grep("omero.host", setup$Key, ignore.case=T), ]$Value)
port <- strtoi(setup[grep("omero.port", setup$Key, ignore.case=T), ]$Value)
user <- as.character(setup[grep("omero.user", setup$Key, ignore.case=T), ]$Value)
pass <- as.character(setup[grep("omero.pass", setup$Key, ignore.case=T), ]$Value)
imageID <- strtoi(setup[grep("imageid", setup$Key, ignore.case=T), ]$Value)
datasetID <- strtoi(setup[grep("datasetid", setup$Key, ignore.case=T), ]$Value)
projectID <- strtoi(setup[grep("projectid", setup$Key, ignore.case=T), ]$Value)
nAnnos <- strtoi(setup[grep("numberofannotations", setup$Key, ignore.case=T), ]$Value)
fAnnoName <- as.character(setup[grep("fileannotationname", setup$Key, ignore.case=T), ]$Value)
server <- OMEROServer(host=host, port=port, username=user, password=pass)
server <- connect(server)
image <- loadObject(server, "ImageData", imageID)
test_that("Test OMEROServer getOMEROID",{
id <- getOMEROID(image)
expect_that(id, equals(imageID))
})
test_that("Test OMEROServer getOMEROType",{
typ <- getOMEROType(image)
expect_that(typ, equals('ImageData'))
})
test_that("Test OMEROServer getAnnotations",{
annos <- getAnnotations(image)
expect_that(nrow(annos), equals(nAnnos))
})
test_that("Test OMEROServer getAnnotations specific",{
annos <- getAnnotations(image, typeFilter = 'FileAnnotationData', nameFilter = fAnnoName)
expect_that(nrow(annos), equals(1))
})