diff --git a/scripts/extension/registration/apply_registration.py b/scripts/extension/registration/apply_registration.py index 01631ae960195187d961bf4aa3f2cf6d491cf1af..41f6ab6f925cd2d681e2410dc68677a473e9b669 100644 --- a/scripts/extension/registration/apply_registration.py +++ b/scripts/extension/registration/apply_registration.py @@ -123,15 +123,26 @@ def apply_for_file(input_path, output_path, # "elastixDirectory='/g/almf/software/elastix_v4.8', workingDirectory='$TMPDIR', # inputImageFile='$INPUT_IMAGE',transformationFile='/g/cba/exchange/platy-trafos/linear/TransformParameters.BSpline10-3Channels.0.txt # outputFile='$OUTPUT_IMAGE',outputModality='Save as BigDataViewer .xml/.h5',numThreads='1'" - # NOTE: I ommit --run here, because fiji throws a warning that it does not recognise the argument - cmd = [fiji_executable, "--ij2", "--headless", "\"Transformix\"", transformix_argument] + cmd = [fiji_executable, "--ij2", "--headless", "--run", "\"Transformix\"", transformix_argument] cmd_str = " ".join(cmd) fu.log("Calling the following command:") fu.log(cmd_str) + # the elastix wrapper only works properly if we set these as environment variables as well, see + # TODO make issue about this + # os.environ['TMPDIR'] = tmp_folder + os.environ['TRAFO'] = transformation_file + try: - check_output(cmd) + # check_output(cmd) + # the CLI parser is very awkward (to put it nicely). + # I could only get it to work by passing the whole command string + # and setting shell to True. + # otherwise, it would parse something wrong, and do nothing but + # throwing a warning: + # [WARNING] Ignoring invalid argument: --run + check_output([cmd_str], shell=True) except CalledProcessError as e: raise RuntimeError(e.output) diff --git a/test/registration/check_wrapper.py b/test/registration/check_wrapper.py index 12fa5bc92d47c80f93dd8d1a6dd1df1dd8d16bd6..6313f72265db6b9eb6c62ccfe4c6e4b1eaf5494e 100644 --- a/test/registration/check_wrapper.py +++ b/test/registration/check_wrapper.py @@ -9,7 +9,8 @@ from scripts.extension.registration import ApplyRegistrationLocal def check_wrapper(): - in_path = '/g/kreshuk/pape/Work/my_projects/platy-browser-data/registration/9.9.9/images/ProSPr/Stomach_forRegistration.tif' + in_path = os.path.join('/g/kreshuk/pape/Work/my_projects/platy-browser-data/registration/9.9.9/images/ProSPr', + 'Stomach_forRegistration.tif') out_path = '/g/kreshuk/pape/Work/my_projects/dev-platy/test/registration/somach_prospr_registered' in_list = [in_path]