RTK is based on ITK and aims at following its coding conventions. Any developer should follow these conventions when submitting new code or contributions to the existing one. We strongly recommend you reading thoroughly ITK's style guide.
All (new) command-line options in applications must use hyphen-separated lowercase names (for example, output-file), following the glibc convention. This rule applies to both C++ and Python applications. Some existing options not following this style are kept for backward compatibility.
This section describes how to add/edit datasets for testing purposes for RTK. Datasets are not stored in the GIT repository for efficiency and also to avoid having large history due to binary files. Instead, the files are stored on a Girder instance. Here's the recipe to add new datasets:
- Register/Login to Girder hosted at Kitware: http://data.kitware.com
- Locate the RTK collection: https://data.kitware.com/#collection/5a7706878d777f0649e04776
- Upload the new datasets in the appropriate folder. If you do not have the necessary privileges please email the mailing list
- In the GIT repository, add a file in
test/Baselineortest/Inputa file with the exact filename of the original file but with the .md5 extension. Inside that file put the md5sum of the file on Girder. - When adding a test use the new macro
rtk_add_testinstead ofitk_add_testand specify the datasets you want CTest to download by appending the data toDATA{}. For example:
rtk_add_test(NAME rtkimagxtest
COMMAND ${EXECUTABLE\_OUTPUT\_PATH}/rtkimagxtest
DATA{Data/Input/ImagX/raw.xml,raw.raw}
DATA{Data/Baseline/ImagX/attenuation.mha})Alternatively, tests can also be defined in Python. RTK uses pytest for the Python tests and follows its conventions. To add a Python test, create a Python file in the test folder. The name of the file should end in _test.py in order to be automatically picked up by pytest. Then create a test function whose name starts with test_. This function will be automatically executed when running pytest. For example:
def test_IsIntersectedByRay():
q = rtk.QuadricShape.New()
radius = 10
q.SetA(1)
q.SetB(1)
q.SetC(1)
q.SetJ(-(radius**2))
res = q.IsIntersectedByRay([-20, 0, 0], [1, 0, 0])
assert isinstance(res, (list, tuple)) and len(res) >= 3- The RTK dashboard is available at RTK Dashboard