Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for the ‘GNU Octave’ Category

Tutorial: Installing GNU Octave in GNU/Linux

WITHOUT preparing any notes I’ve embarked on the task of making this first Octave tutorial, which hopefully helps show how to install it on a Debian- or Red Hat-based system.


Please bear in mind that this was done on the spot without rehearsals and future tutorials will hopefully be more organised.

My First GNU Octave Screencast

BACK in October I planned to create some videos that explain to people how to use Free (as in libre) software in scientific computing and also how to program with the corresponding syntax. The following unscripted video is an opening demo of what I hope will improve as I gain experience with screencasting. It’s down to figuring out the audio, the window size, and all sorts of intuition-related skills which will be acquired over time.


In later parts I shall introduce readers to QtOctave, as well. I currently experiment with all sorts of video capturing/editing programs and I also upload old videos like this one.

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.”

Heart Image Contouring

Today I implemented circular arrangement of landmark points for the algorithm to identify something approximate/similar to the shape of the heart and then place a given number of points around there. In addition, a boundary is shown by sampling between those points, which gives a contour, with or without arrows on top of it. I will upload the code shortly (needs tidying up).

Heart Tracking – Arrows Drawn Pixel by Pixel

Cardiac image with movement - arrows in blue

Cardiac image with movement - arrows in red

Rather than use the line function in Octave I’ve created a function that can draw several types of arrow, either with colour gradients or uniform, thick or thin (these are parameterised). I’ll soon publish the code.

The shown above arrows are very tiny, but there is a small arrowhead that tells which direction the points move in. Additionally, I have been implementing some 3-D means of visualising what is being done, but it is too early to show the results of this, possibly with arrows in hyperspace too.

These new exemplary images show a surface yielded with ‘hot’ colours where I move landmark points in between frames. It’s still work in progress.

Creating Animations With GNU Octave and the GNU Image Manipulation Program

The GIMP is an extremely powerful program and animation in the GIMP can be achieved with layers. That’s why I can get so much work done just with Free software and GNU tools like gnuplot. This includes some of the following new examples, which are done by taking screenshots (from the GIMP), stacking them up as layers, and then saving them as a GIF file with the animation option enabled.

The following file, an animated GIF image which comprises 8 frames with 600ms setting them apart (click the image to zoom), shows my new algorithm tracking the heart’s boundaries in a sequence taken from the same slice, which prevents sudden, unregistered change in the intensity values near the point being probed. 16 points are initially fixed in a region, equally spaced although that is not a strict requirement because the program takes any list of points and handles each one in turn. The points are separated by a 5-pixel distance in the x and y axes although that too can vary independently based on parameter input that sets a grid (better initialisation would look for edges of interest). The shown arrows are narrow and crude although an option exists for making them thick (which then hides interesting parts of the image). The shuffle parameters in this case involve a frame size of 9×9 pixels, a shuffle radius of 5 pixels, and a summation of pixel-wise differences.

Fiesta animation (cardiac)

A colour representation of the same images sequence is shown below (click to zoom).

Animation of heart surface

Another newly-implemented method looks at another measure for a window of pixels taken from consecutive frames. It considers a minimum of pixel-wise differences in a given range rather than take the average difference. The results obtained using each of these methods cannot be easily compared without a simplified synthetic set and a proper study would need to involve systematic experiments that look at how varying window size, radius, and calculation method affects overall performance. There is quite a project right there, but it only involves tracking, with or without tagging. Tags can help in identifying good landmark points to start with — points that define an anatomically-meaningful edge to start from and track as the sequence of frames progresses. Eventually, providing a formula for normalising a measure of similarity would be nice. Such a normalisation method — if properly applied — gives a new way of finding landmark points ‘on the move’. Doing so using non-rigid registration (NRR) is not possible for the heart as there is hardly a one-to-one correspondence between points (too much movement). The hope is that by employing a fast tracking algorithm with a good transform which adjusts itself for image intensity, size et cetera, it will be possible to identify edges and perform localised measurements, perhaps even do statistical analysis based on different sets of videos (long-term goal). These ideas are not far fetched and the body of work already done in this area ought to be explored. The novelty is the transform being used to quickly calculate similarity wrt neighbouring points, so existing work look at how to adjust parameters so as to get better results. In this particular problem domain, tracking the heart’s contours reliably and robustly enough is the objective, however it is not simple to do this ‘on he fly’ (speed of video playback for example).

Retrieval statistics: 21 queries taking a total of 0.132 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 —|