Independent Execution of Multiple Tasks

CELL_DETECTION_TASKS is a MATLAB program which creates modified versions of a sequence of gray-scale TIF files containing images of cells; the process of each file is carried out independently, using the "task" feature of MATLAB's parallel computing toolbox.

The key idea is that a single "job" is created, but the job is defined to comprise a number of tasks. Each task, in turn, is defined as a MATLAB function to be executed with certain arguments. Once the job is defined, it can be submitted, and the tasks will be carried out, in somewhat arbitrary order, and perhaps on a variety of different processors. In any case, once all the tasks are finished, it is possible to access the functional output from all the tasks; even though the tasks were carried out in an arbitrary fashion, their output was collected and saved.

In this example, each task involves processing a single frame of an animation. Each frame is a gray scale image of biological cells, and the (rather complicated) graphics operation involves simply identifying cells and surrounding them with a thin white boundary. The point of the example is that independent tasks can each open a separate input file, carry out some operations on the data, and write corresponding output files.

Thus, in this case, the output of the tasks is a collection of data files that can be turned, perhaps, into an animation.

This program is based on an example for parallel batch processing (using the PARFOR command originally) of images, found on the MathWorks web site in the Image Processing Toolbox demos area.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


CELL_DETECTION_TASKS is available in a MATLAB version.

Related Data and Programs:

IMAGE_EDGE, a MATLAB library which demonstrates a simple procedure for edge detection in images.

FMINCON_PARALLEL, a MATLAB program which demonstrates the use of MATLAB's FMINCON constrained minimization function, taking advantage of MATLAB's Parallel Computing Toolbox for faster execution.

MATLAB_PARALLEL, MATLAB programs which illustrate "local" parallel programming on a single computer with MATLAB's Parallel Computing Toolbox.

QUAD_TASKS, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "TASK" feature.

RANDOM_WALK_2D_AVOID_TASKS, a MATLAB program which computes many self avoiding random walks in 2D by creating a job which defines each walk as a task, and then computes these independently using MATLAB's Parallel Computing Toolbox task computing capability.

SUBSET_SUM_TASKS, a MATLAB program which solves a subset sum problem by exhaustive search, subdividing the search range among separate tasks.


The User's Guide for the Parallel Computing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/distcomp/distcomp.pdf

MathWorks documentation for the Image Processing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/images/images_tb.pdf.

  1. Gaurav Sharma, Jos Martin,
    MATLAB: A Language for Parallel Computing,
    International Journal of Parallel Programming,
    Volume 37, Number 1, pages 3-36, February 2009.
  2. Michael Quinn,
    Parallel Programming in C with MPI and OpenMP,
    McGraw-Hill, 2004,
    ISBN13: 978-0071232654,
    LC: QA76.73.C15.Q55.

Source Code:

Examples and Tests:

AT3_1m4_**.tif is the original sequence of data.

AT3_1m4.mov animates the original sequence of data.

BT3_1m4_**.tif is the sequence of modified data.

BT3_1m4.mov animates the sequence of modified data.

You can go up one level to the MATLAB source codes.

Last revised on 30 March 2010.