It makes sense to test each Aivia recipe on four distinct cases with different image dimensions:
- 2D image
- 2D image with time
- 3D image
- 3D image with time
- RGB image
When you propose to add a recipe to our repository, we recommend testing it on each of the four examples images in this /TestData/ folder to cover each of these use cases. To keep track of your work, please feel free to create an issue or pull request with check boxes for each of these test cases. Copy/paste the following code into the issue or pull request to format this correctly:
- [ ] Tested in 2D
- [ ] Tested in 2D+T
- [ ] Tested in 3D
- [ ] Tested in 3D+T
See an example of an enhancement issue for adding a new Python recipe to the repository here.
Note that not all scripts need to pass these tests to be added. In some cases, your script may not apply to images of certain dimensions (e.g. an "in-place maximum intensity projection" recipe only makes sense in 3D). This is OK! Please explain which cases are not applicable, and preferably use a try/catch or if/else structure to report these issues to the user in the Aivia log.
To execute unittests on Windows, open Terminal/Powershell and navigate into the PythonEnvForAivia folder. Make sure you have already set up the python environment using FirstTimeSetup.py. See PythonEnvForAivia/README.md#installation for more details.
To run all tests, run the command:
python -m unittest discover .To run all tests and output info and errors to a file, run the command:
python -m unittest discover -v . > unittest_results.txt 2>&1To run tests on the folders of recipes (for example, all recipes under ProcessImages), run the command:
python -m unittest discover Tests\ProcessImagesTo run specific tests (for example, AdjustGamma.py), run the command:
python -m unittest Tests.ProcessImages.test_AdjustGammaRunning tests will result in each recipe's respective output to be saved to a folder called GroundTruth/RECIPE_NAME/outputs/, which is then cross referenced against GroundTruth/RECIPE_NAME/ground_truth/
- InputTestImages: All input images for tests are stored here
- utils: Common functions shared across all tests are stored here.
Tests mimic the folder structure of Recipes. Each family (directory) of recipes has the following structure (an example for AdjustGamma.py is provided below:
ProcessImages
├── GroundTruths # Contains ground truth images and outputs
│ │ # of ALL unit tests
│ ├── AdjustGamma # Contains ground truth images and outputs
│ │ │ # of only AdjustGamma unit tests
│ │ ├── ground_truth #
│ │ └── outputs #
│ └── ...
├── TestConfigs # Contains all .json configuration files for all tests
│ # The json config for AdjustGamma is titled:
│ # AdjustGamma_configs.json.
│ # All Configs have the suffix "_configs.json."
└── test_AdjustGamma.py # Unit tests for AdjustGamma recipe

