nipy/dipy — pull request #88 by MrBago (2012-10-17 18:51:44+00:00)
Title: NF - wrapper function for multi voxel models

Hi All,
I've been giving this multi voxel fit a lot of thought and here is what I've come up with. I would like to make the model API look like this: `fit = model.fit(data, mask)` where data can be an ndarray and mask is `None` by default. This api will allow developers to use any fitting scheme (global or local) for the model. In order to help developers code models that don't need to handle the multi-voxel case explicitly. I've written this decorator that should allow any single voxel model to easily be wrapped into a multi voxel model.

I'd like a little feedback on the implementation. I think it's a little more complex than it needs to be. I could simplify it quite a bit if we built into the API that all models should support something like `fit = model.fit(data=None, mask=False)`. This would simplify the multi-voxel wrapper because it would be able to delegate the handling of the mask values (ie True/False) to the model, but it would add a special case for the model that every developer would need to be aware of (It's a pretty trival case, I imagine we would just return a fit where the fit parameters were all set to zero, but it would still need to be handled by all models). My first thought is to put the complexity in the wrapper instead of the model and API but I want to know what you guys think.