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

BF Add ordinal prefix to tmp files and sort appropriately to maintain… #9

Merged
merged 1 commit into from
Jun 15, 2017

Conversation

kastman
Copy link
Contributor

@kastman kastman commented Jun 14, 2017

Hi Anisha,

Two small fixes here - the first is just removing some diffs that were somehow committed, causing the example.ipynb to break and be invalid json.

The second is a trick to force tmp files to always be sorted consistently. This allows you to use lists of both images and options that will match in the same order. What was happening before was the the images were being copied into a local dir with a unique, autogenerated names. But this actually changed the order of the images stochastically, so that the keys were mapping back haphazardly, causing each LUT option to map to each image randomly. To fix this I appended a prefix to each one and sort them, so that the first image in the list always has the first tmp image, etc., and the key mapping works correctly. This allows you to match options and images, e.g. for positive and negative maps:

image_options_hot_cold = [
    {'lut': 'Greyscale'}, 
    {'lut':'Red Overlay'}, 
    {'lut': 'Blue Overlay'}]
Brain([atlas, 'zstat1_pos.nii.gz', 'zstat1_neg.nii.gz'], 
      image_options=image_options_hot_cold)

Otherwise, the tmp filenames map all weird, and re-running will shuffle the three option lists so that they map randomly at each call to the notebook cell.

@akeshavan
Copy link
Owner

@kastman thanks for the PR!

@akeshavan akeshavan merged commit 10a487f into akeshavan:master Jun 15, 2017
@kastman
Copy link
Contributor Author

kastman commented Jun 15, 2017 via email

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.

2 participants