diff --git a/.github/create_macro.py b/.github/create_macro.py index 91f4e3f6..f0884c61 100644 --- a/.github/create_macro.py +++ b/.github/create_macro.py @@ -21,11 +21,25 @@ from io.bioimage.modelrunner.bioimageio import BioimageioRepo from io.bioimage.modelrunner.bioimageio.description import ModelDescriptorFactory from io.bioimage.modelrunner.utils import Constants +from io.bioimage.modelrunner.numpy import DecodeNumpy + +from deepimagej.tools import ImPlusRaiManager + +from ij import IJ import os import argparse MACRO_STR = "run(\"DeepImageJ Run\", \"modelPath={model_path} inputPath={input_path} outputFolder={output_folder} displayOutput=null\")" +CREATED_SAMPLE_NAME = "sample_input_0.tif" + + +def convert_npy_to_tif(folder_path, test_name, axesOrder): + rai = DecodeNumpy.loadNpy(os.path.join(folder_path, test_name)) + imp = ImPlusRaiManager.convert(rai, axesOrder) + out_path = os.path.join(folder_path, CREATED_SAMPLE_NAME) + IJ.saveAsTiff(imp, out_path) + # Create the argument parser parser = argparse.ArgumentParser() @@ -73,6 +87,12 @@ def parse_model_paths(models): print(mfp) descriptor = ModelDescriptorFactory.readFromLocalFile(os.path.join(mfp, Constants.RDF_FNAME)) sample_name = descriptor.getInputTensors().get(0).getSampleTensorName() + if sample_name is None: + test_name = descriptor.getInputTensors().get(0).getTestTensorName() + if test_name is None: + continue + convert_npy_to_tif(mfp, test_name, descriptor.getInputTensors().get(0).getAxesOrder()) + sample_name = CREATED_SAMPLE_NAME macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp) file.write(macro + os.linesep) diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index f73c085d..d9b22276 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -7,8 +7,7 @@ on: branches: [ master ] env: - MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger" - #MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger, laid-back-lobster" + MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger, laid-back-lobster" jobs: integration-tests: diff --git a/scripts/download_engines.py b/scripts/download_engines.py index 69701103..8dbff0ee 100644 --- a/scripts/download_engines.py +++ b/scripts/download_engines.py @@ -23,7 +23,6 @@ import argparse import sys -print("All arguments (including script name): {}".format(sys.argv)) # Create the argument parser parser = argparse.ArgumentParser()