Development

The source code is on GitHub


Code structure

pyKNEEr is written in a modular way to favor modifications and extensions. There are three levels of files associated with each step of the workflow:

  1. Jupyter notebooks (.ipynb) representing both a user-interface and a record of the method and results obtained, to be attached to publications

  2. Python scripts for notebooks (for_nb.py) containing functions called by the notebook and used to process images and visualize outputs

  3. Basic python scripts (.py) containing core functions and classes

The figure above shows the code structure. For example, to compute morphology of femoral knee cartilage, the scheme is:

  1. morphology.ipynb: Jupyter notebook used to run computations and visualize results. It uses functions from:

  2. morphology_for_nb.py: python module that contains functions to calculate knee cartilage morphology and visualize results. It uses functions from:

  3. morphology_functions.py: python module that contains the actual algorithms to compute cartilage thickness and volume

Additional packages

pyKNEEr uses:


Variable names

When reading the .txt file at the beginning of each notebook, pyKNEEr creates a dictionary (i.e. a struct) called image_data. In image_data, each cell corresponds to an image and contains an array of strings representing paths, input and output file names, and other information that will be used throughout the whole notebook.

For example, for the demo images the content of the first cell of image_data in the preprocessing.ipynb notebook can be printed out using the commands:

   image_data = io.load_image_data_preprocessing(input_file_name)
   image_data[0] # 0 is the ID of the first image

obtaining the following output:

Folders

Example

original_folder

- /.original

preprocessed_folder

/.preprocessed/

image_folder_file_name

01/DESS/01

File Names

Example

original_file_name

./preprocessed/01_DESS_01_orig.mha

preprocessed_file_name

./preprocessed/01_DESS_01_prep.mha

info_file_name

./preprocessed/01_DESS_01_orig.txt

temp_file_name

./preprocessed/01_DESS_01_temp.mha

Other Information

Example

image_name_root

subject1_DESS

laterality

right


Changelog

Changes in pyKNEEr are described in the readMe file of the GitHub repository


Contributing

Thanks so much for willing to contribute!

The easiest way is to fork the repository from GitHub and then send a pull request.

If you want to coordinate or need any information, do not hesitate to write me at serena dot bonaretti dot research at gmail dot com