From 975cc6b3b4c90a46f65e51da0bc2f346fce14818 Mon Sep 17 00:00:00 2001
From: Constantin Pape <constantin.pape@iwr.uni-heidelberg.de>
Date: Fri, 20 Sep 2019 16:54:31 +0200
Subject: [PATCH] Add simpler check for registration wrapper

---
 test/registration/check_wrapper.py | 39 +++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/test/registration/check_wrapper.py b/test/registration/check_wrapper.py
index 6313f72..5052cfe 100644
--- a/test/registration/check_wrapper.py
+++ b/test/registration/check_wrapper.py
@@ -8,6 +8,42 @@ sys.path.insert(0, '../..')
 from scripts.extension.registration import ApplyRegistrationLocal
 
 
+def check_wrapper_simple():
+    in_path = '/g/almf/software/elastix-test/muscles.tif'
+
+    tmp_folder = '/g/kreshuk/pape/Work/my_projects/dev-platy/test/registration/tmp_registration_simple'
+    out_path = os.path.join(tmp_folder, 'out')
+
+    in_list = [in_path]
+    out_list = [out_path]
+    in_file = './in_list.json'
+    with open(in_file, 'w') as f:
+        json.dump(in_list, f)
+    out_file = './out_list.json'
+    with open(out_file, 'w') as f:
+        json.dump(out_list, f)
+
+    task = ApplyRegistrationLocal
+    conf_dir = './configs'
+    os.makedirs(conf_dir, exist_ok=True)
+
+    global_conf = task.default_global_config()
+    shebang = '/g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python'
+    global_conf.update({'shebang': shebang})
+    with open(os.path.join(conf_dir, 'global.config'), 'w') as f:
+        json.dump(global_conf, f)
+
+    trafo = '/g/almf/software/elastix-test/TransformParameters.RotationPreAlign.0.txt'
+    t = task(tmp_folder=tmp_folder, config_dir=conf_dir, max_jobs=1,
+             input_path_file=in_file, output_path_file=out_file, transformation_file=trafo)
+    ret = luigi.build([t], local_scheduler=True)
+    assert ret
+    expected_out_xml = out_path + '.xml'
+    assert os.path.exists(expected_out_xml), expected_out_xml
+    expected_out_h5 = out_path + '.h5'
+    assert os.path.exists(expected_out_h5), expected_out_h5
+
+
 def check_wrapper():
     in_path = os.path.join('/g/kreshuk/pape/Work/my_projects/platy-browser-data/registration/9.9.9/images/ProSPr',
                            'Stomach_forRegistration.tif')
@@ -43,4 +79,5 @@ def check_wrapper():
     assert os.path.exists(expected_out), expected_out
 
 
-check_wrapper()
+# check_wrapper()
+check_wrapper_simple()
-- 
GitLab