Skip to content

Commit

Permalink
Add key value pair template
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-TBT committed Apr 4, 2024
1 parent 4d9e9bb commit 2b1e922
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// @String(label="Username") USERNAME
// @String(label="Password", style='password', persist=false) PASSWORD
// @String(label="Host", value='wss://workshop.openmicroscopy.org/omero-ws') HOST
// @Integer(label="Port", value=443) PORT
// @Integer(label="Dataset ID", value=2331) dataset_id

run("OMERO Extensions");

connected = Ext.connectToOMERO(HOST, PORT, USERNAME, PASSWORD);

if(connected == "true") {
// Read all key value pairs from a dataset
kvs_dataset = Ext.getKeyValuePairs("dataset", dataset_id);

// Default separator is a TAB
kvs_dataset = split(kvs_dataset, "\t");
// ! If some cells are empty, split will ignore the double separators
// -> add a space between them first with replace(kvs_dataset, "\t\t", "\t \t");

for(j=0; j<kvs_dataset.length; j=j+2){
// Every even index is the key, every odd index is the value
print(kvs_dataset[j] + ": " + kvs_dataset[j+1]);
}

images = Ext.list("images", "dataset", dataset_id);
image_ids = split(images, ",");
for(i=0; i<image_ids.length; i++) {
// Read from each image the value associated to the "condition" key
condition_image = Ext.getValue("image", image_ids[i], "condition");
print(condition_image);
}
}

Ext.disconnect();
print("processing done");

0 comments on commit 2b1e922

Please sign in to comment.