Saturday, October 19, 2013

Life beyond Visual

Qt Project Logo
[update 24 March 2023: latest HRZ software can be found on HRZ website - www.hrzkit.com]

The request to add Modality Worklist SCU to a product is common. This time, the product was already capable of exporting DICOM Images but didn't have any network capabilities. The guys from Marketing asked to send the DICOM files to a PACS and add Modality Worklist Query. Very reasonable and makes perfect sense. Only when I got the detailed system requirements did I realize that this project is going to be challenging after all but for different reasons.
Most of our custom software development projects at H.R.Z. are Windows Technology. We do some Java and iOS from time to time but that's not very common. This time we were asked to develop with Qt.

Qt is a cross-platform application framework. The programming language is C++ and there's a pre-processor called MOC on top of that and GUI framework which now, looking backwards, I can say that is actually very good. Originally developed by Trolltech and later acquired by Nokia, Qt offers a wide range of compilers for many target operating systems and hardware ranging from Handhelds and Cell Phones, embedded linux, Mac OS-X and of course Windows. Apparently Qt is more popular in Europe then in the United States, Maybe because of anti-corporate trends in the old continent or maybe simply because its free.

I wanted to take this project. It was an opportunity to see how our DICOM library, RZDCX, performs outside of its C#/.NET comfort zone. We already had at least two respectable customers utilizing RZDCX and Qt in their medical device products that have completed the development cycle and had thousands of units sold worldwide, so I knew it's possible, but while they were using Microsoft Compiler that offers the full comfort of ATL, this project required MinGW compiler which was new to us. Before I could say yes, I had to verify that Qt + MinGW can talk with our DICOM Toolkit so we had to do a little research and evaluation project and that's exactly what we did.

Qt and COM

Like many open-source projects, when it comes to documentation, Qt documentation is inferior to MSDN for example and even to Apple Developer Center. After digging deep into the internet and separating the wheat from the chaff we were able to compile a short cookbook on using COM in Qt. Qt framework includes a class called QAxObject that inherits from QAxBase. These two classes is enough but luckily there's a pre-processor tool called dumpcpp that makes things much easier. dumpcpp generates C++ wrapper classes for type libraries (typelib). With dumpcpp, using RZDCX becomes very easy. Here's our Cookbook.
Using COM Objects in Qt