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

Created list of examples for available features and metrics #682

Merged
merged 7 commits into from Oct 9, 2015

Conversation

Projects
None yet
3 participants
@MarcCote
Contributor

MarcCote commented Jul 16, 2015

This PR adds a new example file that will eventually contains more advanced usages related to QuickBundles and the clustering framework. For now, there is only one example about how to use ResampleFeature to manually specify the number of points that streamlines will have when used by the QuickBundles algorithm.

This PR also fixes some typos that were present in the segment_quickbundles.py example.

@MarcCote MarcCote changed the title from Created a new tutorial exaplaining advanced QuickBundles usages to Created a new tutorial explaining advanced usages of QuickBundles Jul 16, 2015

@arokem

This comment has been minimized.

Member

arokem commented Jul 16, 2015

Is this work in progress? Are you planning to add more text/code in this example?

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jul 17, 2015

No, it is ready to be merged. I just wanted to fix the current tutorial about QuickBundles ans show how to change the number of points in the resampling.

streamlines = [i[0] for i in streams]
"""
QuickBundles using `ResampleFeature`

This comment has been minimized.

@Garyfallidis
@arokem

This comment has been minimized.

Member

arokem commented Jul 17, 2015

OK - my impression is that this would work well as an addition to the clustering framework tutorial, rather than its own thing. As it is, it feels like it requires some context, and that other (excellent) tutorial provides that context. In other words, I doubt that anyone would ever read this on its own anyway, so why not integrate it with the other material more fluidly?

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jul 18, 2015

I had in mind that every extensions of Feature and Metric in dipy should have a small tutorial/example. I was afraid that it might be too much to put everything in what I consider a basic example of how to use QuickBundles.
Maybe advanced was not the right term maybe additional examples?

@arokem

This comment has been minimized.

Member

arokem commented Jul 19, 2015

A matter of taste, I guess. For now, this tutorial doesn't contain multiple
additional examples, only this one about resampling. That's fine, but then
the title should really be something about resampling. And again, it would
be good if it contained some explanation about when/why you might want to
use resampling.

On Sat, Jul 18, 2015 at 12:36 PM, Marc-Alexandre Côté <
notifications@github.com> wrote:

I had in mind that every extensions of Feature and Metric in dipy should
have a small tutorial/example. I was afraid that it might be too much to
put everything in what I consider a basic example of how to use
QuickBundles.
Maybe advanced was not the right term maybe additional examples?


Reply to this email directly or view it on GitHub
#682 (comment).

@MarcCote MarcCote changed the title from Created a new tutorial explaining advanced usages of QuickBundles to WIP: Created a new tutorial explaining advanced usages of QuickBundles Jul 19, 2015

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jul 19, 2015

Ok, I see your point. I'll try to add more examples this week. I'll also add more context about why one might be interested to use different Features or Metrics.

@arokem

This comment has been minimized.

Member

arokem commented Jul 20, 2015

Cool. Feel free to ping me when you're done with that, so I can take a look.

@arokem

This comment has been minimized.

Member

arokem commented Jul 29, 2015

Hey @MarcCote - just checking in about this. Have you had a chance to take another look?

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Aug 4, 2015

@arokem you can have a look. That is more what I had in mind. Right now, only the Features examples are done but I'll do the same for Metric.

@arokem

This comment has been minimized.

"check out"?

Maybe "read the :ref:clustering-framework tutorial first: "?

This comment has been minimized.

Owner

MarcCote replied Aug 4, 2015

Yes that's better, I'll change it.

@arokem

This comment has been minimized.

Do you really need to import fvtk again?

@arokem

This comment has been minimized.

Same for these imports from clusterin and metric. Some of them repeat imports that happened above

This comment has been minimized.

Owner

MarcCote replied Aug 4, 2015

I wanted the examples to be almost self-contained. That way, you don't have to go back at the top of the tutorial to see required imports. What do you think?

@arokem

This comment has been minimized.

Member

arokem commented Aug 4, 2015

Nice! How about combining both of these into one tutorial? Too much?

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Aug 4, 2015

@arokem you mean combining features and metrics tutorials? I'm afraid that as we will integrate more features and metrics, it will get too big. What do you think @Garyfallidis ?

@arokem

This comment has been minimized.

Member

arokem commented Aug 4, 2015

One option is to list the different features and metrics that can be used (and how they are combined), but not explicitly write out lines of code for each one.

@arokem

This comment has been minimized.

Member

arokem commented Aug 17, 2015

Any thoughts here @Garyfallidis ?

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Sep 23, 2015

I think it is nice to have a working, independent, example for each feature and metric. Personally, when I follow a tutorial I like to be able to copy-paste the code in a IPython notebook and play with it (that is why each example have its imports).

I don't really mind putting metrics and features examples in one "tutorial", even if I don't think it is necessary. I mean it is not like we are trying to minimize the number of tutorial pages.

I don't have time right now to write the example for the metrics. If you really want to merge this PR, I can remove the metrics part and make another PR later on.

@arokem arokem referenced this pull request Sep 24, 2015

Closed

Fixes #715 #719

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Oct 7, 2015

Hello both. I think what @MarcCote suggests having 3 tutorials. A very basic for QB and then one for metrics and one for features makes perfect sense to me. So let's move towards that direction. But of course interconnect the tutorials.

Also on copying the imports on different sections of this tutorials. I think this is an exception of the classic tutorials that we write because here Marc is listing a series of features and he wants to make them copyable at any stage and order. So, I am fine with repeating the imports for this case. @arokem if you see the rendered tutorial it will be really clear. So, no strong feelings here. But I think it's fine to do what Marc proposes.

@arokem

This comment has been minimized.

Member

arokem commented Oct 7, 2015

Sure - no problem
On Oct 7, 2015 11:38 AM, "Eleftherios Garyfallidis" <
notifications@github.com> wrote:

Hello both. I think what @MarcCote https://github.com/MarcCote suggests
having 3 tutorials. A very basic for QB and then one for metrics and one
for features makes perfect sense to me. So let's move towards that
direction. But of course interconnect the tutorials.

Also on copying the imports on different sections of this tutorials. I
think this is an exception of the classic tutorials that we write because
here Marc is listing a series of features and he wants to make them
copyable at any stage and order. So, I am fine with repeating the imports
for this case. @arokem https://github.com/arokem if you see the
rendered tutorial it will be really clear. So, no strong feelings here. But
I think it's fine to do what Marc proposes.


Reply to this email directly or view it on GitHub
#682 (comment).

**Note:** Resampling streamlines has an impact on clustering results both in
term of speed and quality. Setting the number of points too low will result in
a loss of information about the shape of the streamlines. On the contrary,
setting the number of points to high will slow down the clustering process.

This comment has been minimized.

@Garyfallidis
# Color each midpoint according to the cluster they belong to.
rng = np.random.RandomState(42)
#colormap = rng.rand(len(clusters), 3)

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

space after #

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

or remove comment if not needed

ArcLength Feature
=================
**What:** Instances of `ArcLengthFeature` compute the length of a streamline.
More specifically, this feature corresponds to the sum of every streamline

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

to the sum of the lengths of ...

qb = QuickBundles(threshold=2., metric=metric)
clusters = qb.cluster(streamlines)
#lengths = map(feature.extract, streamlines)

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

pep8 or remove

@MarcCote MarcCote changed the title from WIP: Created a new tutorial explaining advanced usages of QuickBundles to Created list of examples for available features and metrics Oct 7, 2015

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Oct 7, 2015

I guess this will fix #715 and close #719

number of points, you can manually provide an instance of
`AveragePointwiseEuclideanMetric` to `QuickBundles`. Since the default
`Feature` is the `IdentityFeature` the streamlines won't be resampled thus
saving some computional time.

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

computational

# Get some streamlines.
streamlines = get_streamlines() # Previously defined.
feature = VectorBetweenEndpointsFeature()

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

I am suggesting an alternative name VectorOfEndpointsFeature

This comment has been minimized.

@Garyfallidis

Garyfallidis Oct 7, 2015

Member

It's shorter ...

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Oct 9, 2015

Nice! Good job!

Garyfallidis added a commit that referenced this pull request Oct 9, 2015

Merge pull request #682 from MarcCote/fix_typos_in_quickbundles_tutorial
Created list of examples for available features and metrics

@Garyfallidis Garyfallidis merged commit f9c39fa into nipy:master Oct 9, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@MarcCote MarcCote deleted the MarcCote:fix_typos_in_quickbundles_tutorial branch Oct 9, 2015

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