{"action":"created","issue":{"url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/111","labels_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/111/comments","events_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/111/events","html_url":"https://github.com/NeuroVault/NeuroVault/pull/111","id":55354800,"number":111,"title":"Enh/image comparison","user":{"login":"vsoch","id":814322,"avatar_url":"https://avatars.githubusercontent.com/u/814322?v=3","gravatar_id":"","url":"https://api.github.com/users/vsoch","html_url":"https://github.com/vsoch","followers_url":"https://api.github.com/users/vsoch/followers","following_url":"https://api.github.com/users/vsoch/following{/other_user}","gists_url":"https://api.github.com/users/vsoch/gists{/gist_id}","starred_url":"https://api.github.com/users/vsoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsoch/subscriptions","organizations_url":"https://api.github.com/users/vsoch/orgs","repos_url":"https://api.github.com/users/vsoch/repos","events_url":"https://api.github.com/users/vsoch/events{/privacy}","received_events_url":"https://api.github.com/users/vsoch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":75,"created_at":"2015-01-24T01:59:46Z","updated_at":"2015-02-07T06:08:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/111","html_url":"https://github.com/NeuroVault/NeuroVault/pull/111","diff_url":"https://github.com/NeuroVault/NeuroVault/pull/111.diff","patch_url":"https://github.com/NeuroVault/NeuroVault/pull/111.patch"},"body":"This will add image comparison to NeuroVault, meaning:  a button on image pages that will go to a search interface to show top 100 most similar images, each of  which is linked to the \"scatterplot compare\" page for the two images.  The query image is in the top right, and image types (Z, beta, Other, etc) are in the top left, so the user can click to filter.  From each image you can also go to the image page.  The glass brains do NOT represent a difference / comparison, but are just the maps themselves, so the user can visually see them vs. the query in the top right.\r\n\r\nThe images that are included in the comparison come directly from a pkl file that contains a similarity (pearson) correlation matrix, with row and column names corresponding to the image pks.  The button will only show up for an image if it is in this set.  Two things need to happen for this to work:\r\n\r\n- the pkl matrix must exist\r\n- the png images (one for each brain map) must also exist\r\n\r\nThis pull request contains the tasks.py and other celery modules required to get this working, with the tasks written, but they are not integrated anywhere into neurovault for it to happen automatically.  We would need to:\r\n\r\n- submit job to celery to generate the brain image glass brain png with generate_glassbrain_image(nifti_file,pk) in statmaps/tasks.py when a new image is added\r\n- (on some timely basis) run \"make_correlation_df\" (also in statmaps/tasks.py) to generate the public image data frame.  \r\n\r\nThe png brain glass images go into the image/# folders along with the images, with the format \"glass_brain_%s.png\" % pk, and the correlation matrix is a pickle that gets saved to  image_data/matrices/pearson_corr.pkl\r\n\r\nThe guts of the image comparison come from the pybraincompare package, which basically takes in images and stuffs and spits out html, which is then rendered into the neurovault templates.  Here is a list of packages I remember needing to install for my edits (probably these guys go into neurosynth_puppet?):\r\n\r\n- [pybraincompare](https://github.com/vsoch/pybraincompare)\r\n- scikit-learn\r\n- nilearn\r\n\r\nAnd another change for puppet would be adding the \"matrices\" folder under image_data/matrices \r\n\r\nFinally, I'm not sure how the actual deployed image paths looked - if you look under compare_images in views.py I changed the /opt/image_data bits to media and that seemed to work, and I did the same for the compare_search function. \r\n\r\nThere are of course much cool things we can add on to this (let the user choose an atlas, more filtering options, show some kind of difference map), but since this is my first contribution I want to start small... baby steps!  I've also never done this before so feel free to be blunt with me in giving instructions! :L) "},"comment":{"url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/comments/73351867","html_url":"https://github.com/NeuroVault/NeuroVault/pull/111#issuecomment-73351867","issue_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/111","id":73351867,"user":{"login":"vsoch","id":814322,"avatar_url":"https://avatars.githubusercontent.com/u/814322?v=3","gravatar_id":"","url":"https://api.github.com/users/vsoch","html_url":"https://github.com/vsoch","followers_url":"https://api.github.com/users/vsoch/followers","following_url":"https://api.github.com/users/vsoch/following{/other_user}","gists_url":"https://api.github.com/users/vsoch/gists{/gist_id}","starred_url":"https://api.github.com/users/vsoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsoch/subscriptions","organizations_url":"https://api.github.com/users/vsoch/orgs","repos_url":"https://api.github.com/users/vsoch/repos","events_url":"https://api.github.com/users/vsoch/events{/privacy}","received_events_url":"https://api.github.com/users/vsoch/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T06:08:24Z","updated_at":"2015-02-07T06:08:24Z","body":"op, looks like it does come back!"}}