%
%  Get 4 SPMD workers.
%
  matlabpool open local 4
%
%  Read an image.
%
  x = imread ( 'surfsup.tif' );
%
%  Since the image is black and white, it will be distributed by columns.
%
  xd = distributed ( x );
%
%  Have each worker enhance the contrast in its portion of the picture.
%
  spmd
    xl = getLocalPart ( xd );
    xl = nlfilter ( xl, [3,3], @adjustContrast );
    xl = uint8 ( xl );
  end
%
%  We are working with a black and white image, so we can simply
%  concatenate the submatrices to get the whole object.
%
  xf_spmd = [ xl{:} ];

  matlabpool close
