Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for December, 2010

Closing of a First Year for TechBytes

TechBytes

Direct download as Ogg (1:46:40, 32.0 MB) | Direct download as MP3 (48.8 MB)

Summary: Tim, Gordon, and Roy speak about games and make their picks of the year (for 2010)

TODAY’S show covers what was missed since last week’s show and OpenBytes has published the show notes with most of the topics and some corresponding links.

RSS 64x64We hope you will join us for future shows and consider subscribing to the show via the RSS feed. You can also visit our archives for past shows. If you have an Identi.ca account, consider subscribing to TechBytes in order to keep up to date.

As embedded (HTML5):

Download:

Ogg Theora
(There is also an MP3 version)

Search for Cardiac Analysis Code

During the holidays I decided to see what else is out there which is already free/libre software like my own work, which thus can be merged for comparative purposes. It would be valuable to have applied to my work some comparison to existing tracking algorithms which deal with cardiac images. A decade-old paper from Osman et al. covers the very popular HARP and states in its abstract that it offers an “image processing technique for rapid analysis of tagged cardiac magnetic resonance image sequences.[...] Results from the new method are shown to compare very well with a previously validated tracking algorithm.” It’s not easy to gain access even to code samples of complete frameworks that facilitate benchmarking, so the search ascended to SourceForge. I uploaded some projects of mine to SourceForge about 8.5 years ago and hoped that others would do the same. A search in SourceForge for “cardiac” yields about a dozen results (at the time of writing), but there are empty entries in the code repositories where there ought to be complete projects. The Cardiac MR toolbox for Matlab, for instance, is an empty project:

[roy@blueberry cmr-toolbox]$ svn co
https://cmr-toolbox.svn.sourceforge.net/svnroot/cmr-toolbox cmr-toolbox
Checked out revision 0.
[roy@blueberry cmr-toolbox]$ ls
cmr-toolbox
[roy@blueberry cmr-toolbox]$ cd cmr-toolbox/
[roy@blueberry cmr-toolbox]$ ls
[roy@blueberry cmr-toolbox]$

The same goes for Neonatal Rat Cardiac Action Potential, but the Evaluation of Cardiac MR Segmentation project (all of them written for MATLAB but ought to be compatible with Octave) contains some LGPL-licensed code. Repository access (SVN):

svn co https://cardiac-mr.svn.sourceforge.net/svnroot/cardiac-mr cardiac-mr

Looking at MATLAB Central for some more existing code I find an old BSD-licensed function but almost nothing else when searching for “Cardiac”. Since the literature review phase and the subsequent finding of some data [1, 2, 3] there has been almost no room for code reuse, so I had to code everything from scratch. I will soon publish the code (GPLv3-licensed), but in a more scientific society more code would have already been out there for others to collaborate and build upon the work of others.

Nearly Two Months With Fedora 14

Fedora 14 with browser

WHEN Fedora 14 was released there was a lot of excitement about it, more so than when previous releases of this leading GNU/Linux distribution came out. This was justified. After almost 8 weeks with Fedora 14 the only major issue I have had with it is conflicting packages, which would not really be Fedora’s fault. For the most part, when it comes to the experience on the KDE (4.5.x) desktop, everything is great. Some reviewers of Fedora 14 have been harsh and said that it would mostly suit advanced users; I’ve not yet found something which would justify a need for advanced skills though. Maybe once a week or so a technical issue may arise that requires technical understanding, but it’s never something critical.

All in all, having used Fedora 14 since it was released I can happily recommend it.

2011 Resolutions – Professional Focus, Research, and Ethics

EVERY once in a while we all get a break from everyday life and potentially introspect. As the year 2011 is almost upon us, it’s time to explain — on a more personal note for a change — what needs improving. First of all, from a professional point of view, it would be important to ensure effectiveness and to spend less time responding to Internet trolls and other such distractions. It’s just too easy to descend to gossip sometimes, however it gets nobody anywhere. There are some people who revel in harassment of progressive individuals and the worst those latter individuals can do is lose sight of their goals, then engage with the harassers. It’s tempting to do so (one’s own defense), but it’s counter productive as it leads to more of the same. When one expresses strong opinions on any matter, detractors will exist; the polite ones are worth debating with.

On the subject of research, my plan is to ensure that I maintain contact with my roots in computer science with emphasis on computer vision. I may soon have a start-up on the side, but there is no final decision on that yet. Research can produce a skills-based service that helps individuals. This can be an ethical service which even advances software freedom.

Last but not least (quite the opposite in fact), living an ethical life is not the priority of those to whom keeping score means accumulating wealth, even when it comes at the expense of someone else’s (even one’s own) health. We only live once and we must take advantage of this opportunity to do something positive for our neighbours to enhance solidarity. The Earth’s resources are finite and wealth is relative, where one person’s well-being often depends on someone else’s labour (typically dissociated geographically). For harmonious co-existence on this planet people need to increasingly work together and this sometimes means sharing of knowledge, commodities, food, water, and shelter. It’s too easy for people in the West to pretend that the world is just the West when in fact it accounts for less than 20% of the world’s population. Legislators must begin to take into account that inequality is not necessarily the result of imbalanced motivation and determination among minds; many people are born with little or no opportunities and particular conditions imposed by international laws keep it that way. Institutions like WIPO, WTO, WB, and IMF are just part of it and with gradual reform a safer world for everyone to live in is not a distant fantasy. The only real wars are class wars and dimensions like religion/race/nationality are often just instruments that act as surrogates for those in power, not a replacement for identical, scientific, and social doctrines.

Visual Tour of QtOctave

People who say that nothing can replace Photoshop and nothing can replace Microsoft Office simply forget that the functionality they must be implicily referring to is hardly used by anyone among the entire userbase. As pointed out in the previous post, two months with QtOctave and other free/libre software taught me that there is no reason to deny that ~90% of MATLAB’s users can abandon it and use free/libre software instead, maybe more happily in fact (stability, program weight, and cross-platform with access to the source code count, it’s not just a matter of cost). I have used some of the most advanced functionality in MATLAB, so I do know what I am talking about here.

Today I present free/libre software called QtOctave, which is a graphical front end to Octave and it uses Qt, as the name suggests. Qt is cross platform, so as expected it runs on Windows too. Without further ado, let’s take an overview of what QtOctave looks like. I typically put QtOctave on my eighth workspace in KDE, which helps me remember where to find it. Here is my workspace 8 (screenshot, click to magnify).

QtOctave

This picture may be daunting, but QtOctave does a good job hiding lot of the functionality under menus, which reduces clutter. QtOctave uses Octave (CLI) as its engine, but it provides a friendlier face to it. Let’s break down this picture and explain what each component does, in turn.

Menu

The main menu contains many of the basic functions one ought to expect. By “functions” what I mean is either functionality like opening files or mathematical functions that are commonly used. Many options there control the appearance of the GUI, whose core component of the command line containing the core, Octave. QtOctave wraps it up nicely and provides tools to work with/around it.

Menu in QtOctave

Variables

Octave exposes names and corresponding values of variables it holds, but only upon demand. How about having a GUI component to keep track of these and display this information all the time. You want it? You got it:

Variables

Commands and Dynamic Help

The command pane is a companion tool which helps keep track of recently-used commands and makes these conveniently available. In my case, I added the “Dynamic Help” component, to help show what commands are available as soon as I start typing. The contents in the example below show what appears in the window as soon as I began typing “plot”. The namespace of commands can be highly populated if many modules are used (in session’s path), so this is a good way to keep track without looking elsewhere. Bash has a similar functionality which it makes available via the “Tab” key.

Commands and Dynamic Help

Directories

Directories and files are sometimes easier to approach and navigate though when they are quickly accessible through the main GUI. This has use in all sorts of circumstances as drag-and-drop functionality is broadly supported.

Directories

Terminal

In the main body of the program there is the terminal section (or other components, if one chooses to make them available there). Show below is an example of basic interaction with Octave.

Terminal

CLI

The command-line interface is an integral part of the above and it supports up/down arrow key for use of commands history.

CLI

Editor Menu

This editor can be made part of the main windows, but it does not have to be. I personally choose to make it an external window on a second monitor where it offers a lot of viewing space. The menu has all one ought to expect to find in a standard text editor, but it also contains program-specific buttons like execution and debugging.

Editor Menu

Code

Here is a simple code example. The fonts that I use do not look good because I favour monospace, which helps indentation and other tasks where each character is treated as equal.

Code

Breakpoint

Here is another example of code (further down from the top). This helps show how breakpoints are represented in the editor. Together with the variables panel this provides an excellent environment for debugging, so the editor is definitely not detached from the core components; It’s custom-made for it.

Breakpoint

More Components

There is a lot more under the menus, e.g. package management (see the image below). But that’s a subject for another day.

Octave packages

If you like what you see in QtOctave, then consider giving Octave a look. Both Octave and QtOctave are in the *Ubuntu and Fedora repositories, so they only take a moment to install.

GNU Octave a Compatible Drop-in Replacement for MATLAB

Over the past couple of months I have been assessing the combination of Octave with some other free/libre software such as Scilab and QtOctave. I did this as part of my existing job in research, as my blog posts ought to have revealed on occasions. I’ve been using MATLAB for the best part of a decade and was at one time ranked #1 in the world for my contributions to MATLAB Central. That, however, changed several years ago when I came to grips with the fact that my free/libre code for MATLAB only helped promote the underlying stack which included MATLAB, a nasty piece of highly expensive proprietary software with BSA bullies behind it. MathWorks is exploiting free labour of many people to sell its non-free software. I can vividly recall Slashdot comments stressing this point, which profoundly changed my attitude towards MATLAB. So I turned to Octave, as I did half a decade ago, but this time it was a lot more mature. People recommended to me programs other than Octave, too. I checked these under different distributions of GNU/Linux and even Windows, which many people out there continue to use, especially on their desktop. I helped some people dump MATLAB. I saw how easy it was.

MATLAB is used extensively in research and in the industry, sometimes even in hospitals (when I was 22 I was asked to help a professor with that). In many cases, it boasts more features than anyone would ever need*. Does a university student really ever use more than the basic functions? Are companies really willing to spend thousands of dollars per year just ‘renting’ a licence for one or two copies of MATLAB, which keeps nagging them for it assumes they are so-called ‘pirates’ (and the BSA comes knocking to ensure there are up-to-date licensing instances)? The answer is usually “no”, but users of MATLAB may not know that software already exists to offer them an alternative, just as Firefox helps replace Internet Explorer and also outperform it in many technical ways. Since MATLAB and Octave are mostly compatible, moving from one to the other is not hard and this reduces risk of being too dependent on one single company, especially if one switches over to Octave and then uses the no-cost redistribution rights to just expand operations to as many machines as are available. Octave runs exceptionally well on GNU/Linux, so no licence of Windows is required, either. In the coming days I’ll continue to post examples of what can be achieved with the more advanced functionality of Octave, including 3-D and video. It’s impressive and it by far exceeds my expectations given what I found in it around 5 years ago.
____
* There is a famous saying that goes like, “80% of the users of Microsoft Office only ever use 20% of its features.”

Making Videos With Animate

A few weeks ago I wrote about turning image sequences into real videos using The GIMP, which is more than just an image editor and my favourite tool for simple videos. But I sought to automate more of the process, so I wrote some Octave code to number the sequence of figures, save them all in raster space under a newly-created directory, and then pass them all using a UNIX-style system call to animate, which is a utility I’ve used for this purpose since 2004. Animate is built in a way that makes it compatible with just about any environment sitting on top of X Server. It allows videos to be saved in so many different formats, including GIF, which makes it easy to open in a lot of programs including Web browsers. Animate also has PDF as an output option — one where frames are separated by pages. This makes it a very powerful tool, which would have been even more powerful had it been possible to save the resultant video from the command line (no such option exists based on the man page). As it stands, making it scriptable is a case of “close, but no cigar” (little human intervention needed). One of this blog’s readers, Twitter, has suggested some other programs that can turn sequences of images into videos without any GUI obstruction. Yes, GUI is trouble in these cases.

The bottom line is, there are many tools for Linux/UNIX which make video composition rather simple and even scriptable (necessary when handling many sets, or sets of 3-D slices). For turning videos into a set of images I use Avidemux. It’s small and simple.

As some example output, here is a video showing how a rough and incorrect estimate deals with cardiac cycle. The crosses represent radii of best circle fit to the surrounding points. There is no constraint in place yet to ensure diffeomorphism.

Slices and frames 220-240 of heart

Expansion accumulator

Directions accumulator

Here is a more properly placed (at least initially) set of landmark points adjusting to fit the heart’s walls.

Slices and frames 200-220 of heart

Expansion accumulator for tracked heart

Directions accumulator for tracked heart

The figures where values are plotted as a function of frame # basically say how much the points move further away from the centre and whether they move clockwise or counterclockwise. These figures correspond to the two videos, where the latter (*tracked.png) belong to the second video.

Retrieval statistics: 18 queries taking a total of 0.163 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|