Saturday 25 March 2017

The MAF is dead - rest in peace

There is one think that has been at the centre of my professional life for over 17 years: the Multimod Application Framework, of MAF for short.

Today, as we announce the very last release of a software based on MAF, BuilderM2O, I feel it is the time to tell the story of this endeavour, and the struggle that it has represented for me and many other involved.

In 1997 I was working at the Rizzoli Institute in Bologna.  We developed a small specialised software called Hipcom, for the design of custom-made hip stems.  The year after we released HipOp a fairly popular pre-operative planning software for total hip replacement.  Both applications were developed from scratch using VTK and the TCL-TK programming environment.  At the end of this second effort, we realised that if we had to develop a third application, we would have had again to start from scratch, in spite the fact Hipcom and HipOp had quite a few things in common.

Also each of these applications were developed by one individual programmer, who then left for other jobs, and we soon discovered how unpleasant it was to maintain or modify software developed by somebody else.

An important element, also for the rest of this story: these were the 90s when software development was still a fairly artisanal process, and we were not specialists in software development. We started to develop software because we needed tools that were not available for our research and clinical translation.  So in general our software was of very low quality, and it systematically violated any good programming practice principle.

So we started to think about a rapid application development framework, where we could progressively add new functions, and then compose these functions into vertical applications designed to solve one particular problem.  We would continue to develop only one piece of software, the framework, and the prototype applications would be generated from it.

The opportunity to materialise this idea came in 2001 with the Multimod project. Funded as part of the Fifth Framework programme, allowed us to start developing this framework that with total lack of imagination we named Multimod Application Framework, or MAF for short.  In addition to team at the Rizzoli institute, MAF was co-developed by a group of developers at the CINECA supercomputing centre, the group of Serge van Sint Jan at ULB (Belgium), and that of Gordon Clapworthy at that time at the University of Luton (UK).  And soon after MAF v1.0 was born.  It was described as a "Software application framework for rapid development of computer aided medicine
applications requiring fusion of heterogeneous data", applications capable of "import any biomedical dataset, register in space and time data from different imaging and instrumentation modalities, and provide a unified software environment for data processing, data fusion, and interactive visualisation".

The year after MAF got a major boost thanks to the Multisense project, which gave us the opportunity to explore all aspects of virtual reality including 3D tracking, motion capture integration, haptic interfaces, etc.

By 2003 MAF was a big monolithic chunk of C++ code that almost no one could master.  Developed without any decent software engineering thinking, with no serious architectural design, any modification would break dozen of functions; form a software point of view, it was a disaster.  But for our research it was a blessing.  It allowed us to attract funding from the ICT area, on those years in great expansion, and it allowed us to achieve in our computational biomechanics research some very interesting results.

So with the help of the team in CINECA we started to conceive a completely new architecture, and around it started a full rewriting, that started in 2004 with the release of MAF v2.0.  We also decide to release a major portion of the framework in open source, with the name OpenMAF.

At that point the the problem started to be organisational.  Developing MAF and all the applications based on it was becoming a full time job, incompatible with the idea to support this project with some spare cycles from the Rizzoli team and some from the CINECA team.  So in 2005 we established a collaborative entity between the two institutions, called the BioComputing Competence Centre (B3C).  The story of B3C is a troubled one: first we tried to establish it as a foundation, a plan that failed when it became evident the massive capital investment the Italian law required to establish one; then we decide to make it a for-profit spin-off, but at that point the management of the Rizzoli institute decided they did not want to assume the relative commercial risk; in the end B3C was established as a division of SuperComputing Solution srl, a spin-off of CINECA that commercialised HPC to industry. One of my closest co-workers, Debora Testi, moved to take the lead of B3C, sided by a former student of mine, Alessandro Chiarini.

B3C started to operate commercial in 2006, and in a few years it developed an amazing portfolio of solutions including commercial applications such as DentalPlan (CT-based planning of dental implantology), CardioView ( treatment planning of cardiac patchplasty), HipOpCT and HipOpRX (successors of the ancient HipOp hip replacement planning software), research applications such as Bonemat, Vpalp, LhpBuilder, NMSBuilder, Aima, an on-line data repository linked to MAF applications called PhysiomeSpace, and a community web site called BiomedTown.

At the top of its splendour MAF2 had over 600 functions, and represented an enormous repository of know-how and algorithms. But once again our enthusiasm had exceed the limits of the architectural design, and maintaining MAF2 applications started to become again very difficult.  The three main problems were a monolithic architecture, which made everything quite fragile, and also prevented fractional re-factoring; the lack of an extension mechanism such as plug-ins, which prevented the open source community to become a reality: MAF2 was a soup of thousands of C++ code lines, and no one sane of mind would embark in adding stuff in if not part of the original development team; and the missing support for multi-threading, which as hardware started to evolve was becoming an issue.

Driven exclusively by a technical mindset we embarked in the third complete re-writing of MAF, which would eventually seal its destiny.  MAF3 was an ambitious project, whose vestigial remains are available on GitHub.  We started to work on it in 2008, and by 2010 we still did not have a full application running on MAF3.  In my opinion we completely underestimated the feat; we simply did not had the critical mass and the budget to pursue such an ambitious project, which was never completed.  Probably we should have focused on consolidating MAF2, but a clean slate seemed the best way to go at that time.

In 2011, after over 20 years I left the Rizzoli institute to start the Insigneo adventure in Sheffield.  For a long while I thought that all the problems we had with MAF were entirely due to my leaving Bologna, but today I realise this is not true.  B3C was in a delicate position at that time: our legacy code, MAF2, and all applications based on it, was starting to show serious signs of age, but all of our development effort was focused on MAF3, which failed to materialise.  We could have survived to this, but in 2012 SuperComputing Solution srl, B3C parent company was restructured, and in spite B3C was in black, it was decided to disband most of the developing team, and move Debora and Sandro to other duties.

At that point we were left with an ageing MAF2, an incomplete MAF3, most of the developers moved to other jobs, and the original team disbanded over four organisations and two countries.

In 2014 we tried to engage all those who in the past had worked on MAF, to see if we could pull through the development of MAF3 with a Bazaar open source model, but the initiative dried up quite quickly.

In 2015 the OpenMAF consortium, which managed the open source project, decided to close down, withdrew the existing software from open source, and provided a full unconditional licence for independent use and further development to the Rizzoli Institute, the CINECA supercomputing centre, and the Insigneo institute.

I made a last desperate effort to salvage the MAF from Sheffield, but it did not work.  In UK where the is an excellent job market for developers in the private sector, and where most universities do not have a clear career path for scientific software developers, it was very difficult to retain a qualified team. Also, the funding opportunities to support large infrastructural software components like MAF were rapidly drying up in UK but also elsewhere in the world.  If you look at the stats for the Insight Tool Kit, probably the biggest and most successful endeavour in this field, it over from over 1000 commits per month in 2003 to around 100 commits per month in the last couple of years.

As a last move to protect the investment made in MAF2, the team at the Rizzoli institute consolidated two of the most popular applications (Bonemat and NMSBuilder) and released them as freeware; At Insigneo we followed in the same footsteps and today we released BuilderM2O. And with this act, the story or MAF can to its final end.

It is a very sad day for me, and I suspect for many others who spent days and nights working on this piece of software.  I believe that the application paradigm, the data model, and library of algorithms, are still an amazing asset, that if made available within a modern software environment, would make a huge impact in the computational medicine domain.  Hopefully, in the future there will be an opportunity to salvage all this value.

But for now, this is the end.  Goodbye MAF; you have been the love and the pain of my life for so many years that it is difficult to imagine a tomorrow without you.  Rest in peace, my old friend.

Announcement: release of Builder M2O v1.0

Today, we announce the release of a freeware application called Builder M2O.

Builder Mark II – Organ (BuilderM2O) is a pre-processor for musculoskeletal subject-specific models at the organ scale.  This freeware allows you to import a variety of biomedical data including medical imaging, segmentation, and finite element data, and fuse them toward the creation of organ scale subject-specific models of bones, joints, muscles, ligaments, and cartilages. 

Last incarnation of a 17 years long legacy software project named Multimod Application Framework, now discontinued, BuilderM2O provides to the many biomechanics modellers a precious specialised tool for their research projects.


The software, the manual, and some tutorial data can be download from the Builder M2O web site:

Due to the limitations of this legacy software, Builder M2O is available only for Windows 32 bits, so it has some severe memory limitations. Also, while we debugged it at the best of our capacities, it is based on obsolete software libraries, which make impossible to remove some instability.

Builder M2O adds to the suite of freeware applications which were released with the closure of the MAF open source project. This includes the Bonemat application, that maps tissue properties from a CT scan to a finite element model, and the NMSBuilder application, to create subject-specific musculoskeletal dynamics models, to be solved with OpenSim.

The Secret Life of Marco Viceconti

Relax, you are not going to find anything sordid here.  First, I do not have a secret life, or if I do is tiny and of no interest.  Secondly, if one want to have secrets creating a Blog does not sound like a smart move.

No, the title, beside being a bit of a joke, indicates that I will write in this blog things about by professional life which are a bit more personal and less institutional.

In fact, nothing I will write here necessarily reflect the opinions of my employer, and should be considered entirely personal.

I do not have a true editorial plan.  Since I am getting old, I am pretty sure I will rant a lot about how the past was better than the present, and throw to anyone who is reading a lot of unrequested advices.

I hope this will be a bit like the Hyde Park Speaker's Corner, where anyone can stand there and speak to the people that pass by.  You do not have to stop and listen, and if you do you may disagree and even debate what is being said.  But everybody's opinion matter (equally), and people talking (and more important listening) to each other is at the basis of any civilisation.

Enjoy.