Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Implement masking for the new TensorModel implementation. #96

Merged
merged 3 commits into from
Dec 6, 2012

Conversation

arokem
Copy link
Contributor

@arokem arokem commented Dec 5, 2012

No description provided.

# If a mask is provided, we will use it to access the data
if mask is not None:
# Make sure it's boolean, so that it can be used to mask
mask = np.array(mask, dtype=bool)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use copy=False here to prevent copying if we don't need to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. good call.

On Wed, Dec 5, 2012 at 11:34 AM, MrBago notifications@github.com wrote:

In dipy/reconst/dti.py:

     """
  •    dti_params = self.fit_method(self.design_matrix, data,
    

- _self.args, *_self.kwargs)

  •    return TensorFit(self, dti_params)
    
  •    # If a mask is provided, we will use it to access the data
    
  •    if mask is not None:
    
  •        # Make sure it's boolean, so that it can be used to mask
    
  •        mask = np.array(mask, dtype=bool)
    

We should use copy=False here to prevent copying if we don't need to.


Reply to this email directly or view it on GitHubhttps://github.com//pull/96/files#r2325597.

@Garyfallidis
Copy link
Contributor

Cool!

Garyfallidis added a commit that referenced this pull request Dec 6, 2012
ENH: Implement masking for the new TensorModel implementation.
@Garyfallidis Garyfallidis merged commit aa3b612 into dipy:master Dec 6, 2012
@@ -62,12 +62,26 @@ def fit(self, data):
data : array
The measured signal from one voxel.

mask : array
A boolean array used to mark the coordinates in the data that
should be analyzed that has the shape data.shape[-1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``data.shape[-1]``

@stefanv
Copy link
Contributor

stefanv commented Dec 6, 2012

An interesting aside, you can now fit the tensormodel in two different ways:

  1. TensorModel on entire data-set + mask
  2. MTM = multi_voxel_model(TensorModel); Fit MTM to individual voxels in entire data-set + mask to save memory.

Cool! We should document these two approaches and do some timing comparisons!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants