pyKNEEr: An image analysis workflow for open and reproducible research on femoral knee cartilage

Autoři: Serena Bonaretti aff001;  Garry E. Gold aff001;  Gary S. Beaupre aff002
Působiště autorů: Department of Radiology, Stanford University, Stanford, CA, United States of America aff001;  Musculoskeletal Research Laboratory, VA Palo Alto Health Care System, Palo Alto, CA, United States of America aff002;  Department of Bioengineering, Stanford University, Stanford, CA, United States of America aff003
Vyšlo v časopise: PLoS ONE 15(1)
Kategorie: Research Article
doi: 10.1371/journal.pone.0226501


Transparent research in musculoskeletal imaging is fundamental to reliably investigate diseases such as knee osteoarthritis (OA), a chronic disease impairing femoral knee cartilage. To study cartilage degeneration, researchers have developed algorithms to segment femoral knee cartilage from magnetic resonance (MR) images and to measure cartilage morphology and relaxometry. The majority of these algorithms are not publicly available or require advanced programming skills to be compiled and run. However, to accelerate discoveries and findings, it is crucial to have open and reproducible workflows. We present pyKNEEr, a framework for open and reproducible research on femoral knee cartilage from MR images. pyKNEEr is written in python, uses Jupyter notebook as a user interface, and is available on GitHub with a GNU GPLv3 license. It is composed of three modules: 1) image preprocessing to standardize spatial and intensity characteristics; 2) femoral knee cartilage segmentation for intersubject, multimodal, and longitudinal acquisitions; and 3) analysis of cartilage morphology and relaxometry. Each module contains one or more Jupyter notebooks with narrative, code, visualizations, and dependencies to reproduce computational environments. pyKNEEr facilitates transparent image-based research of femoral knee cartilage because of its ease of installation and use, and its versatility for publication and sharing among researchers. Finally, due to its modular structure, pyKNEEr favors code extension and algorithm comparison. We tested our reproducible workflows with experiments that also constitute an example of transparent research with pyKNEEr, and we compared pyKNEEr performances to existing algorithms in literature review visualizations. We provide links to executed notebooks and executable environments for immediate reproducibility of our findings.

Klíčová slova:

Algorithms – Cartilage – Image analysis – Knees – Osteoarthritis – Preprocessing – Programming languages – Reproducibility


1. Collins FS, Tabak LA. NIH plans to enhance reproducibility. Nature. 2014;505(7485):612–613. 24482835

2. Commission TE. Commission recommendations of 17 July 2012 on access to and preservation of scientific information; 2012.

3. Woelfle M, Olliaro P, Todd MH. Open science is a research accelerator. Nature Chemistry. 2011;3(10):745–748. doi: 10.1038/nchem.1149 21941234

4. Bollen K, Cacioppo JT, Kaplan R, Krosnick J, Olds JL. Social, behavioral, and economic sciences perspectives on robust and reliable science; 2015.

5. Sandve GK, Nekrutenko A, Taylor J, Hovig E. Ten simple rules for reproducible computational research. PLoS Computational Biology. 2013;9(10):1–4. doi: 10.1371/journal.pcbi.1003285

6. Rule A, Birmingham A, Zuniga C, Altintas I, Huang SC, Knight R, et al. Ten simple rules for reproducible research in Jupyter notebooks. arXiv:181008055. 2018.

7. Prlić A, Procter JB. Ten simple rules for the open development of scientific software. PLoS Computational Biology. 2012;8(12):8–10.

8. Donoho DL, Maleki A, Rahman IU, Shahram M, Stodden V. Reproducible research in computational harmonic analysis. Comput Sci Eng. 2009;11(1):8–18. doi: 10.1109/MCSE.2009.15

9. Munafò MR, Nosek BA, Bishop DVM, Button KS, Chambers CD, Percie N, et al. A manifesto for reproducible science. Nature Publishing Group. 2017;1(January):1–9.

10. Pérez F, Granger BE. IPython: a System for Interactive Scientific Computing. Computing in Science and Engineering. 2007;9(3):21–29. doi: 10.1109/MCSE.2007.53

11. Kluyver T, Ragan-Kelley B, Pérez F, Granger B, Bussonnier M, Frederic J, et al. Jupyter Notebooks—a publishing format for reproducible computational workflows. In: Loizides F, Schmidt B, editors. Positioning and Power in Academic Publishing: Players, Agents and Agendas. IOS Press; 2016. p. 87–90.

12. R Core Team. R: A Language and Environment for Statistical Computing; 2013. Available from:

13. Jupyter P, Bussonnier M, Forde J, Freeman J, Granger B, Head T, et al. Binder 2.0—Reproducible, interactive, sharable environments for science at scale. In: Proceedings of the 17th Python in Science Conference. Scipy; 2018. p. 113–120. Available from:{_}jupyter.html.

14. Claerbout JF, Karrenbach M. Electronic documents give reproducible research a new meaning. SEG Technical Program Expanded Abstracts 1992. 1992;11(1):601–604. doi: 10.1190/1.1822162

15. Gil Y, David CH, Demir I, Essawy BT, Fulweiler RW, Goodall JL, et al. Toward the geoscience paper of the future: Best practices for documenting and sharing research from data to software to provenance. Earth and Space Science. 2016;3(10):388–415. doi: 10.1002/2015EA000136

16. Gundersen OE, Gil Y, Aha DW. On reproducible AI: Towards reproducible research, open science, and digital scholarship in AI publications. AI Magazine. 2017;39(3):56–68. doi: 10.1609/aimag.v39i3.2816

17. Poldrack RA, Baker CI, Durnez J, Gorgolewski KJ, Matthews PM, Munafò MR, et al. Scanning the horizon: Towards transparent and reproducible neuroimaging research. Nature Reviews Neuroscience. 2017;18(2):115–126. doi: 10.1038/nrn.2016.167 28053326

18. Hafezi-Nejad N, Demehri S, Guermazi A, Carrino JA. Osteoarthritis year in review 2017: updates on imaging advancements. Osteoarthritis and Cartilage. 2018;26(3):341–349. doi: 10.1016/j.joca.2018.01.007 29330100

19. Woolf AD, Pfleger B. Burden of major musculoskeletal conditions. Bulletin of the World Health Organization. 2003;81(9):646–656. 14710506

20. Palazzo C, Ravaud JF, Papelard A, Ravaud P, Poiraudeau S. The burden of musculoskeletal conditions. PLoS ONE. 2014;9(3):e90633. doi: 10.1371/journal.pone.0090633 24595187

21. Martel-Pelletier J, Barr AJ, Cicuttini FM, Conaghan PG, Cooper C, Goldring MB, et al. Osteoarthritis. Nature Reviews Disease Primers. 2016;2:1–18. doi: 10.1038/nrdp.2016.72

22. Hunter DJ, Schofield D, Callander E. The individual and socioeconomic impact of osteoarthritis. Nature Reviews Rheumatology. 2014;10(7):437–441. doi: 10.1038/nrrheum.2014.44 24662640

23. Eckstein F, Boudreau R, Wang Z, Hannon MJ, Duryea J, Wirth W, et al. Comparison of radiographic joint space width and magnetic resonance imaging for prediction of knee replacement: A longitudinal case-control study from the Osteoarthritis Initiative. European Radiology. 2016;26(6):1942–1951. doi: 10.1007/s00330-015-3977-8 26376884

24. Schaefer LF, Sury M, Yin M, Jamieson S, Donnell I, Smith SE, et al. Quantitative measurement of medial femoral knee cartilage volume – analysis of the OA Biomarkers Consortium FNIH Study cohort. Osteoarthritis and Cartilage. 2017;25(7):1107–1113. doi: 10.1016/j.joca.2017.01.010 28153788

25. Li X, Benjamin Ma C, Link TM, Castillo DD, Blumenkrantz G, Lozano J, et al. In vivo T1ρ and T2 mapping of articular cartilage in osteoarthritis of the knee using 3 T MRI. Osteoarthritis and Cartilage. 2007;(15):789–797. doi: 10.1016/j.joca.2007.01.011 17307365

26. Monu UD, Jordan CD, Samuelson BL, Hargreaves BA, Gold GE, McWalter EJ. Cluster analysis of quantitative MRI T2 and T1rho relaxation times of cartilage identifies differences between healthy and ACL-injured individuals at 3T. Osteoarthritis and Cartilage. 2017;25(4):513–520. doi: 10.1016/j.joca.2016.09.015 27720806

27. Liukkonen MK, Mononen ME, Tanska P, Saarakkala S, Nieminen MT, Korhonen RK. Application of a semi-automatic cartilage segmentation method for biomechanical modeling of the knee joint. Computer Methods in Biomechanics and Biomedical Engineering. 2017;20(13):1453–1463. doi: 10.1080/10255842.2017.1375477 28895760

28. Heimann T, Morrison B. Segmentation of knee images: A grand challenge. Proc Medical Image Analysis for the Clinic: A Grand Challenge Bejing, China. 2010; p. 207–214.

29. Pedoia V, Majumdar S, Link TM. Segmentation of joint and musculoskeletal tissue in the study of arthritis. Magnetic Resonance Materials in Physics, Biology and Medicine. 2016. doi: 10.1007/s10334-016-0532-9

30. Zhang B, Zhang Y, Cheng HD, Xian M, Gai S, Cheng O, et al. Computer-aided knee joint magnetic resonance image segmentation—A survey. biorxiv = 1180204894v1. 2018.

31. Wang Q, Wu D, Lu L, Liu M, Boyer KL, Zhou SK. Semantic context forests for learning-based knee cartilage segmentation in 3D MR images. In: Springer, editor. Medical Computer Vision. Large Data in Medical Imaging Lecture Notes in Computer Science. Newyork; 2013. p. 105–115. Available from:{%}0A{_}11.

32. Shan L, Zach C, Charles C, Niethammer M. Automatic atlas-based three-label cartilage segmentation from MR knee images. Medical Image Analysis. 2014;18(7):1233–1246. doi: 10.1016/ 25128683

33. Avants BB, Tustison NJ, Song G, Cook PA, Klein A, Gee JC. A reproducible evaluation of ANTs similarity metric performance in brain image registration. NeuroImage. 2011;54(3):2033–2044. doi: 10.1016/j.neuroimage.2010.09.025 20851191

34. Fischl B, Salat DH, Busa E, Albert M, Dieterich M, Haselgrove C, et al. Whole brain segmentation: automated labeling of neuroanatomical structures in the human brain. Neuron. 2002;33(3):341–355. doi: 10.1016/s0896-6273(02)00569-x 11832223

35. Gorgolewski K, Burns CD, Madison C, Clark D, Halchenko YO, Waskom ML, et al. Nipype: A flexible, lightweight and extensible neuroimaging data processing framework in python. Frontiers in Neuroinformatics. 2011;5(August). doi: 10.3389/fninf.2011.00013 21897815

36. Van Erp TGM, Hibar DP, Rasmussen JM, Glahn DC, Pearlson GD, Andreassen OA, et al. Subcortical brain volume abnormalities in 2028 individuals with schizophrenia and 2540 healthy controls via the ENIGMA consortium. Molecular Psychiatry. 2016;21(4):547–553. doi: 10.1038/mp.2015.63 26033243

37. Lawson GM, Duda JT, Avants BB, Wu J, Farah MJ. Associations between children’s socioeconomic status and prefrontal cortical thickness. Developmental Science. 2013;16(5):641–652. doi: 10.1111/desc.12096 24033570

38. Doehrmann O, Ghosh SS, Polli FE, Reynolds GO, Horn F, Keshavan A, et al. Predicting treatment response in social anxiety disorder from functional magnetic resonance imaging. Archives of General Psychiatry. 2013;70(1):87–97.

39. Amberg M, Luthi M, Vetter T. Fully automated segmentation of the knee using local deformation-model fitting. In: MICCAI 2010 Workshop Medical Image Analysis for the Clinic—A Grand Challenge (SKI10); 2010. p. 251–260. Available from:{~}bram/grandchallenge2010/251.pdf.

40. Carballido-Gamio J, Bauer JS, Stahl R, Lee KY, Krause S, Link TM, et al. Inter-subject comparison of MRI knee cartilage thickness. Medical Image Analysis. 2008;12(2):120–135. doi: 10.1016/ 17923429

41. Solloway S, Hutchinson CE, Waterton JC, Taylor CJ. The use of active shape models for making thickness measurements of articular cartilage from MR images. Magnetic resonance in medicine. 1997;37(6):943–952. doi: 10.1002/mrm.1910370620 9178247

42. Vincent G, Wolstenholme C, Scott I, Bowes M. Fully automatic segmentation of the knee joint using active appearance models. MICCAI 2010 Workshop Medical Image Analysis for the Clinic—A Grand Challenge (SKI10). 2011.

43. Williams TG, Holmes AP, Waterton JC, MacIewicz RA, Hutchinson CE, Moots RJ, et al. Anatomically corresponded regional analysis of cartilage in asymptomatic and osteoarthritic knees by statistical shape modelling of the bone. IEEE Transactions on Medical Imaging. 2010;29(8):1541–1559. doi: 10.1109/TMI.2010.2047653 20378463

44. Pedoia V, Li X, Su F, Calixto N, Majumdar S. Fully automatic analysis of the knee articular cartilage T 1ρ relaxation time using voxel-based relaxometry. Journal of Magnetic Resonance Imaging. 2015;43:970–980. doi: 10.1002/jmri.25065 26443990

45. Tamez-Peña JG, Farber J, González PC, Schreyer E, Schneider E, Totterman S. Unsupervised segmentation and quantification of anatomical knee features: Data from the osteoarthritis initiative. IEEE Transactions on Biomedical Engineering. 2012;59(4):1177–1186. doi: 10.1109/TBME.2012.2186612 22318477

46. Liu F, Zhou Z, Jang H, McMillan A, Kijowski R. Deep convolutional neural network and 3D deformable approach for tissue segmentation in musculoskeletal magnetic resonance imaging. Magnetic Resonance in Medicine. 2018;79:2379–2391. doi: 10.1002/mrm.26841 28733975

47. Norman B, Pedoia V, Majumdar S. Use of 2D U-Net convolutional neural networks for automated cartilage and meniscus segmentation of knee MR imaging data to determine relaxometry and morphometry. Radiology. 2018;288(1):177–185. doi: 10.1148/radiol.2018172322 29584598

48. Prasoon A, Petersen K, Igel C, Lauze F, Dam E, Nielsen M. Deep feature learning for knee cartilage segmentation using a triplanar convolutional neural network. In: Medical Image Computing and Computer-Assisted Intervention – MICCAI 2013. 09; 2013. p. 246–253.

49. Zhou Z, Zhao G, Kijowski R, Liu F. Deep convolutional neural network for segmentation of knee joint anatomy. Magnetic Resonance in Medicine. 2018;80(6):2759–2770. doi: 10.1002/mrm.27229 29774599

50. Bae KT, Shim H, Tao C, Chang S, Wang JH, Boudreau R, et al. Intra- and inter-observer reproducibility of volume measurement of knee cartilage segmented from the OAI MR image set using a novel semi-automated segmentation method. Osteoarthritis and Cartilage. 2009;17(12):1589–1597. doi: 10.1016/j.joca.2009.06.003 19577672

51. Öztürk CN, Albayrak S. Automatic segmentation of cartilage in high-field magnetic resonance images of the knee joint with an improved voxel-classification-driven region-growing algorithm using vicinity-correlated subsampling. Computers in Biology and Medicine. 2016;72:90–107. doi: 10.1016/j.compbiomed.2016.03.011 27017069

52. Shim H, Chang S, Tao C, Wang JH, Kwoh CK, Bae KT. Knee cartilage: Efficient and reproducible segmentation on high-spatial-resolution MR images with the semiautomated graph-cut algorithm method. Radiology. 2009;251(2):548–556. doi: 10.1148/radiol.2512081332 19401579

53. Wang P, He X, Li Y, Zhu X, Chen W, Qiu M. Automatic knee cartilage segmentation using multi-feature support vector machine and elastic region growing for magnetic resonance images. Journal of Medical Imaging and Health Informatics. 2016;6(4):948–956. doi: 10.1166/jmihi.2016.1748

54. Yin Y, Zhang X, Williams R, Wu X, Anderson D, Sonka M. LOGISMOS—Layered optimal graph image segmentation of multiple objects and surfaces: Cartilage segmentation in the knee joint. IEEE Trans Med Imaging. 2010;29(12):2023–2037. doi: 10.1109/TMI.2010.2058861 20643602

55. Ambellan F, Tack A, Ehlke M, Zachow S. Automated segmentation of knee bone and cartilage combining statistical shape knowledge and convolutional neural networks: Data from the Osteoarthritis Initiative. Medical Image Analysis. 2018.

56. Dam EB, Lillholm M, Marques J, Nielsen M. Automatic Segmentation of High- and Low-Field Knee MRIs Using Knee Image Quantification with Data from the Osteoarthritis Initiative. Journal of Medical Imaging. 2015;2(2):1–13. doi: 10.1117/1.JMI.2.2.024001

57. Lee JG, Gumus S, Moon CH, Kwoh CK, Bae KT. Fully automated segmentation of cartilage from the MR images of knee using a multi-atlas and local structural analysis method. Medical Physics. 2014;41(9):092303. doi: 10.1118/1.4893533 25186408

58. Lee S, Park SH, Shim H, Yun ID, Lee SU. Optimization of local shape and appearance probabilities for segmentation of knee cartilage in 3-D MR images. Computer Vision and Image Understanding. 2011;115(12):1710–1720. doi: 10.1016/j.cviu.2011.05.014

59. Seim H, Kainmueller D, Lamecker H, Bindernagel M, Malinowski J, Zachow S. Model-based auto-segmentation of knee bones and cartilage in MRI data. In: Proc. Medical Image Analysis for the Clinic: A Grand Challenge. Bejing, China; 2010. p. 215–223. Available from:{~}bram/grandchallenge2010/215.pdf.

60. Wang Z, Donoghue C, Rueckert D. Patch-based segmentation without registration: Application to knee MRI. In: Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). vol. 8184 LNCS; 2013. p. 98–105.

61. Folkesson J, Dam EB, Olsen OF, Pettersen PC, Christiansen C. Segmenting articular cartilage automatically using a voxel classification approach. IEEE Transactions on Medical Imaging. 2007;26(1):106–115. doi: 10.1109/TMI.2006.886808 17243589

62. Liu Q, Wang Q, Zhang L, Gao Y, Shen D. Multi-atlas context forests for knee MR image segmentation. In: International Workshop on Machine Learning in Medical Imaging. June 2016; 2015. p. 186–193. Available from:

63. Pang J, Li PY, Qiu M, Chen W, Qiao L. Automatic articular cartilage segmentation based on pattern recognition from knee MRI images. Journal of Digital Imaging. 2015;28(6):695–703. doi: 10.1007/s10278-015-9780-x 25700618

64. Prasoon A, Igel C, Loog M, Lauze F, Dam EB, Nielsen M. Femoral cartilage segmentation in knee MRI scans using two stage voxel classification. Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS. 2013; p. 5469–5472.

65. Zhang K, Lu W, Marziliano P. Automatic knee cartilage segmentation from multi-contrast MR images using support vector machine classification with spatial dependencies. Magnetic Resonance Imaging. 2013;31(10):1731–1743. doi: 10.1016/j.mri.2013.06.005 23867282

66. Wickham H. ggplot2: Elegant graphics for data analysis. Springer-Verlag New York; 2016. Available from:

67. Wilkinson L. The grammar of graphics (statistics and computing). Berlin, Heidelberg: Springer-Verlag; 2005.

68. Peterfy CG, Schneider E, Nevitt M. The osteoarthritis initiative: report on the design rationale for the magnetic resonance imaging protocol for the knee. Osteoarthritis and Cartilage. 2008;16(12):1433–1441. doi: 10.1016/j.joca.2008.06.016 18786841

69. Luger R, Foreman-Mackey EAD, Fleming DP, Lustig-Yaeger J, Deitrick R. STARRY: Analytic occultation light curves. arXiv:181006559v1 [astro-phIM]. 2018.

70. Jiménez RC, Kuzak M, Alhamdoosh M, Barker M, Batut B, Borg M, et al. Four simple recommendations to encourage best practices in research software. F1000Research. 2017;6:876. doi: 10.12688/f1000research.11407.1

71. Oliphant TE. A guide to NumPy. vol. 1. Trelgol Publishing USA; 2006.

72. van der Walt S, Colbert SC, Varoquaux G. The NumPy Array: A Structure for Efficient Numerical Computation. Computing in Science Engineering. 2011;13(2):22–30. doi: 10.1109/MCSE.2011.37

73. McKinney W. Data Structures for Statistical Computing in Python. In: van der Walt S, Millman J, editors. Proceedings of the 9th Python in Science Conference; 2010. p. 51–56.

74. Hunter JD. Matplotlib: A 2D graphics environment. Computing in Science & Engineering. 2007;9(3):90–95. doi: 10.1109/MCSE.2007.55

75. Lowekamp BC, Chen DT, Ibáñez L, Blezek D. The Design of SimpleITK. Frontiers in Neuroinformatics. 2013;7(December):1–14.

76. Klein S, Staring M, Murphy K, Viergever MA, Pluim J. elastix: A Toolbox for intensity-based medical image registration. IEEE Transactions on Medical Imaging. 2010;29(1):196–205. doi: 10.1109/TMI.2009.2035616 19923044

77. Esteban O, Markiewicz CJ, Blair RW, Moodie CA, Ayse I, Erramuzpe A, et al. FMRIPrep: A robust preprocessing pipeline for functional MRI. Nature Methods. 2019;16(January):1–20.

78. Sled JG, Zijdenbos AP, Evans AC. A nonparametric method for automatic correction of intensity nonuniformity in MRI data. IEEE Transactions on Medical Imaging. 1998;17(1):87–97. doi: 10.1109/42.668698 9617910

79. Sethian J. Level set methods and fast marching methods. Cambridge Press; 1999.

80. Dice L. Measures of the amount of ecologic association between species. Ecology. 1945; p. 297–302. doi: 10.2307/1932409

81. Maier J, Black M, Bonaretti S, Bier B, Eskofier B, Choi JH, et al. Comparison of different approaches for measuring tibial cartilage thickness. Journal of integrative bioinformatics. 2017;14(2):1–10. doi: 10.1515/jib-2017-0015

82. Chen W. Errors in quantitative T1rho imaging and the correction methods. Quantitative imaging in medicine and surgery. 2015;5(4):583–91. doi: 10.3978/j.issn.2223-4292.2015.08.05 26435922

83. van Tiel J, Kotek G, Reijman M, Bos PK, Bron EE, Klein S, et al. Is T1ρ mapping an alternative to delayed gadolinium-enhanced MR imaging of cartilage in the assessment of sulphated glycosaminoglycan content in human osteoarthritic knees? An in vivo validation study. Radiology. 2016;279(2):523–531. doi: 10.1148/radiol.2015150693 26588020

84. Sveinsson B, Chaudhari AS, Gold GE, Hargreaves BA. A simple analytic method for estimating T2 in the knee from DESS. Magnetic Resonance Imaging. 2016;38:63–70. doi: 10.1016/j.mri.2016.12.018 28017730

85. Halilaj E, Hastie TJ, Gold GE, Delp SL. Physical activity is associated with changes in knee cartilage microstructure. Osteoarthritis and Cartilage. 2018;26(6):770–774. doi: 10.1016/j.joca.2018.03.009 29605382

86. Millman KJ, Pérez F. Developing Open Source Practices. In: Stodden V, Leisch F, Peng RD, editors. Implementing Reproducible Research. Taylor & Francis; 2014. p. 1–29. Available from:

87. Yaniv Z, Lowekamp BC, Johnson HJ, Beare R. SimpleITK image-analysis notebooks: A collaborative environment for education and reproducible research. Journal of Digital Imaging. 2018;31(3):290–303. doi: 10.1007/s10278-017-0037-8 29181613

Článek vyšel v časopise


2020 Číslo 1