From f5c8a30d6bc60f1637b22314685dd095aa6f48ec Mon Sep 17 00:00:00 2001
From: kaloyane <kaloyane>
Date: Wed, 11 May 2011 12:35:06 +0000
Subject: [PATCH] minor: add default jython dropbox for installer

SVN: 21236
---
 .../installer/dropboxes/simple-dropbox.py     | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/screening/dist/installer/dropboxes/simple-dropbox.py b/screening/dist/installer/dropboxes/simple-dropbox.py
index e69de29bb2d..be28a70d26a 100644
--- a/screening/dist/installer/dropboxes/simple-dropbox.py
+++ b/screening/dist/installer/dropboxes/simple-dropbox.py
@@ -0,0 +1,30 @@
+#! /usr/bin/env python
+# This is an example Jython dropbox for importing HCS image datasets
+ 
+import os
+from ch.systemsx.cisd.openbis.dss.etl.dto.api.v1 import *
+     
+class MyImageDataSetConfig(SimpleImageDataConfig):
+    def extractImageMetadata(self, imagePath):
+        image_tokens = ImageMetadata()
+     
+        basename = os.path.splitext(imagePath)[0]
+        token_dict = {}
+        for token in basename.split("_"):
+            token_dict[token[:1]] = token[1:]
+         
+        image_tokens.well = token_dict["w"]
+        fieldText = token_dict["s"]
+        try:
+            image_tokens.tileNumber = int(fieldText)
+        except ValueError:
+            raise Exception("Cannot parse field number from '" + fieldText + "' in '" + basename + "' file name.")
+     
+        image_tokens.channelCode = token_dict["c"]
+        return image_tokens
+ 
+if incoming.isDirectory():
+    imageDataset = MyImageDataSetConfig()
+    imageDataset.setRawImageDatasetType()
+    imageDataset.setPlate("MY-SPACE", incoming.getName())
+    factory.registerImageDataset(imageDataset, incoming, service)
-- 
GitLab