On Wed, Sep 11, 2013 at 11:05 AM, MrBago <notifications@github.com> wrote:

> In dipy/segment/mask.py:
>
> > +    mask : ndarray
> > +        Binary mask of the segmentation.
> > +
> > +    cfa : ndarray, optional
> > +        Array with shape = (..., 3), where ... is the shape of tensor_fit.
> > +        The color fractional anisotropy, ordered as a nd array with the last
> > +        dimension of size 3 for the R, G and B channels.
> > +    """
> > +
> > +    FA = fractional_anisotropy(tensor_fit.evals)
> > +    FA[np.isnan(FA)] = 0
> > +    FA = np.clip(FA, 0, 1)  # Clamp the FA to remove degenerate tensors
> > +
> > +    cfa = color_fa(FA, tensor_fit.evecs)
> > +
> > +    mask = np.all(((cfa >= threshold[0::2]) & (cfa <= threshold[1::2]) & roi[..., None]), axis=-1)
>
> The docstring says that roi should be "a binary mask", but maybe we should
> add something like roi = np.asarray(roi, dtype=bool) to coerce rois into
> dtype=bool.
>

+1. An array of 0,1 with dtype int/float is also binary, but will not work
here.

 —
> Reply to this email directly or view it on GitHub<https://github.com/nipy/dipy/pull/239/files#r6301662>
> .
>