bbmean

This function is not yet fully documented. This is a transcript of the text-formatted help.

bbmean  Create black-box for computing averages.
   bbmean creates a black-box operator that computes the mean over an
   arbitrary number of elements. It can be used either by providing
   indices or by labeling elements.

   Syntax:
     BB=bbmean(L)
     BB=bbmean(L,'same')
     BB=bbmean(DIM,{INX1,INX2,...})

   L is a vector or hyper-cube with non-negative integral labels.
   Negative elements and NaNs are non-labels.

   Y=bbmean(L)*X(:) computes averages where Y(i) is the average of all
   elements of X with the label L=i. If we define mean([])=0 we have the
   relation Y(i)=mean(X(find(L==i))). The length of Y is the value
   of the largest label. Non-labels and zeros are ignored.

   Y=bbmean(L,'same')*X(:) produces a vector of the same size as X.
   Elements with labels becomes the average of the input labels:
      Y(i)=mean(X(find(LABEL==LABEL(i))))  for L(i)>0,
      Y(i)=X(i)                            for L(i)=0,
      Y(i)=0                               for L(i) a non-label.

   Y=bbmean(DIM,{INX1,INX2,...})*X(:) computes Y(1)=mean(X(INX1)),
   Y(2)=mean(X(INX2)), etc. DIM is the size of X. An index-vector
   can be empty, in which case the output is zero.

   Example:
     img=bbphantom([200,200],'head');
     L=zeros([200,200]); L(20:50,20:50)=1; L(50:100,50:100)=2;
     bb=bbmean(L,'same');
     img2=reshape(bb*img(:),size(img));
     imagesc(img2.^(1/2.2)); axis image; colormap(gray);

   See also .