Skip to content

ENH CompCor #1599

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

Merged
merged 66 commits into from
Sep 13, 2016
Merged

ENH CompCor #1599

merged 66 commits into from
Sep 13, 2016

Conversation

berleant
Copy link
Contributor

@berleant berleant commented Sep 1, 2016

Putting this up early

@berleant
Copy link
Contributor Author

berleant commented Sep 2, 2016

Yeah, I wanted to ask what (the best way to create test data is)/(if I should create test data). The ones I have in there are temporary.


class aCompCor(Node):
class aCompCor(Workflow):
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be BaseInterface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like @satra 's comment on the issue (#1594), I am proposing to write an interface containing the core CompCor logic. tCompCor and aCompCor would be workflows that contain nodes for creating the masks, a node for the core CompCor logic, and possibly (?) nodes for applying the extracted noise components. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I see... Workflows go here:
https://github.com/nipy/nipype/tree/master/nipype/workflows and follow a
slightly different pattern (they are functions returning a workflow object
rather than sublasses of Workflow).

I personally would just create two Interfaces: aCompCor(BaseInterface) that
takes a mask, calculates PCA and return the components, and
tCompCor(aCompCor) that takes a percentile argument n, creates a mask that
includes only the n% most variable voxels and reuses the code from its
parent aCompCor to return components. This is as flexible as the workflows,
but easier to integrate with pipelines as well as implement. Let me know
what do you think.

On Fri, Sep 2, 2016 at 10:16 PM, Shoshana Berleant <notifications@github.com

wrote:

In nipype/algorithms/compcor.py
#1599 (comment):

-class aCompCor(Node):
+class aCompCor(Workflow):

Like @satra https://github.com/satra 's comment on the issue (#1594
#1594), I am proposing to write an
interface containing the core CompCor logic. tCompCor and aCompCor would be
workflows that contain nodes for creating the masks, a node for the core
CompCor logic, and possibly (?) nodes for applying the extracted noise
components. What do you think?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nipy/nipype/pull/1599/files/50da63f9a8c74e60ef43b48349d9e5e19f5ad719..9e0d32796cec4ef237e2ccb2b7b74554f01c6ad8#r77431634,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOkp4CKN3GLOC9k9ZZtcY92UazGtooFks5qmQK7gaJpZM4JyQmp
.

@coveralls
Copy link

coveralls commented Sep 2, 2016

Coverage Status

Coverage decreased (-0.004%) to 72.259% when pulling b45b7b1 on shoshber:compcor1594 into da1f544 on nipy:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 71.98% when pulling b45b7b1 on shoshber:compcor1594 into da1f544 on nipy:master.

@coveralls
Copy link

coveralls commented Sep 4, 2016

Coverage Status

Coverage decreased (-0.02%) to 72.242% when pulling 414f11a on shoshber:compcor1594 into da1f544 on nipy:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 72.242% when pulling 414f11a on shoshber:compcor1594 into da1f544 on nipy:master.

@coveralls
Copy link

coveralls commented Sep 4, 2016

Coverage Status

Coverage decreased (-0.03%) to 72.228% when pulling bca197e on shoshber:compcor1594 into da1f544 on nipy:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 71.987% when pulling bca197e on shoshber:compcor1594 into da1f544 on nipy:master.

class CompCoreOutputSpec(TraitedSpec):
components_file = File(desc='text file containing the noise components', exists=True)

class CompCore(BaseInterface):
Copy link
Member

Choose a reason for hiding this comment

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

@shoshber - checking if this is a pun intended class name :) we should use the name from the paper just for searchability purposes. also see how doi's are now included to be able to generate a citation list for an interface.

Copy link
Member

Choose a reason for hiding this comment

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

Not the best place to mention this (I can make a separate issue) but is there a keyword search functionality in nipype? In other words it would be great if interfaces had keywords (like "motion correction", "brain masking"...it would be important to choose them carefully!) and then there was some way to search through them to find an interface that does what you want. Seems relevant here as it is best to have the name match what's in the paper, but then that name isn't actually all that descriptive about what the interface does!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's a pun :) I'll change it.

re doi's, is this what you're referring to? #1464

Copy link
Member

Choose a reason for hiding this comment

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

Yup! It's just a question of adding references_ field such as here:

references_ = [{'entry': BibTeX("@book{FrackowiakFristonFrithDolanMazziotta1997,"

On Tue, Sep 6, 2016 at 2:15 PM, Shoshana Berleant notifications@github.com
wrote:

In nipype/algorithms/compcor.py
#1599 (comment):

+import numpy as np
+from scipy import linalg, stats
+import os
+
+from nipype.pipeline.engine import Workflow
+
+class CompCoreInputSpec(BaseInterfaceInputSpec):

  • realigned_file = File(exists=True, mandatory=True, desc='already realigned brain image (4D)')
  • mask_file = File(exists=True, mandatory=True, desc='mask file that determines ROI (3D)')
  • num_components = traits.Int(6, usedefault=True) # 6 for BOLD, 4 for ASL
  • additional_regressors??

+class CompCoreOutputSpec(TraitedSpec):

  • components_file = File(desc='text file containing the noise components', exists=True)

+class CompCore(BaseInterface):

Yes it's a pun :) I'll change it.

re doi's, is this what you're referring to? #1464
#1464


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nipy/nipype/pull/1599/files/ef50858d3b3016018f0078af6b7da29412803c00#r77720814,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOkp7UyOpbrANACeVwGabDKi06T-Wveks5qndgEgaJpZM4JyQmp
.

@chrisgorgo
Copy link
Member

chrisgorgo commented Sep 6, 2016

  1. Please rebase or merge master to fix tests running.
  2. Please get the doctests to run
    shoshber: they run on my setup. we'll see about travis/circleCI
  3. I would suggest renaming CompCore to aCompCor and creating a child class tCompCor that takes percentile argument and does the variance based CompCor (tCompCor) reusing code from it's parent class.
    shoshber: per @satra 's suggestion above, I renamed CompCore to CompCor. It isn't really aCompCor. I will make tCompCor a class of CompCor

@oesteban
Copy link
Contributor

oesteban commented Sep 7, 2016

I have the impression that absolute imports are messing up with the installed and the development versions in travis. I guess the easiest way to solve that is using explicit absolute imports.

@chrisgorgo
Copy link
Member

I had a chat with @satra (we are both at #NHW16) about the temporal denoising. We think the best way to go forward is to add regress_poly (implemented like in https://github.com/nipy/nipype/blob/master/nipype/algorithms/misc.py#L312) to CompCor with defaults reflecting what is in the paper (I believe it's order 1 (linear) for aCompCor and order 2 (linear + qaudratic) for tCompCor, but please double check). It might be worthwhile to refactor tSNR to get the polynomial regression function shared between the interfaces.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 72.508% when pulling c9aa6d6 on shoshber:compcor1594 into 10f28fe on nipy:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 72.508% when pulling c9aa6d6 on shoshber:compcor1594 into 10f28fe on nipy:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 72.508% when pulling c9aa6d6 on shoshber:compcor1594 into 10f28fe on nipy:master.

@coveralls
Copy link

coveralls commented Sep 12, 2016

Coverage Status

Coverage increased (+0.2%) to 72.508% when pulling c9aa6d6 on shoshber:compcor1594 into 10f28fe on nipy:master.

@codecov-io
Copy link

codecov-io commented Sep 12, 2016

Current coverage is 69.76% (diff: 99.02%)

No coverage report found for master at 10f28fe.

Powered by Codecov. Last update 10f28fe...cb2faa2

exclude_low=True, exclude_high=True,
usedefault=True, desc='the percentile '
'used to select highest-variance '
'voxels. By default the 2% of voxels '
Copy link
Member

Choose a reason for hiding this comment

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

The default value is ".02" not "2%".

Copy link
Member

Choose a reason for hiding this comment

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

there should be some clarity that this should be expressed as value ranging from 0.0-1.0 rather than 0-100

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix the documentation.

@chrisgorgo
Copy link
Member

Other than the two comments I made (inf and extra_regressors) I think this is ready to merge.

@berleant berleant changed the title WIP CompCor ENH CompCor Sep 13, 2016
@chrisgorgo chrisgorgo merged commit a746633 into nipy:master Sep 13, 2016
@satra
Copy link
Member

satra commented Sep 13, 2016

where did the duecredit reference go?

@chrisgorgo
Copy link
Member

Good question - I saw it when I was reviewing this PR a few days ago. @shoshber ?

@berleant
Copy link
Contributor Author

see #1630

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

Successfully merging this pull request may close these issues.

7 participants