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

Non-parametric statistics #233

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions doc/content/specs/nidm-results_dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,12 @@ <h1 label="nidm:MaskMap">nidm:MaskMap</h1>
<ul>
<li><span class="attribute" id="nidm:MaskMap.label">rdfs:label</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> human readable description of the nidm:MaskMap.</li>

<li><span class="attribute" id="nidm:MaskMap.nidm:hasMapHeader">
<a>nidm:hasMapHeader</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> . (range <a>nidm:MapHeader</a>)</li>
<li><span class="attribute" id="nidm:MaskMap.nidm:inCoordinateSpace">
<a>nidm:inCoordinateSpace</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> property of a DataArray to associate a CoordinateSpace with a physical file. (range <a>nidm:CoordinateSpace</a>)</li>
<li><span class="attribute" id="nidm:MaskMap.nidm:isUserDefined">
<dfn>nidm:isUserDefined</dfn>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> a binary flag defining whether the mask was specified by the user (true) or automatically generated during the analysis (false). (range <a title="xsd:boolean" href="http://www.w3.org/2001/XMLSchema#boolean">xsd:boolean</a>)</li>
Expand Down Expand Up @@ -1447,6 +1453,12 @@ <h1 label="nidm:DisplayMaskMap">nidm:DisplayMaskMap</h1>
<ul>
<li><span class="attribute" id="nidm:DisplayMaskMap.label">rdfs:label</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> human readable description of the nidm:DisplayMaskMap.</li>

<li><span class="attribute" id="nidm:DisplayMaskMap.nidm:hasMapHeader">
<a>nidm:hasMapHeader</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> . (range <a>nidm:MapHeader</a>)</li>
<li><span class="attribute" id="nidm:DisplayMaskMap.nidm:inCoordinateSpace">
<a>nidm:inCoordinateSpace</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> property of a DataArray to associate a CoordinateSpace with a physical file. (range <a>nidm:CoordinateSpace</a>)</li>
<li><span class="attribute" id="nidm:DisplayMaskMap.nidm:isUserDefined">
<a>nidm:isUserDefined</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> a binary flag defining whether the mask was specified by the user (true) or automatically generated during the analysis (false). (range <a title="xsd:boolean" href="http://www.w3.org/2001/XMLSchema#boolean">xsd:boolean</a>)</li>
Expand Down Expand Up @@ -1642,6 +1654,15 @@ <h1 label="nidm:SearchSpaceMaskMap">nidm:SearchSpaceMaskMap</h1>
<ul>
<li><span class="attribute" id="nidm:SearchSpaceMaskMap.label">rdfs:label</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> human readable description of the nidm:SearchSpaceMaskMap.</li>

<li><span class="attribute" id="nidm:SearchSpaceMaskMap.nidm:hasMapHeader">
<a>nidm:hasMapHeader</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> . (range <a>nidm:MapHeader</a>)</li>
<li><span class="attribute" id="nidm:SearchSpaceMaskMap.nidm:inCoordinateSpace">
<a>nidm:inCoordinateSpace</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> property of a DataArray to associate a CoordinateSpace with a physical file. (range <a>nidm:CoordinateSpace</a>)</li>
<li><span class="attribute" id="nidm:SearchSpaceMaskMap.nidm:isUserDefined">
<a>nidm:isUserDefined</a>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> a binary flag defining whether the mask was specified by the user (true) or automatically generated during the analysis (false). (range <a title="xsd:boolean" href="http://www.w3.org/2001/XMLSchema#boolean">xsd:boolean</a>)</li>
<li><span class="attribute" id="nidm:SearchSpaceMaskMap.nidm:randomFieldStationarity">
<dfn>nidm:randomFieldStationarity</dfn>
</span>: an <em class="rfc2119" title="OPTIONAL">OPTIONAL</em> is the random field assumed to be stationary across the entire search volume?. (range <a title="xsd:boolean" href="http://www.w3.org/2001/XMLSchema#boolean">xsd:boolean</a>)</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""
Create SPM example 005 stored in nidm/nidm-results/spm/example005 by using the
class templates available in nidm/nidm-results/terms/templates

@author: Camille Maumet <[email protected]>
@copyright: University of Warwick 2013-2014
"""
import os
from create_example_from_templates import ExampleFromTemplate

RELPATH = os.path.dirname(os.path.abspath(__file__))

def main():
nidm_classes = {
"StatisticMap_PseudoT": dict(
var_smoothing="[6 6 6]",
statistic_map_id="niiri:statistic_map_id",
label="Smoothed Variance T-Statistic Map: passive listening > rest",
location="file://./SmoothedVarianceTStatistic.nii.gz",
format="image/nifti",
filename="SmoothedVarianceTStatistic.nii.gz",
statistic_type="nidm:SmoothedVarianceTStatistic",
stat_type_comment="",
contrast_name="passive listening > rest",
effect_dof="1",
sha="799e9bbf8c15b35c0098bca4",
coordinate_space_id="niiri:coordinate_space_id_1",
contrast_est_id="niiri:contrast_estimation_id"
),
"InferenceUsedNonParam": dict(
inference_id="niiri:inference_id_1",
label="Inference",
alternative_hyp="nidm:OneTailedTest",
is_parametric="false",
non_param_dist_id="niiri:non_parametric_null_dististribution_id",
statistic_map_id="niiri:statistic_map_id"
),
"NonParametricDistribution": dict(
non_param_dist_id="niiri:non_parametric_null_dististribution_id",
label="Non-Parametric Null Distribution",
n_perms="5000",
exchangeability_blocks="4"
),
"CoordinateSpace": dict(
coordinate_space_id="niiri:coordinate_space_id_1",
label="Coordinate space 1",
voxel_to_world_mapping="[[-3, 0, 0, 78],[0, 3, 0, -112],[0, 0, 3, -70],[0, 0, 0, 1]]",
voxel_units="['mm', 'mm', 'mm']",
voxel_size="[3, 3, 3]",
coord_system="nidm:MNICoordinateSystem",
number_of_dim="3",
dimensions="[53,63,52]")
}

NIDM_SPM_DIR = os.path.join(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))), 'spm', "example001")
ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_nonparametric.ttl')

EXT_PATH = os.path.dirname(RELPATH)
EXTENSION_TPL_DIR = os.path.join(EXT_PATH, "terms", "templates")

example = ExampleFromTemplate(nidm_classes, ttl_file, False, EXTENSION_TPL_DIR)
example.create_example()

if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

Prov store: https://provenance.ecs.soton.ac.uk/store/documents/76838/

Alternative serialisations: [json](https://provenance.ecs.soton.ac.uk/store/documents/76838.json), [turtle](https://provenance.ecs.soton.ac.uk/store/documents/76838.ttl),
Graph: [svg](https://provenance.ecs.soton.ac.uk/store/documents/76838.svg), [PDF](https://provenance.ecs.soton.ac.uk/store/documents/76838.pdf), [png](https://provenance.ecs.soton.ac.uk/store/documents/76838.png)

![Prov Graph](https://provenance.ecs.soton.ac.uk/store/documents/76838.png)


Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
document
prefix crypto <http://id.loc.gov/vocabulary/preservation/cryptographicHashFunctions#>
prefix neurolex <http://neurolex.org/wiki/>
prefix obo <http://purl.obolibrary.org/obo/>
prefix dct <http://purl.org/dc/terms/>
prefix spm <http://www.incf.org/ns/nidash/spm#>
prefix pre_0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix fsl <http://www.incf.org/ns/nidash/fsl#>
prefix rdfs <http://www.w3.org/2000/01/rdf-schema#>
prefix nfo <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
prefix nidm <http://www.incf.org/ns/nidash/nidm#>
prefix niiri <http://iri.nidash.org/>
prefix xsd <http://www.w3.org/2001/XMLSchema>
prefix bnode <http://openprovenance.org/provtoolbox/bnode/>
prefix dctype <http://purl.org/dc/dcmitype/>
prefix dc <http://purl.org/dc/elements/1.1/>
activity(niiri:inference_id_1,-,-,[prov:type = 'nidm:Inference', prov:label = "Inference", nidm:isParametricTest = "false" %% xsd:boolean, nidm:hasAlternativeHypothesis = 'nidm:OneTailedTest'])
entity(niiri:non_parametric_null_dististribution_id,[prov:type = 'nidm:NonParametricNullDistribution', prov:label = "Non-Parametric Null Distribution", nidm:numberOfPermutations = "5000" %% xsd:int, nidm:exchangeabilityBlockSize = "4" %% xsd:int])
entity(niiri:statistic_map_id,[prov:type = 'nidm:StatisticMap', prov:label = "Smoothed Variance T-Statistic Map: passive listening > rest", prov:location = "file://./SmoothedVarianceTStatistic.nii.gz" %% xsd:anyURI, nidm:statisticType = 'nidm:SmoothedVarianceTStatistic', nfo:fileName = "SmoothedVarianceTStatistic.nii.gz" %% xsd:string, dct:format = "image/nifti" %% xsd:string, nidm:contrastName = "passive listening > rest" %% xsd:string, nidm:effectDegreesOfFreedom = "1" %% xsd:float, nidm:inCoordinateSpace = 'niiri:coordinate_space_id_1', crypto:sha512 = "799e9bbf8c15b35c0098bca4" %% xsd:string, nidm:varianceSmoothingFWHM = "[6 6 6]" %% xsd:string])
entity(niiri:coordinate_space_id_1,[prov:type = 'nidm:CoordinateSpace', prov:label = "Coordinate space 1", nidm:voxelToWorldMapping = "[[-3, 0, 0, 78],[0, 3, 0, -112],[0, 0, 3, -70],[0, 0, 0, 1]]" %% xsd:string, nidm:voxelUnits = "['mm', 'mm', 'mm']" %% xsd:string, nidm:voxelSize = "[3, 3, 3]" %% xsd:string, nidm:inWorldCoordinateSystem = 'nidm:MNICoordinateSystem', nidm:numberOfDimensions = "3" %% xsd:int, nidm:dimensionsInVoxels = "[53,63,52]" %% xsd:string])
used(niiri:inference_id_1,niiri:non_parametric_null_dististribution_id,-)
used(niiri:inference_id_1,niiri:statistic_map_id,-)
wasGeneratedBy(niiri:statistic_map_id,niiri:contrast_estimation_id,-)
endDocument
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix crypto: <http://id.loc.gov/vocabulary/preservation/cryptographicHashFunctions#> .
@prefix neurolex: <http://neurolex.org/wiki/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dctype: <http://purl.org/dc/dcmitype/> .
@prefix spm: <http://www.incf.org/ns/nidash/spm#> .
@prefix fsl: <http://www.incf.org/ns/nidash/fsl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix nidm: <http://www.incf.org/ns/nidash/nidm#> .
@prefix niiri: <http://iri.nidash.org/> .
@prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix obo: <http://purl.obolibrary.org/obo/> .



niiri:coordinate_space_id_1 a prov:Entity , nidm:CoordinateSpace ;
rdfs:label "Coordinate space 1" ;
nidm:voxelToWorldMapping "[[-3, 0, 0, 78],[0, 3, 0, -112],[0, 0, 3, -70],[0, 0, 0, 1]]"^^xsd:string ;
nidm:voxelUnits "['mm', 'mm', 'mm']"^^xsd:string ;
nidm:voxelSize "[3, 3, 3]"^^xsd:string ;
nidm:inWorldCoordinateSystem nidm:MNICoordinateSystem ;
nidm:numberOfDimensions "3"^^xsd:int ;
nidm:dimensionsInVoxels "[53,63,52]"^^xsd:string .

niiri:inference_id_1 a prov:Activity , nidm:Inference ;
rdfs:label "Inference" ;
nidm:isParametricTest "false"^^xsd:boolean ;
nidm:hasAlternativeHypothesis nidm:OneTailedTest ;
prov:used niiri:non_parametric_null_dististribution_id, niiri:statistic_map_id .

niiri:non_parametric_null_dististribution_id a prov:Entity , nidm:NonParametricNullDistribution;
rdfs:label "Non-Parametric Null Distribution" ;
nidm:numberOfPermutations "5000"^^xsd:int ;
nidm:exchangeabilityBlockSize "4"^^xsd:int .

niiri:statistic_map_id a prov:Entity , nidm:StatisticMap ;
rdfs:label "Smoothed Variance T-Statistic Map: passive listening > rest" ;
prov:atLocation "file://./SmoothedVarianceTStatistic.nii.gz"^^xsd:anyURI ;
nidm:statisticType nidm:SmoothedVarianceTStatistic ; #
nfo:fileName "SmoothedVarianceTStatistic.nii.gz"^^xsd:string ;
dct:format "image/nifti"^^xsd:string ;
nidm:contrastName "passive listening > rest"^^xsd:string ;
nidm:effectDegreesOfFreedom "1"^^xsd:float ;
nidm:inCoordinateSpace niiri:coordinate_space_id_1 ;
crypto:sha512 "799e9bbf8c15b35c0098bca4"^^xsd:string ;
prov:wasGeneratedBy niiri:contrast_estimation_id;
nidm:varianceSmoothingFWHM "[6 6 6]"^^xsd:string .

10 changes: 10 additions & 0 deletions nidm/nidm-results/extensions/non_parametric/terms/catalog-v001.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri id="User Entered Import Resolution" name="http://purl.obolibrary.org/nidm/nidmresults.owl" uri="../../../terms/nidm-results.owl"/>
<group id="Folder Repository, directory=, recursive=true, Auto-Update=true, version=2" prefer="public" xml:base=""/>
<uri id="Imports Wizard Entry" name="http://purl.org/nidash/nidm/nfo_import.owl" uri="../../../../imports/nfo_import.ttl"/>
<uri id="Imports Wizard Entry" name="http://purl.org/nidash/nidm/dc_import.owl" uri="../../../../imports/dc_import.ttl"/>
<uri id="Imports Wizard Entry" name="http://purl.org/nidash/nidm/stato_import.owl" uri="../../../../imports/stato_import.ttl"/>
<uri id="Imports Wizard Entry" name="http://www.w3.org/ns/prov-o-20130430" uri="http://www.w3.org/ns/prov-o-20130430"/>
<uri id="Imports Wizard Entry" name="http://purl.obolibrary.org/nidm/iao_import.owl" uri="../../../../imports/iao_import.ttl"/>
</catalog>
Loading