Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB

Multidimensional Image Processing

Every so often someone asks in comp.soft-sys.matlab for a "function like Image Processing Toolbox function foobar that works in 3-D." If I happen to see the post, I will follow up, explaining that foobar itself works just fine in 3-D.

So in case some blog readers have been looking for a "3-D version of foobar," I thought I'd mention it here.

In the late 1990s we started hearing about requests for three-dimensional image processing support. Then on some customer visits in 2000 we heard some demand for four-dimensional support! As a result, the major Image Processing Toolbox upgrade in 2001 (version 3.0) added arbitrary dimension support to the toolbox.

Many Image Processing Toolbox functions implement mathematical operations (such as convolution) that are perfectly well defined in multidimensional spaces. So our strategy was to go ahead and implement multidimensional support for all such functions.

The meaning of the higher dimensions varies with the application and the data. With volumetric data (pixels become "voxels"), the 3rd dimension is spatial, just like the first two. Sometimes a higher dimension is time, or sequence number. And sometimes a higher dimension is spectral, as in color images or multispectral imagery.

At some point after 2001, we began to realize that users weren't discovering the multidimensional capability of the toolbox. Our first attempt to rectify that problem came when we added documentation sections explaining how to use toolbox functions to process sequences. (See "Working with Sequences" in the Users Guide.) Through a kind of happy mathematical coincidence, it turns out that image processing operators working in higher dimensions often just do "the right thing" when you have an image sequence represented in MATLAB as a three-dimensional array.

Let me explain that statement. Suppose you have a 640-by-480-by-100 array, representing 100 images in a sequence. And suppose you want to filter each image in the sequence with the same filter. Well, it turns out that multidimensional convolution of a 640-by-480-by-100 input with a "flat" filter (that is, an M-by-N-by-1 filter) is exactly equivalent to filtering each image in the sequence independently.

For many users, though, this wasn't at all obvious, even if they did discover the multidimensional capability of many of the functions. So that's what led to the "Working with Sequences" section in the doc. But the multidimensional functions can also handle volumetric processing, or other multidimensional applications.

Still, multidimensional support remains somewhat "hidden" in the doc. Here's where you can almost always find it: Look in the "Class Support" section of a function's reference page. For example, here's what the Class Support section for watershed says:

"A can be a numeric or logical array of any dimension, and it must be nonsparse."

Whenever you see that "of any dimension" phrase, you'll know that the function offers multidimensional support.

PS. Don't ask me to send you the code for foobar. I lost it.




Published with MATLAB® 7.6

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.