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] add images_to_coordinates #446

Merged
merged 35 commits into from
Apr 7, 2021

Conversation

jdkent
Copy link
Member

@jdkent jdkent commented Feb 18, 2021

Closes #423 .

Changes proposed in this pull request:

  • use transformer class to make ImageToCoordinates

  • test ImageToCoordinates

  • add notebook demonstrating use of ImageToCoordinates

  • add z_to_p function for cases when z-maps are not available, but you still specify z_threshold as a z-value

  • test z_to_p

  • fix bug in dict_to_coordinates

  • How should I handle circular dependencies for get_masker?

    • have a round about somewhat hacky solution
  • how to handle missing required stat maps?

    • I decided to add a merge_strategy parameter with three different options for users to decide whether to overwrite existing coordinates, and to skip generating coordinates for study contrasts without the required z or p maps.
  • somewhat related to the above point, if I include peak statistics for the coordinates that are generated, how should the coordinates that already exist (and do not have peak statistics reported) be represented? As NaNs?

    • Representing missing peak coordinates as NaNs is my current solution.
  • how should negative and positive statistics be handled?

    • there is two_sided parameter now available thanks to @tsalo
  • how should I represent metadata

    • have a coordinate_source column with either original or nimare (or None)

@codecov
Copy link

codecov bot commented Feb 18, 2021

Codecov Report

Merging #446 (c09647f) into master (b52b5af) will decrease coverage by 0.01%.
The diff coverage is 85.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
- Coverage   83.25%   83.23%   -0.02%     
==========================================
  Files          40       40              
  Lines        4024     4110      +86     
==========================================
+ Hits         3350     3421      +71     
- Misses        674      689      +15     
Impacted Files Coverage Δ
nimare/meta/cbma/ale.py 94.05% <ø> (ø)
nimare/meta/cbma/base.py 93.67% <ø> (ø)
nimare/meta/cbma/mkda.py 96.21% <ø> (ø)
nimare/transforms.py 71.04% <81.81%> (+0.53%) ⬆️
nimare/utils.py 94.20% <91.66%> (-0.63%) ⬇️
nimare/generate.py 100.00% <100.00%> (ø)
nimare/meta/kernel.py 97.50% <100.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b52b5af...c09647f. Read the comment docs.

nimare/transforms.py Outdated Show resolved Hide resolved
@jdkent
Copy link
Member Author

jdkent commented Mar 3, 2021

I think this is ready for review, @tyarkoni and @tsalo.
My current biggest question is how to work around the circular imports, I shuffled some functions around, but my solution may be non-optimal.
Once the docs test pass, I'll link to the example notebook I created demonstrating usage.
Here's a notebook from a previous build

@jdkent jdkent force-pushed the enh/imgs_to_coordinates branch from f1fac09 to e044e81 Compare March 3, 2021 22:10
Copy link
Contributor

@tyarkoni tyarkoni left a comment

Choose a reason for hiding this comment

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

Looks good! Only a couple of minor comments, one of which is largely obsoleted by our conversation.

else:
return None


class CoordinateGenerator(Transformer):
"""Extract peak statistical coordinates from statistical z or p maps.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the docstring needs updating to reflect that it's now in a class

nimare/transforms.py Outdated Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
nimare/utils.py Outdated Show resolved Hide resolved
nimare/utils.py Outdated Show resolved Hide resolved
nimare/utils.py Outdated Show resolved Hide resolved
nimare/utils.py Outdated Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
@jdkent jdkent force-pushed the enh/imgs_to_coordinates branch from 17af2b8 to 514ce4c Compare March 20, 2021 03:46
nimare/info.py Show resolved Hide resolved
@jdkent
Copy link
Member Author

jdkent commented Mar 24, 2021

I think with one final look over, this should be ready to merge.

Copy link
Member

@tsalo tsalo left a comment

Choose a reason for hiding this comment

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

Everything is looking really good. Most of my comments are about docstrings, although there is one about whether metadata should be logged. Also, there is a conflict that needs to be addressed. Finally, can you remove [WIP] from the PR title since it's ready for review?

docs/api.rst Show resolved Hide resolved
nimare/results.py Outdated Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
nimare/transforms.py Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
nimare/transforms.py Outdated Show resolved Hide resolved
examples/01_datasets/transform_images_to_coordinates.py Outdated Show resolved Hide resolved
examples/01_datasets/transform_images_to_coordinates.py Outdated Show resolved Hide resolved
examples/01_datasets/transform_images_to_coordinates.py Outdated Show resolved Hide resolved
@jdkent jdkent changed the title [WIP][ENH] add images_to_coordinates [ENH] add images_to_coordinates Mar 27, 2021
@jdkent jdkent force-pushed the enh/imgs_to_coordinates branch from 1263d1f to 9c89f2c Compare April 2, 2021 23:08
@jdkent
Copy link
Member Author

jdkent commented Apr 3, 2021

several rebases later, I think I've covered @tsalo review comments, ready for another check before merging (make sure my rebases did not undo anything)

@jdkent
Copy link
Member Author

jdkent commented Apr 7, 2021

@tsalo I think this is ready for merge (I just don't want to do it without your approval)

@tsalo
Copy link
Member

tsalo commented Apr 7, 2021

Sorry yes I went through and resolve all of my outstanding comments. I was just planning to check things over one last time today, but honestly I'm happy to merge now and we can address any issues as they come up.

@jdkent jdkent merged commit d0935da into neurostuff:master Apr 7, 2021
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.

threshold z-map images from Dataset objects to create coordinates
3 participants