<commit_before>{% extends "base.html" %}
{% load coffeescript %}
{% load static from staticfiles %}
{% block includes %}
<title>{% block title %}NeuroVault: {{image.name}}{% endblock %}</title>
<script type="text/javascript" src="{% static "scripts/papaya.js"%}"/>
{% include "statmaps/_meta_image.html" %}
<meta name="map_type" content="{{ image.map_type }}">
<meta name="modality" content="{{ image.modality }}">
{% if image.smoothness_fwhm %}
<meta name="smoothness_fwhm" content="{{ image.smoothness_fwhm }}">
{% endif %}
{% if image.analysis_level %}
<meta name="analysis_level" content="{{ image.analysis_level }}">
{% endif %}
{% if image.figure %}
<meta name="figure" content="{{ image.figure }}">
{% endif %}

{% if image.map_type == 'Pa' %}
<meta name="pagetype" content="atlas">
{% else %}
<meta name="pagetype" content="statmap">
{% endif %}

{% if image.not_mni == False %}
<meta name="mni" content="true">
{% else %}
<meta name="mni" content="false">
{% endif %}

<!-- Cognitive Atlas -->
{% if image.cognitive_contrast_cogatlas_id %}
<meta name="cognitive_contrast_cogatlas_id" content="{{ image.cognitive_contrast_cogatlas_id }}">
{% endif %}
{% if image.cognitive_contrast_cogatlas %}
<meta name="cognitive_contrast_cogatlas" content="{{ image.cognitive_contrast_cogatlas }}">
{% endif %}
{% if image.cognitive_paradigm_cogatlas_id %}
<meta name="cognitive_paradigm_cogatlas_id" content="{{ image.cognitive_paradigm_cogatlas_id }}">
{% endif %}
{% if image.cognitive_paradigm_cogatlas %}
<meta name="cognitive_paradigm_cogatlas" content="{{ image.cognitive_paradigm_cogatlas }}">
{% endif %}

{% endblock %}
{% block head %}
    :javascript
         var params = [];
         params["worldSpace"] = true;
         params["expandable"] = true;
         params["combineParametric"] = true;
         params["smoothDisplay"] = false;
         params["luts"] = [{"name":"PuBu", "data":[[0,1,0.968627,0.984314],[0.125,0.92549,0.905882,0.94902],[0.25,0.815686,0.819608,0.901961],[0.375,0.65098,0.741176,0.858824],[0.5,0.454902,0.662745,0.811765],[0.625,0.211765,0.564706,0.752941],[0.75,0.0196078,0.439216,0.690196],[0.875,0.0156863,0.352941,0.552941],[1,0.00784314,0.219608,0.345098]]},
         {"name":"OrRd", "data":[[0,1,0.968627,0.92549],[0.125,0.996078,0.909804,0.784314],[0.25,0.992157,0.831373,0.619608],[0.375,0.992157,0.733333,0.517647],[0.5,0.988235,0.552941,0.34902],[0.625,0.937255,0.396078,0.282353],[0.75,0.843137,0.188235,0.121569],[0.875,0.701961,0,0],[1,0.498039,0,0]]}];

         var filename = "{{ image.file.url }}".replace(/^.*[\\\/]/, '')
    - if image.map_type == "Pa"
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"Spectrum", "alpha":"0.75", minPercent: 0.0, maxPercent: 1.0};
    - elif image.map_type == "R"
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"Overlay (Negatives)", "alpha":"0.75", minPercent: 0.0, maxPercent: 1.0};
    - elif image.map_type == "A"
      :javascript
         params["images"] = ["{{ image.file.url|urlencode }}"];
    - else
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"OrRd", "negative_lut":"PuBu", "alpha":"0.75", "symmetric": true};
    :javascript
        {% inlinecoffeescript %}
            $(document).ready ->
                $('#collection-tabs a:first').tab('show')
                $("table[class*=image-details-datatable]").dataTable
                    sDom: "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>"
                    sAjaxSource: "/api/images/" + "{{ api_cid }}" + "/datatable/?format=json"
                    iDisplayLength: 10

                $('#delete_image').click((e) ->
                    confirm("Are you sure you want to delete this image? This operation cannot be undone!")
                )

                if navigator.userAgent.indexOf("Safari") > -1 and navigator.userAgent.indexOf("Chrome") == -1
                    $('a[href="pycortex"]').hide()

        {% endinlinecoffeescript %}
{% include 'statmaps/_papaya_viewer_head.html.haml' %}

{% endblock %}

{% block content %}
.row
    .span11
        %h2 {{ image.name }}
        .lead
            %p Contributed by {{ user.username }} on {{ image.add_date|date:"N j, Y" }}
            %p <b>Collection</b>: <a href="{{ image.collection.get_absolute_url }}">{{ image.collection.name }}</a>
            - if image.nidm_results
                %p <b>Source</b>: <a href="{{ image.nidm_results.get_absolute_url }}">{{ image.nidm_results.name }}.zip</a>
            - else
                - if image.description
                    %p <b>Description</b>: {{ image.description }}

            - if image.tags.all
                %p <b>Tags</b>:
                    - for tag in image.tags.all
                        %a{ href: "/images/tags/{{tag.name}}" }= tag.name
                        - if not forloop.last

            %a.btn.btn-primary.btn{href: "{% url 'view_task' image.cognitive_paradigm_cogatlas_id %}"} Task View
            %a.btn.btn-primary.btn{href: "pycortex" } 3D View
            - if image.nidm_results
                .btn-group
                    %a.btn.btn-primary.btn.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
                        Downloads
                        %span.caret
                    %ul.dropdown-menu
                        %li
                            %a{:href => "{{ image.nidm_results.zip_file.url }}"}
                                NIDM Results
                                %span.muted [{{image.nidm_results.name}}.zip]
                        %li
                            %a{:href => "{{ image.file.url }}"}
                                Statistical Map
                                %span.muted [{{ img_basename }}]
                        %li
                            %a{:href => "{{ image.nidm_results.ttl_file.url }}"}
                                Turtle File
                                %span.muted [{{ ttl_basename }}]
                        %li
                            %a{:href => "{{ image.nidm_results.provn_file.url }}"}
                                Provn File
                                %span.muted [{{ provn_basename }}]
            - else
                %a.btn.btn-primary.btn{href: "{{ image.file.url|urlencode }}" } Download
            %a.btn.btn-primary.btn{href: "http://neurosynth.org/decode/?neurovault={{ api_cid }}" } Decode with neurosynth
            - if comparison_is_possible
                %a.btn.btn-primary.btn{href: "{% url 'find_similar' image.id %}", data-toggle: "tooltip", title: "Find maps with similar patters."} Find similar
            - else
                %div.tooltip-wrapper{style: "display: inline-block", data-toggle: "tooltip", title: "Find maps with similar patters. This function is only enabled for public group level unthresholded statistical maps."}
                    %a.btn.btn-primary.btn.disabled{href: "{% url 'find_similar' image.id %}"} Find similar
            - if user_owns_image
                %a.btn.btn-primary.btn{href: "{% url 'edit_image' image.id %}" } Edit details
                .float-right-wrapper
                    - if not image.nidm_results
                        %a.btn.btn-danger.btn{href: "{% url 'delete_image' image.id %}", id: 'delete_image' } Delete

        - if warning
            .alert.alert-danger
                {{ warning| safe }}

        %ul#collection-tabs.nav.nav-tabs
            %li
                %a{href:'#papaya_viewer', data-toggle:'tab'} Papaya viewer
            %li
                %a{href:'#details', data-toggle:'tab'} Details
            %li
                %a{href:'#embed', data-toggle:'tab'} Embed

        .tab-content
            #papaya_viewer.tab-pane.active
                {% include 'statmaps/_papaya_viewer_content.html.haml' %}
            #details.tab-pane
                %table.table.table-condensed.table-striped.table-hover.image-details-datatable
                    %thead
                        %tr
                            %th Field
                            %th Value
                    %tbody
            #embed.tab-pane
                <div class="well">
                    <h5>Copy and paste this snippet to embed this map into your website or blog:</h5>
                    <textarea class="nv-papaya-copy-snippet"><div id="NeuroVaultPapayaHolder"><script src="http://{{ request.get_host }}{% url 'image_details' image.id %}js/embed" type="text/javascript" charset="utf-8"></script></div></textarea>
                </div>
{% endblock %}
<commit_msg>adding condition statement so "Task View" does not show for images without a task defined. Also changing url to be in "GET" format to not trigger 500 response<commit_after>{% extends "base.html" %}
{% load coffeescript %}
{% load static from staticfiles %}
{% block includes %}
<title>{% block title %}NeuroVault: {{image.name}}{% endblock %}</title>
<script type="text/javascript" src="{% static "scripts/papaya.js"%}"/>
{% include "statmaps/_meta_image.html" %}
<meta name="map_type" content="{{ image.map_type }}">
<meta name="modality" content="{{ image.modality }}">
{% if image.smoothness_fwhm %}
<meta name="smoothness_fwhm" content="{{ image.smoothness_fwhm }}">
{% endif %}
{% if image.analysis_level %}
<meta name="analysis_level" content="{{ image.analysis_level }}">
{% endif %}
{% if image.figure %}
<meta name="figure" content="{{ image.figure }}">
{% endif %}

{% if image.map_type == 'Pa' %}
<meta name="pagetype" content="atlas">
{% else %}
<meta name="pagetype" content="statmap">
{% endif %}

{% if image.not_mni == False %}
<meta name="mni" content="true">
{% else %}
<meta name="mni" content="false">
{% endif %}

<!-- Cognitive Atlas -->
{% if image.cognitive_contrast_cogatlas_id %}
<meta name="cognitive_contrast_cogatlas_id" content="{{ image.cognitive_contrast_cogatlas_id }}">
{% endif %}
{% if image.cognitive_contrast_cogatlas %}
<meta name="cognitive_contrast_cogatlas" content="{{ image.cognitive_contrast_cogatlas }}">
{% endif %}
{% if image.cognitive_paradigm_cogatlas_id %}
<meta name="cognitive_paradigm_cogatlas_id" content="{{ image.cognitive_paradigm_cogatlas_id }}">
{% endif %}
{% if image.cognitive_paradigm_cogatlas %}
<meta name="cognitive_paradigm_cogatlas" content="{{ image.cognitive_paradigm_cogatlas }}">
{% endif %}

{% endblock %}
{% block head %}
    :javascript
         var params = [];
         params["worldSpace"] = true;
         params["expandable"] = true;
         params["combineParametric"] = true;
         params["smoothDisplay"] = false;
         params["luts"] = [{"name":"PuBu", "data":[[0,1,0.968627,0.984314],[0.125,0.92549,0.905882,0.94902],[0.25,0.815686,0.819608,0.901961],[0.375,0.65098,0.741176,0.858824],[0.5,0.454902,0.662745,0.811765],[0.625,0.211765,0.564706,0.752941],[0.75,0.0196078,0.439216,0.690196],[0.875,0.0156863,0.352941,0.552941],[1,0.00784314,0.219608,0.345098]]},
         {"name":"OrRd", "data":[[0,1,0.968627,0.92549],[0.125,0.996078,0.909804,0.784314],[0.25,0.992157,0.831373,0.619608],[0.375,0.992157,0.733333,0.517647],[0.5,0.988235,0.552941,0.34902],[0.625,0.937255,0.396078,0.282353],[0.75,0.843137,0.188235,0.121569],[0.875,0.701961,0,0],[1,0.498039,0,0]]}];

         var filename = "{{ image.file.url }}".replace(/^.*[\\\/]/, '')
    - if image.map_type == "Pa"
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"Spectrum", "alpha":"0.75", minPercent: 0.0, maxPercent: 1.0};
    - elif image.map_type == "R"
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"Overlay (Negatives)", "alpha":"0.75", minPercent: 0.0, maxPercent: 1.0};
    - elif image.map_type == "A"
      :javascript
         params["images"] = ["{{ image.file.url|urlencode }}"];
    - else
      :javascript
         params["images"] = ["{% static "images/MNI152.nii.gz"%}", "{{ image.file.url|urlencode }}"];
         params[filename] = {"parametric": true,  "lut":"OrRd", "negative_lut":"PuBu", "alpha":"0.75", "symmetric": true};
    :javascript
        {% inlinecoffeescript %}
            $(document).ready ->
                $('#collection-tabs a:first').tab('show')
                $("table[class*=image-details-datatable]").dataTable
                    sDom: "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>"
                    sAjaxSource: "/api/images/" + "{{ api_cid }}" + "/datatable/?format=json"
                    iDisplayLength: 10

                $('#delete_image').click((e) ->
                    confirm("Are you sure you want to delete this image? This operation cannot be undone!")
                )

                if navigator.userAgent.indexOf("Safari") > -1 and navigator.userAgent.indexOf("Chrome") == -1
                    $('a[href="pycortex"]').hide()

        {% endinlinecoffeescript %}
{% include 'statmaps/_papaya_viewer_head.html.haml' %}

{% endblock %}

{% block content %}
.row
    .span11
        %h2 {{ image.name }}
        .lead
            %p Contributed by {{ user.username }} on {{ image.add_date|date:"N j, Y" }}
            %p <b>Collection</b>: <a href="{{ image.collection.get_absolute_url }}">{{ image.collection.name }}</a>
            - if image.nidm_results
                %p <b>Source</b>: <a href="{{ image.nidm_results.get_absolute_url }}">{{ image.nidm_results.name }}.zip</a>
            - else
                - if image.description
                    %p <b>Description</b>: {{ image.description }}

            - if image.tags.all
                %p <b>Tags</b>:
                    - for tag in image.tags.all
                        %a{ href: "/images/tags/{{tag.name}}" }= tag.name
                        - if not forloop.last

            - if image.cognitive_paradigm_cogatlas_id
                %a.btn.btn-primary.btn{href: "{% url 'view_task' %}?cogatlas={{image.cognitive_paradigm_cogatlas_id}}"} Task View
            %a.btn.btn-primary.btn{href: "pycortex" } 3D View
            - if image.nidm_results
                .btn-group
                    %a.btn.btn-primary.btn.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
                        Downloads
                        %span.caret
                    %ul.dropdown-menu
                        %li
                            %a{:href => "{{ image.nidm_results.zip_file.url }}"}
                                NIDM Results
                                %span.muted [{{image.nidm_results.name}}.zip]
                        %li
                            %a{:href => "{{ image.file.url }}"}
                                Statistical Map
                                %span.muted [{{ img_basename }}]
                        %li
                            %a{:href => "{{ image.nidm_results.ttl_file.url }}"}
                                Turtle File
                                %span.muted [{{ ttl_basename }}]
                        %li
                            %a{:href => "{{ image.nidm_results.provn_file.url }}"}
                                Provn File
                                %span.muted [{{ provn_basename }}]
            - else
                %a.btn.btn-primary.btn{href: "{{ image.file.url|urlencode }}" } Download
            %a.btn.btn-primary.btn{href: "http://neurosynth.org/decode/?neurovault={{ api_cid }}" } Decode with neurosynth
            - if comparison_is_possible
                %a.btn.btn-primary.btn{href: "{% url 'find_similar' image.id %}", data-toggle: "tooltip", title: "Find maps with similar patters."} Find similar
            - else
                %div.tooltip-wrapper{style: "display: inline-block", data-toggle: "tooltip", title: "Find maps with similar patters. This function is only enabled for public group level unthresholded statistical maps."}
                    %a.btn.btn-primary.btn.disabled{href: "{% url 'find_similar' image.id %}"} Find similar
            - if user_owns_image
                %a.btn.btn-primary.btn{href: "{% url 'edit_image' image.id %}" } Edit details
                .float-right-wrapper
                    - if not image.nidm_results
                        %a.btn.btn-danger.btn{href: "{% url 'delete_image' image.id %}", id: 'delete_image' } Delete

        - if warning
            .alert.alert-danger
                {{ warning| safe }}

        %ul#collection-tabs.nav.nav-tabs
            %li
                %a{href:'#papaya_viewer', data-toggle:'tab'} Papaya viewer
            %li
                %a{href:'#details', data-toggle:'tab'} Details
            %li
                %a{href:'#embed', data-toggle:'tab'} Embed

        .tab-content
            #papaya_viewer.tab-pane.active
                {% include 'statmaps/_papaya_viewer_content.html.haml' %}
            #details.tab-pane
                %table.table.table-condensed.table-striped.table-hover.image-details-datatable
                    %thead
                        %tr
                            %th Field
                            %th Value
                    %tbody
            #embed.tab-pane
                <div class="well">
                    <h5>Copy and paste this snippet to embed this map into your website or blog:</h5>
                    <textarea class="nv-papaya-copy-snippet"><div id="NeuroVaultPapayaHolder"><script src="http://{{ request.get_host }}{% url 'image_details' image.id %}js/embed" type="text/javascript" charset="utf-8"></script></div></textarea>
                </div>
{% endblock %}

{'fraction_non_alphanumeric': 0.1736783528102393, 'fraction_numerical': 0.04846967167501391, 'mean_word_length': 2.1577930065014934, 'pattern_counts': {'":': 30, '<': 93, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '141423', 'n_tokens_mistral': 6571, 'n_tokens_neox': 5715, 'n_words': 951}