示例#1
0
def main():
    nidm_classes = {
        "ImagingInstrument":
        dict(
            id="niiri:mr_scanner_id",
            label="MRI Scanner",
            type=q_graph.qname(NLX_MRI_SCANNER),
        ),
        "DesignMatrix":
        dict(design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id"),
        "Image-DesignMatrix":
        dict(image_id="niiri:design_matrix_png_id",
             location="DesignMatrix.png",
             filename="DesignMatrix.png",
             format="image/png"),
        "Group":
        dict(id="niiri:group_id",
             label="Group: Control",
             name="Control",
             numsubjects="23"),
        "Group-2":
        dict(id="niiri:group2_id",
             label="Group: Patient",
             name="Patient",
             numsubjects="21"),
        "Data_wasAttributedTo":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target=100,
             scanner_id="niiri:mr_scanner_id",
             sub_or_group_id="niiri:group_id",
             group2_id="niiri:group2_id",
             mr_protocol=q_graph.qname(NLX_FMRI_PROTOCOL)),
        "ErrorModel":
        dict(error_model_id="niiri:error_model_id",
             noise_distribution="obo:STATO_0000227",
             variance_homo="true",
             variance_spatial="nidm:NIDM_0000073",
             dependence="nidm:NIDM_0000048",
             dependence_spatial="nidm:NIDM_0000073"),
        "MaskMap-1":
        dict(  # Explicit mask used by Model Param. Est.
            mask_id="niiri:mask_id_1",
            label="Mask Map 1",
            location="Mask_1.nii.gz",
            filename="Mask_1.nii.gz",
            user_defined="true",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            used_by_act_id="niiri:model_pe_id"),
        "DerivedMap-MaskMap-1":
        dict(derived_from_map_id="niiri:mask_id_1_der",
             derived_map_type="nidm:NIDM_0000054",
             filename="MaskMap_1_der.nii",
             format="image/nifti",
             sha="e43b6e01b0463fe7d40782137867a",
             map_id="niiri:mask_id_1"),
        "ModelParametersEstimation":
        dict(model_pe_id="niiri:model_pe_id",
             label="Model parameters estimation",
             est_method=STATO_OLS_STR,
             est_method_comment=STATO_OLS_LABEL,
             design_matrix_id="niiri:design_matrix_id",
             data_matrix_id="niiri:data_id",
             error_model_id="niiri:error_model_id",
             software_id="niiri:software_id"),
        "ParameterEstimateMap-1":
        dict(beta_map_id="niiri:beta_map_id_1",
             label="Beta Map 1",
             location="ParameterEstimate_001.nii.gz",
             filename="ParameterEstimate_001.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "DerivedMapWithHeader-PE1":
        dict(derived_from_map_id="niiri:beta_map_id_1_der",
             derived_map_type="nidm:NIDM_0000061",
             filename="beta_0001.img",
             format="image/nifti",
             derived_from_map_header_id="niiri:original_pe_map_header_id",
             sha="e43b6e01b0463fe7d40782137867a",
             format_header="image/nifti",
             filename_header="beta_0001.hdr",
             sha_header="e43b6e01b0463fe7d40782137867a...",
             map_id="niiri:beta_map_id_1"),
        "ParameterEstimateMap-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Beta Map 2",
             location="ParameterEstimate_002.nii",
             filename="ParameterEstimate_002.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "CoordinateSpace-1":
        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, -50],[0, 0, 0, 1]]",
             voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
             voxel_size="[ 3, 3, 3 ]",
             coord_system="nidm:NIDM_0000051",
             number_of_dim="3",
             dimensions="[ 53, 63, 46 ]"),
        "ResidualMeanSquaresMap":
        dict(residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             label="Residual Mean Squares Map",
             location="ResidualMeanSquares.nii.gz",
             filename="ResidualMeanSquares.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "MaskMap_Analysis":
        dict(  # Mask generated by Model Param. Est.
            # (analysis mask)
            mask_id="niiri:mask_id_2",
            label="Mask Map 2",
            location="Mask.nii.gz",
            filename="Mask.nii.gz",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            generated_by_act_id="niiri:model_pe_id",
            used_by_act_id="niiri:contrast_estimation_id"),
        "DerivedMapWithHeader-Mask2":
        dict(derived_from_map_id="niiri:mask_id_2_der",
             derived_map_type="nidm:NIDM_0000054",
             filename="mask.img",
             format="image/nifti",
             derived_from_map_header_id="niiri:original_mask_map_header_id",
             sha="e43b6e01b0463fe7d40782137867a",
             format_header="image/nifti",
             filename_header="mask.hdr",
             sha_header="e43b6e01b0463fe7d40782137867a...",
             map_id="niiri:mask_id_2"),
        "ContrastWeights":
        dict(contrast_id="niiri:contrast_id",
             label="Contrast: Listening > Rest",
             value="[ 1, 0, 0 ]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="listening > rest"),
        "ContrastEstimation":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             label="Contrast estimation",
             software_id="niiri:software_id",
             mask_id="niiri:mask_id_2",
             residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             design_matrix_id="niiri:design_matrix_id",
             contrast_id="niiri:contrast_id",
             param_est_map="niiri:beta_map_id_1"),
        "ContrastEstUsedParamEst-Con1PE2":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             param_est_map="niiri:beta_map_id_2"),
        "ContrastMap":
        dict(contrast_map_id="niiri:contrast_map_id",
             label="Contrast Map: listening > rest",
             location="Contrast.nii.gz",
             format="image/nifti",
             filename="Contrast.nii.gz",
             contrast_name="listening > rest",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastStandardErrorMap":
        dict(contrast_standard_error_map_id=
             "niiri:contrast_standard_error_map_id",
             label="Contrast Standard Error Map",
             location="ContrastStandardError.nii.gz",
             format="image/nifti",
             filename="ContrastStandardError.nii.gz",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             contrast_est_id="niiri:contrast_estimation_id"),
        "StatisticMap-T":
        dict(statistic_map_id="niiri:statistic_map_id",
             label="T-Statistic Map: listening > rest",
             location="TStatistic.nii.gz",
             format="image/nifti",
             filename="TStatistic.nii.gz",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="listening > rest",
             error_dof="72.9999999990787",
             effect_dof="1",
             sha="e43b6e01b0463fe7d40782137867a",
             coordinate_space_id="niiri:coordinate_space_id_1",
             contrast_est_id="niiri:contrast_estimation_id"),
        "DerivedMapWithHeader-StatMap":
        dict(
            derived_from_map_id="niiri:statistic_map_id_der",
            derived_map_type="nidm:NIDM_0000076",
            filename="spmT_0001.img",
            format="image/nifti",
            derived_from_map_header_id="niiri:statistic_original_map_header_id",
            sha="e43b6e01b0463fe7d40782137867a",
            format_header="image/nifti",
            filename_header="spmT_0001.hdr",
            sha_header="e43b6e01b0463fe7d40782137867a...",
            map_id="niiri:statistic_map_id"),
        "HeightThreshold_equivThresh_equivThresh2":
        dict(height_threshold_id="niiri:height_threshold_id",
             thresh_type=OBO_P_VALUE_FWER_QNAME,
             label="Height Threshold: p<0.05 (FWE)",
             value="0.05",
             equiv_thresh="niiri:height_threshold_id_2",
             equiv_thresh2="niiri:height_threshold_id_3"),
        "HeightThreshold-2":
        dict(height_threshold_id="niiri:height_threshold_id_2",
             thresh_type=OBO_STATISTIC_QNAME,
             label="Height Threshold: p<5.23529984739211",
             value="5.23529984739211"),
        "HeightThreshold-3":
        dict(
            height_threshold_id="niiri:height_threshold_id_3",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<7.62276079258051e-07 (uncorrected)",
            value="7.62276079258051e-07",
        ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels":
        dict(extent_threshold_id="niiri:extent_threshold_id",
             label="Extent Threshold: k>=0",
             cluster_size_vox="0",
             cluster_size_resels="0",
             equiv_thresh="niiri:height_threshold_id_2",
             equiv_thresh2="niiri:height_threshold_id_3"),
        "ExtentThreshold-2":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_2",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
        ),
        "ExtentThreshold-3":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_3",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
        ),
        "DisplayMaskMap":
        dict(display_map_id="niiri:display_map_id",
             label="Display Mask Map",
             location="DisplayMask.nii.gz",
             format="image/nifti",
             user_defined="true",
             filename="DisplayMask.nii.gz",
             coordinate_space_id="niiri:coordinate_space_id_2",
             sha="e43b6e01b0463fe7d40782137867a"),
        "PeakDefinitionCriteria_MaxPeaks":
        dict(peak_definition_criteria_id="niiri:peak_definition_criteria_id",
             label="Peak Definition Criteria",
             max_num_peaks="3",
             min_dist_peaks="8.0"),
        "ClusterDefinitionCriteria":
        dict(cluster_definition_criteria_id=
             "niiri:cluster_definition_criteria_id",
             label="Cluster Connectivity Criterion: 18",
             connectivity="nidm:NIDM_0000128"),
        "MaskMap-2":
        dict(  # Explicit mask used by Inference
            mask_id="niiri:mask_id_3",
            label="Mask Map",
            location="Mask_3.nii.gz",
            filename="Mask_3.nii.gz",
            user_defined="true",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_2",
            sha="e43b6e01b0463fe7d40782137867a",
            used_by_act_id="niiri:inference_id"),
        "CoordinateSpace-2":
        dict(coordinate_space_id="niiri:coordinate_space_id_2",
             label="Coordinate space 2",
             voxel_to_world_mapping=
             "[[-3, 0, 0, 78],[0, 3, 0, -112],[0, 0, 3, -50],[0, 0, 0, 1]]",
             voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
             voxel_size="[ 3, 3, 3 ]",
             coord_system="nidm:NIDM_0000051",
             number_of_dim="3",
             dimensions="[ 53, 63, 46 ]"),
        "Inference":
        dict(inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:statistic_map_id",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             display_mask_id="niiri:display_map_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id",
             mask_id="niiri:mask_id_2",
             software_id="niiri:software_id"),
        "ExcursionSetMap":
        dict(
            id="niiri:excursion_set_map_id",
            label="Excursion Set Map",
            location="ExcursionSet.nii.gz",
            format="image/nifti",
            filename="ExcursionSet.nii.gz",
            cluster_label_map_id="niiri:cluster_label_map_id",
            max_intensity_projection_id="niiri:maximum_intensity_projection_id",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            num_of_clusters="8",
            p_value="8.95949980872501e-14",
            inference_id="niiri:inference_id"),
        "SupraThresholdCluster-1":
        dict(cluster_id="niiri:supra_threshold_cluster_0001",
             label="Supra-Threshold Cluster 0001",
             cluster_size_in_voxels="530",
             cluster_label_id="1",
             cluster_size_in_resels="23.1209189500945",
             p_value_unc="9.56276736481136e-52",
             p_value_fwe="0",
             p_value_fdr="7.65021389184909e-51",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-2":
        dict(cluster_id="niiri:supra_threshold_cluster_0002",
             label="Supra-Threshold Cluster 0002",
             cluster_size_in_voxels="445",
             cluster_label_id="2",
             cluster_size_in_resels="19.4128470430038",
             p_value_unc="3.91543427861809e-46",
             p_value_fwe="0",
             p_value_fdr="1.56617371144723e-45",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-3":
        dict(cluster_id="niiri:supra_threshold_cluster_0003",
             label="Supra-Threshold Cluster 0003",
             cluster_size_in_voxels="38",
             cluster_label_id="3",
             cluster_size_in_resels="1.6577262643464",
             p_value_unc="1.56592642027122e-09",
             p_value_fwe="1.39237954499549e-10",
             p_value_fdr="4.17580378738993e-09",
             excursion_set_id="niiri:excursion_set_map_id"),
        "Peak_ValueP-1":
        dict(peak_id="niiri:peak_0001",
             label="Peak 0001",
             location="niiri:coordinate_0001",
             value="13.9346199035645",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="6.3705194444993e-11",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-1":
        dict(coordinate_id="niiri:coordinate_0001",
             label="Coordinate: 0001",
             coord="[ -60, -28, 13 ]"),
        "Peak_ValueP-2":
        dict(peak_id="niiri:peak_0002",
             label="Peak 0002",
             location="niiri:coordinate_0002",
             value="11.3457498550415",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="3.12855975726156e-10",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-2":
        dict(coordinate_id="niiri:coordinate_0002",
             label="Coordinate: 0002",
             coord="[ -66, -13, 4 ]"),
        "Peak_ValueP-3":
        dict(peak_id="niiri:peak_0003",
             label="Peak 0003",
             location="niiri:coordinate_0003",
             value="9.82185649871826",
             equiv_z="7.80404869241187",
             p_uncorr="2.99760216648792e-15",
             p_value_fwe="1.82057147135595e-10",
             p_value_fdr="9.95383070867767e-08",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-3":
        dict(coordinate_id="niiri:coordinate_0003",
             label="Coordinate: 0003",
             coord="[ -63, -7, -2 ]"),
        "Peak_ValueP-4":
        dict(peak_id="niiri:peak_0004",
             label="Peak 0004",
             location="niiri:coordinate_0004",
             value="13.7208814620972",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="6.3705194444993e-11",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-4":
        dict(coordinate_id="niiri:coordinate_0004",
             label="Coordinate: 0004",
             coord="[ 57, -22, 13 ]"),
        "Peak_ValueP-5":
        dict(peak_id="niiri:peak_0005",
             label="Peak 0005",
             location="niiri:coordinate_0005",
             value="12.322901725769",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="6.3705194444993e-11",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-5":
        dict(coordinate_id="niiri:coordinate_0005",
             label="Coordinate: 0005",
             coord="[ 66, -13, -2 ]"),
        "Peak_ValueP-6":
        dict(peak_id="niiri:peak_0006",
             label="Peak 0006",
             location="niiri:coordinate_0006",
             value="9.62070846557617",
             equiv_z="7.7026943536333",
             p_uncorr="6.66133814775094e-15",
             p_value_fwe="4.2237258135458e-10",
             p_value_fdr="1.58195372181651e-07",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-6":
        dict(coordinate_id="niiri:coordinate_0006",
             label="Coordinate: 0006",
             coord="[ 57, -40, 7 ]"),
        "Peak_ValueP-7":
        dict(peak_id="niiri:peak_0007",
             label="Peak 0007",
             location="niiri:coordinate_0007",
             value="7.49709033966064",
             equiv_z="6.43494304364426",
             p_uncorr="6.17598194807556e-11",
             p_value_fwe="4.05099727462943e-06",
             p_value_fdr="0.000463130517859672",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "Coordinate-7":
        dict(coordinate_id="niiri:coordinate_0007",
             label="Coordinate: 0007",
             coord="[ 36, -31, -14 ]"),
        "SearchSpaceMaskMap":
        dict(search_space_id="niiri:search_space_mask_id",
             location="SearchSpaceMask.nii.gz",
             filename="SearchSpaceMask.nii.gz",
             label="Search Space Mask Map",
             format="image/nifti",
             user_defined="false",
             coordinate_space_id="niiri:coordinate_space_id_2",
             expected_num_voxels="0.553331387916112",
             expected_num_clusters="0.0889172687960151",
             height_critical_fwe05="5.23529984739211",
             height_critical_fdr05="6.22537899017334",
             smallest_size_fwe05="1",
             smallest_size_fdr05="3",
             search_vol_voxels="65593",
             search_vol_units="1771011",
             resel_size="22.9229643140043",
             search_vol_resels="2552.68032521656",
             search_vol_resels_geom=
             "[3, 72.3216126440484, 850.716735116472, 2552.68032521656]",
             noise_fwhm_in_voxels=
             "[ 2.95881189165801, 2.96628446669584, 2.61180425626264 ]",
             noise_fwhm_in_units=
             "[ 8.87643567497404, 8.89885340008753, 7.83541276878791 ]",
             random_field_station="false",
             sha="e43b6e01b0463fe7d40782137867a",
             inference_id="niiri:inference_id"),
        "DerivedMapWithHeader":
        dict(
            derived_from_map_id="niiri:contrast_map_id_der",
            derived_map_type="nidm:NIDM_0000002",
            filename="con_0001.img",
            format="image/nifti",
            derived_from_map_header_id="niiri:original_contrast_map_header_id",
            sha="e43b6e01b0463fe7d40782137867a",
            format_header="image/nifti",
            filename_header="con_0001.hdr",
            sha_header="e43b6e01b0463fe7d40782137867a...",
            map_id="niiri:contrast_map_id"),
        "DerivedMapWithHeader-2":
        dict(derived_from_map_id="niiri:beta_map_id_2_der",
             derived_map_type="nidm:NIDM_0000061",
             filename="beta_0002.img",
             format="image/nifti",
             derived_from_map_header_id="niiri:original_pe_map_header_2_id",
             sha="e43b6e01b0463fe7d40782137867a",
             format_header="image/nifti",
             filename_header="beta_0002.hdr",
             sha_header="e43b6e01b0463fe7d40782137867a...",
             map_id="niiri:beta_map_id_2"),
        "DerivedMapWithHeader-3":
        dict(
            derived_from_map_id="niiri:statistic_map_id_der",
            derived_map_type="nidm:NIDM_0000076",
            filename="spmT_0001.img",
            format="image/nifti",
            derived_from_map_header_id="niiri:statistic_original_map_header_id",
            sha="e43b6e01b0463fe7d40782137867a",
            format_header="image/nifti",
            filename_header="spmT_0001.hdr",
            sha_header="e43b6e01b0463fe7d40782137867a...",
            map_id="niiri:statistic_map_id"),
        "NIDMBundle":
        dict(bundle_id="niiri:spm_results_id",
             label="NIDM-Results",
             object_model="nidm:NIDM_0000027",
             version="1.3.0",
             time="2014-05-19T10:30:00.000+01:00",
             export_id="niiri:export_id"),
        "SPM_ReselsPerVoxelMap":
        dict(resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
             label="Resels per Voxel Map",
             location="ReselsPerVoxel.nii.gz",
             filename="ReselsPerVoxel.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             model_pe_id="niiri:model_pe_id"),
        "SPM_InferenceUsedRPVMap":
        dict(inference_id="niiri:inference_id",
             resels_per_voxel_map_id="niiri:resels_per_voxel_map_id"),
        "DerivedMapWithHeader-4":
        dict(derived_from_map_id="niiri:resels_per_voxel_map_id_der",
             derived_map_type="nidm:NIDM_0000144",
             filename="RPV.img",
             format="image/nifti",
             derived_from_map_header_id="niiri:original_rpv_map_header_id",
             sha="e43b6e01b0463fe7d40782137867a",
             format_header="image/nifti",
             filename_header="RPV.hdr",
             sha_header="e43b6e01b0463fe7d40782137867a...",
             map_id="niiri:resels_per_voxel_map_id"),
        "ClusterLabelsMap":
        dict(
            cluster_label_map_id="niiri:cluster_label_map_id",
            location="ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti",
            label="Cluster Labels Map",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="13093aae03897e2518307d000eb298f4b1439814d8d3d77c622b717423f93\
506dd5de5669513ab65c6dd74a7d27ee9df08620f546ed00575517b40e5878c2c96"),
        "SPM_Software":
        dict(software_id="niiri:software_id",
             software_type="scr:SCR_007037",
             label="SPM",
             version="12b.5853"),
        "Image":
        dict(image_id="niiri:maximum_intensity_projection_id",
             location="MaximumIntensityProjection.png",
             filename="MaximumIntensityProjection.png",
             format="image/png"),
        "GrandMeanMap":
        dict(grand_mean_map_id="niiri:grand_mean_map_id",
             label="Grand Mean Map",
             location="GrandMean.nii.gz",
             filename="GrandMean.nii.gz",
             format="image/nifti",
             masked_median="115",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             model_pe_id="niiri:model_pe_id"),
        "ExporterSoftware":
        dict(software_id="niiri:exporter_id",
             software_type="nidm:NIDM_0000168",
             label="spm_results_nidm",
             version="12b.5858"),
        "Export":
        dict(export_id="niiri:export_id",
             label="NIDM-Results export",
             exporter_id="niiri:exporter_id")
    }

    NIDM_SPM_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'spm')
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_results.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
def main():
    nidm_classes = {
        "ImagingInstrument": dict(
            id="niiri:mr_scanner_id",
            label="MRI Scanner",
            type=q_graph.qname(NLX_MRI_SCANNER),
            ),
        "DesignMatrix": dict(
            design_matrix_id='niiri:design_matrix_id',
            label="Design Matrix",
            location="DesignMatrix.csv",
            format="text/csv",
            filename="DesignMatrix.csv",
            design_matrix_png_id="niiri:design_matrix_png_id"),
        "Image-DesignMatrix": dict(
            image_id="niiri:design_matrix_png_id",
            location="DesignMatrix.png",
            filename="DesignMatrix.png",
            format="image/png"
            ),
        "Group": dict(
            id="niiri:group_id",
            label="Group: Control",
            name="Control",
            numsubjects="23"
            ),
        "Group-2": dict(
            id="niiri:group2_id",
            label="Group: Patient",
            name="Patient",
            numsubjects="21"
            ),
        "Data_wasAttributedTo": dict(
            data_id='niiri:data_id',
            label="Data",
            scaling="true",
            target=100,
            scanner_id="niiri:mr_scanner_id",
            sub_or_group_id="niiri:group_id",
            group2_id="niiri:group2_id",
            mr_protocol=q_graph.qname(NLX_FMRI_PROTOCOL)
            ),
        "ErrorModel": dict(
            error_model_id="niiri:error_model_id",
            noise_distribution="obo:STATO_0000227",
            variance_homo="true",
            variance_spatial="nidm:NIDM_0000073",
            dependence="nidm:NIDM_0000048",
            dependence_spatial="nidm:NIDM_0000073"
            ),
        "ModelParametersEstimation": dict(
            model_pe_id="niiri:model_pe_id",
            label="Model parameters estimation",
            est_method=STATO_OLS_STR,
            est_method_comment=STATO_OLS_LABEL,
            design_matrix_id="niiri:design_matrix_id",
            data_matrix_id="niiri:data_id",
            error_model_id="niiri:error_model_id",
            software_id="niiri:software_id"
            ),
        "ParameterEstimateMap-1": dict(
            beta_map_id="niiri:beta_map_id_1",
            label="Beta Map 1",
            location="ParameterEstimate_001.nii.gz",
            filename="ParameterEstimate_001.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_pe_id"),
        "DerivedMap-PE1": dict(
            derived_from_map_id="niiri:beta_map_id_1_der",
            derived_map_type="nidm:NIDM_0000061",
            filename="beta_0001.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:beta_map_id_1"
            ),
        "ParameterEstimateMap-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 2",
            location="ParameterEstimate_002.nii.gz",
            filename="ParameterEstimate_002.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_pe_id"),
        "DerivedMap-PE2": dict(
            derived_from_map_id="niiri:beta_map_id_2_der",
            derived_map_type="nidm:NIDM_0000061",
            filename="beta_0002.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:beta_map_id_2"
            ),
        "ParameterEstimateMap-3": dict(
            beta_map_id="niiri:beta_map_id_3",
            label="Beta Map 3",
            location="ParameterEstimate_003.nii.gz",
            filename="ParameterEstimate_003.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_pe_id"),
        "DerivedMap-PE3": dict(
            derived_from_map_id="niiri:beta_map_id_3_der",
            derived_map_type="nidm:NIDM_0000061",
            filename="beta_0003.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:beta_map_id_3"
            ),
        "CoordinateSpace-1": 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, \
-50],[0, 0, 0, 1]]",
            voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
            voxel_size="[ 3, 3, 3 ]",
            coord_system="nidm:NIDM_0000051",
            number_of_dim="3",
            dimensions="[ 53, 63, 46 ]"),
        "ResidualMeanSquaresMap": dict(
            residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
            label="Residual Mean Squares Map",
            location="ResidualMeanSquares.nii.gz",
            filename="ResidualMeanSquares.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_pe_id"),
        "MaskMap_Analysis": dict(  # The analysis mask
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="Mask.nii.gz",
            filename="Mask.nii.gz",
            format="image/nifti",
            user_defined="false",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            generated_by_act_id="niiri:model_pe_id",
            used_by_act_id="niiri:contrast_estimation_id"),
        "ContrastWeights": dict(
            contrast_id="niiri:contrast_id",
            label="Contrast: listening > reading",
            value="[1, -1, 0, 0]",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="listening > reading"
            ),
        "ContrastWeights-2": dict(
            contrast_id="niiri:contrast_id_2",
            label="Contrast: motor",
            value="[ 0, 0, 1 ]",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="motor"
            ),
        "ContrastEstimation": dict(
            contrast_estimation_id="niiri:contrast_estimation_id",
            label="Contrast estimation 1",
            software_id="niiri:software_id",
            mask_id="niiri:mask_id_1",
            residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
            design_matrix_id="niiri:design_matrix_id",
            contrast_id="niiri:contrast_id",
            param_est_map="niiri:beta_map_id_1"
            ),
        "ContrastEstUsedParamEst-Con1PE2": dict(
            contrast_estimation_id="niiri:contrast_estimation_id",
            param_est_map="niiri:beta_map_id_2"
            ),
        "ContrastEstimation-2": dict(
            contrast_estimation_id="niiri:contrast_estimation_id_2",
            label="Contrast estimation 2",
            software_id="niiri:software_id",
            mask_id="niiri:mask_id_1",
            residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
            design_matrix_id="niiri:design_matrix_id",
            contrast_id="niiri:contrast_id_2",
            param_est_map="niiri:beta_map_id_3"
            ),
        "ContrastEstUsedParamEst-Con2PE3": dict(
            contrast_estimation_id="niiri:contrast_estimation_id_2",
            param_est_map="niiri:beta_map_id_3"
            ),
        "ContrastMap": dict(
            contrast_map_id="niiri:contrast_map_id",
            label="Contrast Map: listening > reading",
            location="Contrast_0001.nii.gz",
            format="image/nifti",
            filename="Contrast_0001.nii.gz",
            contrast_name="listening > reading",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastMap-2": dict(
            contrast_map_id="niiri:contrast_map_id_2",
            label="Contrast Map: motor",
            location="Contrast_0002.nii.gz",
            format="image/nifti",
            filename="Contrast_0002.nii.gz",
            contrast_name="motor",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id_2"),
        "DerivedMap-ContrastMap-2": dict(
            derived_from_map_id="niiri:contrast_map_id_2_der",
            derived_map_type="nidm:NIDM_0000002",
            filename="con_0002.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:contrast_map_id_2"
            ),
        "ContrastStandardErrorMap": dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map_\
id",
            label="Contrast 1 Standard Error Map",
            location="ContrastStandardError_0001.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError_0001.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastStandardErrorMap-2": dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map_\
id_2",
            label="Contrast 2 Standard Error Map",
            location="ContrastStandardError_0002.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError_0002.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id_2"),
        "StatisticMap-T": dict(
            statistic_map_id="niiri:statistic_map_id",
            label="T-Statistic Map: listening > reading",
            location="TStatistic_0001.nii.gz",
            format="image/nifti",
            filename="TStatistic_0001.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="listening > reading",
            error_dof="72.9999999990787",
            effect_dof="1",
            sha="e43b6e01b0463fe7d40782137867a",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id"),
        "DerivedMap-StatMap": dict(
            derived_from_map_id="niiri:statistic_map_id_der",
            derived_map_type="nidm:NIDM_0000076",
            filename="spmT_0001.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:statistic_map_id"
            ),
        "StatisticMap-T-2": dict(
            statistic_map_id="niiri:statistic_map_id_2",
            label="T-Statistic Map: motor",
            location="TStatistic_0002.nii.gz",
            format="image/nifti",
            filename="TStatistic_0002.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="motor",
            error_dof="72.9999999990787",
            effect_dof="1",
            sha="e43b6e01b0463fe7d40782137867a",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_2"),
        "DerivedMap-StatMap-2": dict(
            derived_from_map_id="niiri:statistic_map_id_2_der",
            derived_map_type="nidm:NIDM_0000076",
            filename="spmT_0002.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:statistic_map_id_2"
            ),
        "HeightThreshold_equivThresh_equivThresh2": dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold: p<0.05 (FWE)",
            value="0.05",
            equiv_thresh="niiri:height_threshold_id_12",
            equiv_thresh2="niiri:height_threshold_id_13"
            ),
        "HeightThreshold-12": dict(
            height_threshold_id="niiri:height_threshold_id_12",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold",
            value="5.23529984739211"
            ),
        "HeightThreshold-13": dict(
            height_threshold_id="niiri:height_threshold_id_13",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold",
            value="7.62276079258051e-07",
            ),
        "HeightThreshold_equivThresh_equivThresh2-2": dict(
            height_threshold_id="niiri:height_threshold_id_2",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<0.001 (unc)",
            value="7.62276079258051e-07",
            equiv_thresh="niiri:height_threshold_id_22",
            equiv_thresh2="niiri:height_threshold_id_23"
            ),
        "HeightThreshold-22": dict(
            height_threshold_id="niiri:height_threshold_id_22",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold",
            value="5.23529984739211"
            ),
        "HeightThreshold-23": dict(
            height_threshold_id="niiri:height_threshold_id_23",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold",
            value="0.05",
            ),
        "HeightThreshold_equivThresh_equivThresh2-3": dict(
            height_threshold_id="niiri:height_threshold_id_3",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<0.001 (unc)",
            value="7.62276079258051e-07",
            equiv_thresh="niiri:height_threshold_id_32",
            equiv_thresh2="niiri:height_threshold_id_33"
            ),
        "HeightThreshold-32": dict(
            height_threshold_id="niiri:height_threshold_id_32",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold",
            value="5.23529984739211"
            ),
        "HeightThreshold-33": dict(
            height_threshold_id="niiri:height_threshold_id_33",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold",
            value="0.05",
            ),

        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels": dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: k>=0",
            cluster_size_vox="0",
            cluster_size_resels="0",
            equiv_thresh="niiri:height_threshold_id_12",
            equiv_thresh2="niiri:height_threshold_id_13"
            ),
        "ExtentThreshold-12": dict(
            extent_threshold_id="niiri:extent_threshold_id_12",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
            ),
        "ExtentThreshold-13": dict(
            extent_threshold_id="niiri:extent_threshold_id_13",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
            ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels-2":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_2",
            label="Extent Threshold: k>=5",
            cluster_size_vox="5",
            cluster_size_resels="1.6",
            equiv_thresh="niiri:height_threshold_id_12",
            equiv_thresh2="niiri:height_threshold_id_13"
            ),
        "ExtentThreshold-22": dict(
            extent_threshold_id="niiri:extent_threshold_id_22",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
            ),
        "ExtentThreshold-23": dict(
            extent_threshold_id="niiri:extent_threshold_id_23",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
            ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels-3":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_3",
            label="Extent Threshold: k>=10",
            cluster_size_vox="10",
            cluster_size_resels="3.3",
            equiv_thresh="niiri:height_threshold_id_12",
            equiv_thresh2="niiri:height_threshold_id_13"
            ),
        "ExtentThreshold-32": dict(
            extent_threshold_id="niiri:extent_threshold_id_32",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
            ),
        "ExtentThreshold-33": dict(
            extent_threshold_id="niiri:extent_threshold_id_33",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
            ),
        "DisplayMaskMap": dict(
            display_map_id="niiri:display_map_id",
            label="Display Mask Map",
            user_defined="true",
            location="DisplayMask.nii.gz",
            filename="DisplayMask.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a"
            ),
        "DisplayMaskMap-2": dict(
            display_map_id="niiri:display_map_id_2",
            label="Display Mask Map",
            user_defined="true",
            location="DisplayMask.nii.gz",
            format="image/nifti",
            filename="DisplayMask.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a"
            ),
        "DisplayMaskMap-3": dict(
            display_map_id="niiri:display_map_id_3",
            label="Display Mask Map",
            user_defined="true",
            location="DisplayMask.nii.gz",
            filename="DisplayMask.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a"
            ),
        "PeakDefinitionCriteria_MaxPeaks": dict(
            peak_definition_criteria_id="niiri:peak_definition_criteria_id",
            label="Peak Definition Criteria",
            max_num_peaks="3",
            min_dist_peaks="8.0"
            ),
        "PeakDefinitionCriteria_MaxPeaks-2": dict(
            peak_definition_criteria_id="niiri:peak_definition_criteria_id_2",
            label="Peak Definition Criteria",
            max_num_peaks="3",
            min_dist_peaks="8.0"
            ),
        "PeakDefinitionCriteria_MaxPeaks-3": dict(
            peak_definition_criteria_id="niiri:peak_definition_criteria_id_3",
            label="Peak Definition Criteria",
            max_num_peaks="3",
            min_dist_peaks="8.0"
            ),
        "ClusterDefinitionCriteria": dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"
            ),
        "ClusterDefinitionCriteria-2": dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id_2",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"
            ),
        "ClusterDefinitionCriteria-3": dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id_3",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"
            ),
        "Inference": dict(
            inference_id="niiri:inference_id",
            label="Inference 1",
            alternative_hyp="nidm:NIDM_0000060",
            stat_map_id="niiri:statistic_map_id",
            height_thresh_id="niiri:height_threshold_id_1_1",
            extent_thresh_id="niiri:extent_threshold_id_1_1",
            display_mask_id="niiri:display_map_id",
            peak_def_id="niiri:peak_definition_criteria_id",
            cluster_def_id="niiri:cluster_definition_criteria_id",
            mask_id="niiri:mask_id_1",
            software_id="niiri:software_id"
            ),
        "SearchSpaceMaskMap": dict(  # The "search space"
            search_space_id="niiri:search_space_mask_id",
            location="SearchSpaceMask.nii.gz",
            filename="SearchSpaceMask.nii.gz",
            label="Search Space Mask Map",
            format="image/nifti",
            user_defined="false",
            coordinate_space_id="niiri:coordinate_space_id_1",
            expected_num_voxels="4.02834655908613",
            expected_num_clusters="0.0512932943875478",
            height_critical_fwe05="4.85241745689539",
            height_critical_fdr05="5.7639536857605",
            smallest_size_fwe05="12",
            smallest_size_fdr05="29",
            search_vol_voxels="69306",
            search_vol_units="1871262",
            resel_size="132.907586178202",
            search_vol_resels="467.07642343881",
            search_vol_resels_geom="[7, 42.96312274763, 269.40914815306, \
467.07642343881]",
            noise_fwhm_in_voxels="[ 5.41278985910694, 5.43638957240286, \
4.51666658877481 ]",
            noise_fwhm_in_units="[ 16.2383695773208, 16.3091687172086, \
13.5499997663244 ]",
            random_field_station="true",
            sha="932fd9f0d55e9822748f4a9b35a0a7f0fe442f3e061e2eda48c2617a2938\
df50ea84deca8de0725641a0105b712a80a0c8931df9bdf3bef788b1041379d00875",
            inference_id="niiri:inference_id"
            ),
        "Inference-2": dict(
            inference_id="niiri:inference_id_2",
            label="Inference 2",
            alternative_hyp="nidm:NIDM_0000060",
            stat_map_id="niiri:statistic_map_id_2",
            height_thresh_id="niiri:height_threshold_id_1_2",
            extent_thresh_id="niiri:extent_threshold_id_1_2",
            display_mask_id="niiri:display_map_id_2",
            peak_def_id="niiri:peak_definition_criteria_id_2",
            cluster_def_id="niiri:cluster_definition_criteria_id_2",
            mask_id="niiri:mask_id_1",
            software_id="niiri:software_id"
            ),
        "SearchSpaceMaskMap": dict(  # The "search space"
            search_space_id="niiri:search_space_mask_id",
            location="SearchSpaceMask.nii.gz",
            filename="SearchSpaceMask.nii.gz",
            label="Search Space Mask Map",
            format="image/nifti",
            user_defined="false",
            coordinate_space_id="niiri:coordinate_space_id_1",
            expected_num_voxels="4.02834655908613",
            expected_num_clusters="0.0512932943875478",
            height_critical_fwe05="4.85241745689539",
            height_critical_fdr05="5.7639536857605",
            smallest_size_fwe05="12",
            smallest_size_fdr05="29",
            search_vol_voxels="69306",
            search_vol_units="1871262",
            resel_size="132.907586178202",
            search_vol_resels="467.07642343881",
            search_vol_resels_geom="[7, 42.96312274763, 269.40914815306, \
467.07642343881]",
            noise_fwhm_in_voxels="[ 5.41278985910694, 5.43638957240286, \
4.51666658877481 ]",
            noise_fwhm_in_units="[ 16.2383695773208, 16.3091687172086, \
13.5499997663244 ]",
            random_field_station="true",
            sha="932fd9f0d55e9822748f4a9b35a0a7f0fe442f3e061e2eda48c2617a2938\
df50ea84deca8de0725641a0105b712a80a0c8931df9bdf3bef788b1041379d00875",
            inference_id="niiri:inference_id"
            ),
        "HeightThreshold_equivThresh_equivThresh2-1": dict(
            height_threshold_id="niiri:height_threshold_id_1_1",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold: p<0.05 (FWE)",
            value="0.0499999999999976",
            equiv_thresh="niiri:height_threshold_id_2",
            equiv_thresh2="niiri:height_threshold_id_3"
            ),
        "HeightThreshold-2-1": dict(
            height_threshold_id="niiri:height_threshold_id_2_1",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold",
            value="4.85241745689539"
            ),
        "HeightThreshold-3-1": dict(
            height_threshold_id="niiri:height_threshold_id_3_1",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold",
            value="2.7772578456986e-06",
            ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels-1":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_1_1",
            label="Extent Threshold: k>=0",
            cluster_size_vox="0",
            cluster_size_resels="0",
            equiv_thresh="niiri:extent_threshold_id_2",
            equiv_thresh2="niiri:extent_threshold_id_3"
            ),
        "ExtentThreshold-2-1": dict(
            extent_threshold_id="niiri:extent_threshold_id_2_1",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
            ),
        "ExtentThreshold-3-1": dict(
            extent_threshold_id="niiri:extent_threshold_id_3_1",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
            ),
        "HeightThreshold_equivThresh_equivThresh2-2": dict(
            height_threshold_id="niiri:height_threshold_id_1_2",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold: p<0.05 (FWE)",
            value="0.0499999999999976",
            equiv_thresh="niiri:height_threshold_id_2",
            equiv_thresh2="niiri:height_threshold_id_3"
            ),
        "HeightThreshold-2-2": dict(
            height_threshold_id="niiri:height_threshold_id_2_2",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold",
            value="4.85241745689539"
            ),
        "HeightThreshold-3-2": dict(
            height_threshold_id="niiri:height_threshold_id_3_2",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold",
            value="2.7772578456986e-06",
            ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels-2":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_1_2",
            label="Extent Threshold: k>=0",
            cluster_size_vox="0",
            cluster_size_resels="0",
            equiv_thresh="niiri:extent_threshold_id_2",
            equiv_thresh2="niiri:extent_threshold_id_3"
            ),
        "ExtentThreshold-2-2": dict(
            extent_threshold_id="niiri:extent_threshold_id_2_2",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
            ),
        "ExtentThreshold-3-2": dict(
            extent_threshold_id="niiri:extent_threshold_id_3_2",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
            ),
        "ConjunctionInference": dict(
            conj_inference_id="niiri:inference_id_3",
            label="Conjunction Inference 3",
            alternative_hyp="nidm:NIDM_0000060",
            stat_map_id_1="niiri:statistic_map_id",
            stat_map_id_2="niiri:statistic_map_id_2",
            height_thresh_id="niiri:height_threshold_id_3",
            extent_thresh_id="niiri:extent_threshold_id_3",
            display_mask_id="niiri:display_map_id_3",
            peak_def_id="niiri:peak_definition_criteria_id_3",
            cluster_def_id="niiri:cluster_definition_criteria_id_3",
            mask_id="niiri:mask_id_1",
            software_id="niiri:software_id"
            ),
        "DerivedMap-Contrast": dict(
            derived_from_map_id="niiri:contrast_map_id_der",
            derived_map_type="nidm:NIDM_0000002",
            filename="con_0001.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:contrast_map_id"
            ),
        "NIDMBundle": dict(
            bundle_id="niiri:spm_results_id",
            label="NIDM-Results",
            object_model="nidm:NIDM_0000027",
            version="1.3.0",
            time="2014-05-19T10:30:00.000+01:00",
            export_id="niiri:export_id"
            ),
        "SPM_ReselsPerVoxelMap": dict(
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
            label="Resels per Voxel Map",
            location="ReselsPerVoxel.nii.gz",
            filename="ReselsPerVoxel.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            model_pe_id="niiri:model_pe_id"
            ),
        "SPM_InferenceUsedRPVMap": dict(
            inference_id="niiri:inference_id",
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id"
        ),
        "SPM_InferenceUsedRPVMap-2": dict(
            inference_id="niiri:inference_id_2",
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id"
        ),
        "SPM_InferenceUsedRPVMap-3": dict(
            inference_id="niiri:inference_id_3",
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id"
        ),
        "DerivedMap-RPV": dict(
            derived_from_map_id="niiri:resels_per_voxel_map_id_der",
            derived_map_type="nidm:NIDM_0000144",
            filename="RPV.nii",
            format="image/nifti",
            sha="e43b6e01b0463fe7d40782137867a",
            map_id="niiri:resels_per_voxel_map_id"
            ),
        "SPM_Software": dict(
            software_id="niiri:software_id",
            software_type="scr:SCR_007037",
            label="SPM",
            version="12b.5853"
            ),
        "GrandMeanMap": dict(
            grand_mean_map_id="niiri:grand_mean_map_id",
            label="Grand Mean Map",
            location="GrandMean.nii.gz",
            filename="GrandMean.nii.gz",
            format="image/nifti",
            masked_median="115",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            model_pe_id="niiri:model_pe_id"
            ),
        "ExporterSoftware": dict(
            software_id="niiri:exporter_id",
            software_type="nidm:NIDM_0000168",
            label="spm_results_nidm",
            version="12b.5858"
            ),
        "Export": dict(
            export_id="niiri:export_id",
            label="NIDM-Results export",
            exporter_id="niiri:exporter_id"
            ),
        "ExcursionSetMap": dict(
            id="niiri:excursion_set_map_id",
            label="Excursion Set Map",
            location="ExcursionSet.nii.gz",
            format="image/nifti",
            filename="ExcursionSet.nii.gz",
            cluster_label_map_id="niiri:cluster_label_map_id",
            max_intensity_projection_id="niiri:maximum_intensity_projection\
_id",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="d96b82761c299a66978893cab6034f3f8aed25d0a135636b0ffe79f4cf11b\
ecce86ba261f7aeb43717f5d0e47ad0b14cfb0402786251e3f2c507890c83b27652",
            num_of_clusters="5",
            p_value="2.83510681598e-09",
            inference_id="niiri:inference_id"
            ),
        "SupraThresholdCluster-1": dict(
            cluster_id="niiri:supra_threshold_cluster_0001",
            label="Supra-Threshold Cluster: 0001",
            cluster_size_in_voxels="839",
            cluster_label_id="1",
            cluster_size_in_resels="6.31265696809113",
            p_value_unc="3.55896824480477e-19",
            p_value_fwe="0",
            p_value_fdr="1.77948412240239e-18",
            excursion_set_id="niiri:excursion_set_map_id"
            ),
        "SupraThresholdCluster-2": dict(
            cluster_id="niiri:supra_threshold_cluster_0002",
            label="Supra-Threshold Cluster: 0002",
            cluster_size_in_voxels="695",
            cluster_label_id="2",
            cluster_size_in_resels="5.22919736927692",
            p_value_unc="5.34280282632073e-17",
            p_value_fwe="0",
            p_value_fdr="1.33570070658018e-16",
            excursion_set_id="niiri:excursion_set_map_id"
            ),
        "SupraThresholdCluster-3": dict(
            cluster_id="niiri:supra_threshold_cluster_0003",
            label="Supra-Threshold Cluster: 0003",
            cluster_size_in_voxels="37",
            cluster_label_id="3",
            cluster_size_in_resels="0.278388924695318",
            p_value_unc="0.00497953247554004",
            p_value_fwe="0.000255384009130943",
            p_value_fdr="0.00829922079256674",
            excursion_set_id="niiri:excursion_set_map_id"
            ),
        "SupraThresholdCluster-4": dict(
            cluster_id="niiri:supra_threshold_cluster_0004",
            label="Supra-Threshold Cluster: 0004",
            cluster_size_in_voxels="29",
            cluster_label_id="4",
            cluster_size_in_resels="0.218196724761195",
            p_value_unc="0.0110257032104773",
            p_value_fwe="0.000565384750377596",
            p_value_fdr="0.0137821290130967",
            excursion_set_id="niiri:excursion_set_map_id"
            ),
        "SupraThresholdCluster-5": dict(
            cluster_id="niiri:supra_threshold_cluster_0005",
            label="Supra-Threshold Cluster: 0005",
            cluster_size_in_voxels="12",
            cluster_label_id="5",
            cluster_size_in_resels="0.0902882999011843",
            p_value_unc="0.0818393184514307",
            p_value_fwe="0.00418900977248904",
            p_value_fdr="0.0818393184514307",
            excursion_set_id="niiri:excursion_set_map_id"
            ),
        "Peak_ValueP-1": dict(
            peak_id="niiri:peak_0001",
            label="Peak: 0001",
            location="niiri:coordinate_0001",
            value="17.5207633972168",
            equiv_z="INF",
            p_uncorr="4.44089209850063e-16",
            p_value_fwe="0",
            p_value_fdr="1.19156591713838e-11",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "Coordinate-1": dict(
            coordinate_id="niiri:coordinate_0001",
            label="Coordinate: 0001",
            coord="[ -60, -25, 11 ]"
            ),
        "Peak_ValueP-2": dict(
            peak_id="niiri:peak_0002",
            label="Peak: 0002",
            location="niiri:coordinate_0002",
            value="13.0321407318",
            equiv_z="INF",
            p_uncorr="4.44089209850063e-16",
            p_value_fwe="0",
            p_value_fdr="1.19156591714e-11",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "Coordinate-2": dict(
            coordinate_id="niiri:coordinate_0002",
            label="Coordinate: 0002",
            coord="[ -42, -31, 11 ]"
            ),
        "Peak_ValueP-3": dict(
            peak_id="niiri:peak_0003",
            label="Peak: 0003",
            location="niiri:coordinate_0003",
            value="10.2856016159058",
            equiv_z="INF",
            p_uncorr="4.44089209850063e-16",
            p_value_fwe="7.69451169446711e-12",
            p_value_fdr="6.84121260274992e-10",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "Coordinate-3": dict(
            coordinate_id="niiri:coordinate_0003",
            label="Coordinate: 0003",
            coord="[ -66, -31, -1 ]"
            ),
        "Peak_ValueP-4": dict(
            peak_id="niiri:peak_0004",
            label="Peak: 0004",
            location="niiri:coordinate_0004",
            value="13.5425577163696",
            equiv_z="INF",
            p_uncorr="4.44089209850063e-16",
            p_value_fwe="0",
            p_value_fdr="1.19156591713838e-11",
            cluster_id="niiri:supra_threshold_cluster_0002"
            ),
        "Coordinate-4": dict(
            coordinate_id="niiri:coordinate_0004",
            label="Coordinate: 0004",
            coord="[ 63, -13, -4 ]"
            )
        }

    NIDM_SPM_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'spm', "example002")
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_results_2contrasts.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
示例#3
0
def main():
    nidm_classes = {
        "ImagingInstrument":
        dict(
            id="niiri:mr_scanner_id",
            label="MRI Scanner",
            type=q_graph.qname(NLX_MRI_SCANNER),
        ),
        "DesignMatrix":
        dict(design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="file://path/to/DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id"),
        "Image-DesignMatrix":
        dict(image_id="niiri:design_matrix_png_id",
             location="file://path/to/DesignMatrix.png",
             filename="DesignMatrix.png",
             format="image/png"),
        "Group":
        dict(id="niiri:group_id",
             label="Group: Control",
             name="Control",
             numsubjects="23"),
        "Group-2":
        dict(id="niiri:group2_id",
             label="Group: Patient",
             name="Patient",
             numsubjects="21"),
        "Data_wasAttributedTo":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target="10000",
             scanner_id="niiri:mr_scanner_id",
             sub_or_group_id="niiri:group_id",
             group2_id="niiri:group2_id",
             mri_protocol=NLX_FMRI_PROTOCOL,
             mr_protocol=q_graph.qname(NLX_FMRI_PROTOCOL)),
        "ErrorModel":
        dict(error_model_id="niiri:error_model_id",
             noise_distribution="obo:STATO_0000227",
             variance_homo="true",
             variance_spatial="nidm:NIDM_0000073",
             dependence="nidm:NIDM_0000048",
             dependence_spatial="nidm:NIDM_0000073"),
        "ModelParametersEstimation":
        dict(model_pe_id="niiri:model_pe_id",
             label="Model parameters estimation",
             est_method=STATO_OLS_STR,
             est_method_comment=STATO_OLS_LABEL,
             design_matrix_id="niiri:design_matrix_id",
             data_matrix_id="niiri:data_id",
             error_model_id="niiri:error_model_id",
             software_id="niiri:software_id"),
        "ParameterEstimateMap_Location-1":
        dict(beta_map_id="niiri:beta_map_id_1",
             label="Parameter estimate 1",
             location="file://path/to/ParameterEstimate_0001.nii.gz",
             filename="ParameterEstimate_0001.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="f51b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "ParameterEstimateMap_Location-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Parameter estimate 2",
             location="file://path/to/ParameterEstimate_0002.nii.gz",
             filename="ParameterEstimate_0002.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="p89b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "CoordinateSpace-1":
        dict(
            coordinate_space_id="niiri:coordinate_space_id_1",
            label="Coordinate space 1",
            voxel_to_world_mapping="[[-3, 0, 0, 81],[0, 3, 0, -115],[0, 0, 3, \
-53],[0, 0, 0, 1]]",
            voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
            voxel_size="[ 3, 3, 3 ]",
            coord_system="nidm:NIDM_0000047",
            number_of_dim="3",
            dimensions="[ 53, 63, 46 ]"),
        "CoordinateSpace-2":
        dict(
            coordinate_space_id="niiri:coordinate_space_id_2",
            label="Coordinate space 2",
            voxel_to_world_mapping="[[-3, 0, 0, 81],[0, 3, 0, -115],[0, 0, 3, \
-53],[0, 0, 0, 1]]",
            voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
            voxel_size="[ 3, 3, 3 ]",
            coord_system="nidm:NIDM_0000047",
            number_of_dim="3",
            dimensions="[ 53, 63, 46 ]"),
        "ResidualMeanSquaresMap":
        dict(residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             label="Residual Mean Squares Map",
             location="file://path/to/ResidualMeanSquares.nii.gz",
             filename="ResidualMeanSquares.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "MaskMap_Analysis":
        dict(  # The analysis mask
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="file://path/to/Mask.nii.gz",
            filename="Mask.nii.gz",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            generated_by_act_id="niiri:model_pe_id",
            used_by_act_id="niiri:contrast_estimation_id"),
        "ContrastWeights":
        dict(contrast_id="niiri:contrast_id",
             label="Contrast weights: listening > rest",
             value="[ 1, 0, 0 ]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="listening > rest"),
        "ContrastEstimation":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             label="Contrast estimation",
             software_id="niiri:software_id",
             mask_id="niiri:mask_id_1",
             residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             design_matrix_id="niiri:design_matrix_id",
             contrast_id="niiri:contrast_id",
             param_est_map="niiri:beta_map_id_1"),
        "ContrastEstUsedParamEst-1-2":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             param_est_map="niiri:beta_map_id_2"),
        "ContrastMap":
        dict(
            contrast_map_id="niiri:contrast_map_id",
            label="Contrast Map: listening > rest",
            location="file://path/to/Contrast.nii.gz",
            format="image/nifti",
            filename="Contrast.nii.gz",
            contrast_name="listening > rest",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b\
97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastStandardErrorMap":
        dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map_\
id",
            label="Contrast Standard Error Map",
            location="file://path/to/ContrastStandardError.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id"),
        "FSL_DerivedMap-ContrastVariance":
        dict(derived_from_map_id="niiri:contrast_variance_map_id",
             derived_map_type="nidm:NIDM_0000135",
             filename="varcope1.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             map_id="niiri:contrast_standard_error_map_id"),
        "StatisticMap":
        dict(
            statistic_map_id="niiri:statistic_map_id",
            label="Statistic Map: listening > rest",
            location="file://path/to/TStatistic_0001.nii.gz",
            format="image/nifti",
            filename="TStatistic_0001.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="listening > rest",
            error_dof="73.0",
            effect_dof="1",
            sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b\
97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id"),
        "StatisticMap-Z":
        dict(
            statistic_map_id="niiri:z_statistic_map_id",
            label="Z-Statistic Map: listening > rest",
            location="file://path/to/ZStatistic_0001.nii.gz",
            format="image/nifti",
            filename="ZStatistic_0001.nii.gz",
            statistic_type=STATO_ZSTATISTIC_STR,
            contrast_name="listening > rest",
            error_dof="INF",
            effect_dof="1",
            sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b\
97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id"),
        "HeightThreshold_equivThresh_equivThresh2":
        dict(height_threshold_id="niiri:height_threshold_id",
             thresh_type=OBO_P_VALUE_FWER_QNAME,
             label="Height Threshold: p<0.05 (FWE)",
             value="0.05",
             equiv_thresh="niiri:height_threshold_id_2",
             equiv_thresh2="niiri:height_threshold_id_3"),
        "HeightThreshold-2":
        dict(height_threshold_id="niiri:height_threshold_id_2",
             thresh_type=OBO_STATISTIC_QNAME,
             label="Height Threshold",
             value="5.235300"),
        "HeightThreshold-3":
        dict(
            height_threshold_id="niiri:height_threshold_id_3",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold",
            value="0.000001",
        ),
        "ExtentThreshold":
        dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Cluster Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
        ),
        "DisplayMaskMap":
        dict(display_map_id="niiri:display_map_id",
             label="Display Mask Map",
             location="file://path/to/DisplayMask.nii.gz",
             format="image/nifti",
             user_defined="true",
             filename="DisplayMask.nii.gz",
             coordinate_space_id="niiri:coordinate_space_id_2",
             sha="e43b6e01b0463fe7d40782137867a"),
        "PeakDefinitionCriteria_MaxPeaks":
        dict(peak_definition_criteria_id="niiri:peak_definition_criteria_id",
             label="Peak Definition Criteria",
             max_num_peaks="3",
             min_dist_peaks="8.0"),
        "ClusterDefinitionCriteria":
        dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"),
        "Inference":
        dict(inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:z_statistic_map_id",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             display_mask_id="niiri:display_map_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "FSL_ExcursionSetMap":
        dict(
            id="niiri:excursion_set_map_id",
            label="Excursion Set Map",
            location="file://path/to/ExcursionSet.nii.gz",
            format="image/nifti",
            filename="ExcursionSet.nii.gz",
            cluster_label_map_id="niiri:cluster_label_map_id",
            png_id="niiri:excursion_set_png_id_1",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b\
97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            inference_id="niiri:inference_id"),
        "Image":
        dict(image_id="niiri:excursion_set_png_id_1",
             location="file://path/to/rendered_thresh_zstat1.png",
             filename="rendered_thresh_zstat1.png",
             format="image/png"),
        "FSL_SupraThresholdCluster-1":
        dict(cluster_id="niiri:supra_threshold_cluster_0001",
             label="Supra-Threshold Cluster 0001",
             cluster_size_in_voxels="530",
             cluster_label_id="1",
             p_value_fwe="0.000000",
             excursion_set_id="niiri:excursion_set_map_id"),
        "FSL_ClusterCenterOfGravity-1":
        dict(center_of_gravity_id="niiri:center_of_gravity_1",
             label="Center of gravity 1",
             location="niiri:COG_coordinate_0001",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-COG1":
        dict(
            coordinate_id="niiri:COG_coordinate_0001",
            label="Coordinate 1",
            coord="[ 40.2, 16.4, 13.2 ]",
            coord_in_vox="[ -30.8, -68.5, -13.4 ]",
        ),
        "FSL_SupraThresholdCluster-2":
        dict(cluster_id="niiri:supra_threshold_cluster_0002",
             label="Supra-Threshold Cluster 0002",
             cluster_size_in_voxels="445",
             cluster_label_id="2",
             p_value_fwe="0.000000",
             excursion_set_id="niiri:excursion_set_map_id"),
        "FSL_ClusterCenterOfGravity-2":
        dict(center_of_gravity_id="niiri:center_of_gravity_2",
             label="Center of gravity 2",
             location="niiri:COG_coordinate_0002",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "FSL_Coordinate-COG2":
        dict(coordinate_id="niiri:COG_coordinate_0002",
             label="Coordinate 2",
             coord="[ 25.6, 12.8, 14.6 ]",
             coord_in_vox="[ 24.1, -77.1, -4.27 ]"),
        "Peak-M1":
        dict(peak_id="niiri:peak_0001",
             label="Peak 1",
             p_uncorr="4.126074e-10",
             location="niiri:coordinate_0001",
             equiv_z="6.14",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-1":
        dict(
            coordinate_id="niiri:coordinate_0001",
            label="Coordinate 1",
            coord="[ -48.1, -73.7, -9.24 ]",
            coord_in_vox="[ 45, 15, 14 ]",
        ),
        "Peak-2":
        dict(peak_id="niiri:peak_0002",
             label="Peak 2",
             p_uncorr="7.705712e-10",
             location="niiri:coordinate_0002",
             equiv_z="6.04",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-2":
        dict(
            coordinate_id="niiri:coordinate_0002",
            label="Coordinate 2",
            coord="[ -38.1, -53.4, -18 ]",
            coord_in_vox="[ 42, 21, 13 ]",
        ),
        "Peak-3":
        dict(peak_id="niiri:peak_0003",
             label="Peak 3",
             p_uncorr="4.462172e-09",
             location="niiri:coordinate_0003",
             equiv_z="5.75",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-3":
        dict(
            coordinate_id="niiri:coordinate_0003",
            label="Coordinate 3",
            coord="[ -29.6, -73.8, -16.9 ]",
            coord_in_vox="[ 40, 15, 12 ]",
        ),
        "Peak-4":
        dict(peak_id="niiri:peak_0004",
             label="Peak 4",
             p_uncorr="4.462172e-09",
             location="niiri:coordinate_0004",
             equiv_z="5.75",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-4":
        dict(coordinate_id="niiri:coordinate_0004",
             label="Coordinate 4",
             coord="[ 0.791, -87.2, 3.23 ]",
             coord_in_vox="[ 39, 13, 12 ]"),
        "Peak-M5":
        dict(peak_id="niiri:peak_0005",
             label="Peak 5",
             p_uncorr="2.178976e-09",
             location="niiri:coordinate_0005",
             equiv_z="5.87",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "FSL_Coordinate-5":
        dict(coordinate_id="niiri:coordinate_0005",
             label="Coordinate 5",
             coord="[ 16.1, -96.6, 5.82 ]",
             coord_in_vox="[ 32, 10, 16 ]"),
        "Peak-6":
        dict(peak_id="niiri:peak_0006",
             label="Peak 6",
             p_uncorr="8.022392e-09",
             location="niiri:coordinate_0006",
             equiv_z="5.65",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "FSL_Coordinate-6":
        dict(coordinate_id="niiri:coordinate_0006",
             label="Coordinate 6",
             coord="[ -25.5, -80.4, 15.3 ]",
             coord_in_vox="[ 28, 7, 16 ]"),
        "FSL_SearchSpaceMaskMap":
        dict(
            search_space_id="niiri:search_space_mask_id",
            location="file://path/to/SearchSpaceMask.nii.gz",
            filename="SearchSpaceMask.nii.gz",
            label="Search Space Mask Map",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_2",
            search_vol_voxels="45359",
            search_vol_units="1.93808e+06",
            search_vol_resels="3753.84",
            resel_size="12.2251",
            noise_roughness="0.384676",
            random_field_station="true",
            sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b\
97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            inference_id="niiri:inference_id",
            noise_fwhm_in_voxels="[2.38803, 2.43263, 2.07288]",
            noise_fwhm_in_units="[8.35811, 8.5142, 7.2551]"),
        "NIDMBundle":
        dict(bundle_id="niiri:fsl_results_id",
             label="NIDM-Results",
             object_model="nidm:NIDM_0000027",
             version="1.1.0",
             time="2014-05-19T10:30:00.000+01:00",
             export_id="niiri:export_id"),
        "FSL_Software":
        dict(software_id="niiri:software_id",
             software_type="scr:SCR_002823",
             label="FSL",
             version="5.0.x",
             feat_version="6.00"),
        "ExporterSoftware":
        dict(software_id="niiri:exporter_id",
             software_type="nidm:NIDM_0000167",
             label="nidmfsl",
             version="0.2.0"),
        "Export":
        dict(export_id="niiri:export_id",
             label="NIDM-Results export",
             exporter_id="niiri:exporter_id"),
        "GrandMeanMap":
        dict(grand_mean_map_id="niiri:grand_mean_map_id",
             label="Grand Mean Map",
             location="file://path/to/GrandMean.nii.gz",
             filename="GrandMean.nii.gz",
             format="image/nifti",
             masked_median="115",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             model_pe_id="niiri:model_pe_id")
    }

    NIDM_FSL_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'fsl')
    ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_results.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
def main():
    nidm_classes = {
        "ImagingInstrument":
        dict(
            id="niiri:mr_scanner_id",
            label="MRI Scanner",
            type=q_graph.qname(NLX_MRI_SCANNER),
        ),
        "DesignMatrix_1stLevel":
        dict(design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             regressors='[\\\"Sn(1) active*bf(1)\\\", \\\"Sn(1) constant\\\"]',
             hrf_basis="spm:SPM_0000004",
             drift_model="niiri:drift_model_id"),
        "SPM_DriftModel":
        dict(id="niiri:drift_model_id",
             label="SPM's DCT Drift Model",
             cut_off="128"),
        "Image-DesignMatrix":
        dict(image_id="niiri:design_matrix_png_id",
             location="DesignMatrix.png",
             filename="DesignMatrix.png",
             format="image/png"),
        "Person":
        dict(id='niiri:subject_id', label="Person"),
        "Data":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target=100,
             scanner_id="niiri:mr_scanner_id",
             sub_or_group_id="niiri:subject_id",
             mr_protocol=q_graph.qname(NLX_FMRI_PROTOCOL)),
        "ErrorModel":
        dict(error_model_id="niiri:error_model_id",
             noise_distribution="obo:STATO_0000227",
             variance_homo="true",
             variance_spatial="nidm:NIDM_0000073",
             dependence="obo:STATO_0000357",
             dependence_spatial="nidm:NIDM_0000072"),
        "ModelParametersEstimation":
        dict(model_pe_id="niiri:model_pe_id",
             label="Model parameters estimation",
             est_method=STATO_GLS_STR,
             est_method_comment=STATO_GLS_LABEL,
             design_matrix_id="niiri:design_matrix_id",
             data_matrix_id="niiri:data_id",
             error_model_id="niiri:error_model_id",
             software_id="niiri:software_id"),
        "ParameterEstimateMap-1":
        dict(
            beta_map_id="niiri:beta_map_id_1",
            label="Parameter Estimate Map 1",
            coordinate_space_id="niiri:coordinate_space_id_1",
            filename="ParameterEstimate_0001.nii.gz",
            location="ParameterEstimate_0001.nii.gz",
            format="image/nifti",
            sha="fab2573099693215bac756bc796fbc983524473dec5c1b2d66fb83694c174\
12731df7f574094cb6c4a77994af7be11ed9aa545090fbe8ec6565a5c3c3dae8f0f",
            param_est_id="niiri:model_pe_id"),
        "ParameterEstimateMap-2":
        dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Parameter Estimate Map 2",
            coordinate_space_id="niiri:coordinate_space_id_1",
            filename="ParameterEstimate_0002.nii.gz",
            location="ParameterEstimate_0002.nii.gz",
            format="image/nifti",
            sha="3f72b788762d9ab2c7ddb5e4d446872694ee42fc8897fe5317b54efb7924f\
784da6499065db897a49595d8763d1893ad65ad102b0c88f2e72e2d028173343008",
            param_est_id="niiri:model_pe_id"),
        "DerivedMap-ParameterEstimateMap-1":
        dict(
            derived_from_map_id="niiri:beta_map_id_1_der",
            derived_map_type="nidm:NIDM_0000061",
            filename="beta_0001.nii",
            format="image/nifti",
            sha="fab2573099693215bac756bc796fbc983524473dec5c1b2d66fb83694c174\
12731df7f574094cb6c4a77994af7be11ed9aa545090fbe8ec6565a5c3c3dae8f0f",
            map_id="niiri:beta_map_id_1"),
        "DerivedMap-ParameterEstimateMap-2":
        dict(
            derived_from_map_id="niiri:beta_map_id_2_der",
            derived_map_type="nidm:NIDM_0000061",
            filename="beta_0002.nii",
            format="image/nifti",
            sha="3f72b788762d9ab2c7ddb5e4d446872694ee42fc8897fe5317b54efb7924f\
784da6499065db897a49595d8763d1893ad65ad102b0c88f2e72e2d028173343008",
            map_id="niiri:beta_map_id_2"),
        "CoordinateSpace-1":
        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:NIDM_0000050",
            number_of_dim="3",
            dimensions="[ 53, 63, 52 ]"),
        "ResidualMeanSquaresMap":
        dict(
            residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
            label="Residual Mean Squares Map",
            location="ResidualMeanSquares.nii.gz",
            filename="ResidualMeanSquares.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="84cd0e608b8763307a1166b88761291e552838d85b58334a69a286060f648\
9a3b0929a940c3ccac883803455118787ea32e0bb5a6d236a5d6e9e8b6a9f918a6b",
            param_est_id="niiri:model_pe_id"),
        "DerivedMap-RMSMap":
        dict(
            derived_from_map_id="niiri:residual_mean_squares_map_id_der",
            derived_map_type="nidm:NIDM_0000066",
            filename="ResMS.nii",
            format="image/nifti",
            sha="1635e0ae420cac1b5989fbc753b95f504dd957ff2986367fc4cd13ff35c44\
b4ee60994a9cdcab93a7d247fc5a8decb7578fa4c553b0ac905af8c7041db9b4acd",
            map_id="niiri:residual_mean_squares_map_id"),
        "MaskMap_Analysis":
        dict(  # The "analysis mask"
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="Mask.nii.gz",
            user_defined="false",
            filename="Mask.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="932fd9f0d55e9822748f4a9b35a0a7f0fe442f3e061e2eda48c2617a2938d\
f50ea84deca8de0725641a0105b712a80a0c8931df9bdf3bef788b1041379d00875",
            generated_by_act_id="niiri:model_pe_id",
            used_by_act_id="niiri:contrast_estimation_id"),
        "DerivedMap-Mask2":
        dict(  # The "analysis mask" (derived)
            derived_from_map_id="niiri:mask_id_1_der",
            derived_map_type="nidm:NIDM_0000054",
            filename="mask.nii",
            format="image/nifti",
            sha="fbc254cab29db5532feccce554ec9d3c845197eca9013ec9f0efd5d8d56e3\
aa008ccee4038fb3651d30447fa0f316938b07c3ad961b623458dcd9b46968a8e11",
            map_id="niiri:mask_id_1"),
        "ContrastWeights":
        dict(contrast_id="niiri:contrast_id",
             label="Contrast: passive listening > rest",
             value="[1, 0]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="passive listening > rest"),
        "ContrastEstimation":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             label="Contrast estimation",
             software_id="niiri:software_id",
             mask_id="niiri:mask_id_1",
             residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             design_matrix_id="niiri:design_matrix_id",
             contrast_id="niiri:contrast_id",
             param_est_map="niiri:beta_map_id_1"),
        "ContrastEstUsedParamEst-Con1PE2":
        dict(contrast_estimation_id="niiri:contrast_estimation_id",
             param_est_map="niiri:beta_map_id_2"),
        "ContrastMap":
        dict(
            contrast_map_id="niiri:contrast_map_id",
            label="Contrast Map: passive listening > rest",
            location="Contrast.nii.gz",
            format="image/nifti",
            filename="Contrast.nii.gz",
            contrast_name="passive listening > rest",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="f0720b732aaf19c2ec42d0469f8308beb3aa978baf65c7dce6476a0d8e5b2\
f38c4fa9609f045a536678440feebce9a047e3bd6d59fdb8fb64baae058690bbda2",
            contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastStandardErrorMap":
        dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map_\
id",
            label="Contrast Standard Error Map",
            location="ContrastStandardError.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="f4e3616579fe8b0812469409b1501e391bb17ca6e364f37d622b37fa9014c\
f1dd89befece07e73cf5bca5b3116f55ac4496751ca990db85e8377001a4be941b2",
            contrast_est_id="niiri:contrast_estimation_id"),
        "StatisticMap-T":
        dict(
            statistic_map_id="niiri:statistic_map_id",
            label="T-Statistic Map: passive listening > rest",
            location="TStatistic.nii.gz",
            format="image/nifti",
            filename="TStatistic.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="passive listening > rest",
            error_dof="84.0",
            effect_dof="1",
            sha="799e9bbf8c15b35c0098bca468846bf2cd895a3366382b5ceaa953f1e9e57\
6955341a7c86e13e6fe9359da4ff1496a609f55ce9ecff8da2e461365372f2506d6",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id"),
        "DerivedMap-StatMap":
        dict(derived_from_map_id="niiri:statistic_map_id_der",
             derived_map_type="nidm:NIDM_0000076",
             filename="spmT_0001.nii",
             format="image/nifti",
             sha="55951f31f0ede7e88eca5cd4793df3f630aba21bc90fb81e3695db060c7d\
4c0b0ccf0b51fd8958c32ea3253d3122e9b31a54262bf910f8b5b646054ceb9a5825",
             map_id="niiri:statistic_map_id"),
        "HeightThreshold_equivThresh_equivThresh2":
        dict(height_threshold_id="niiri:height_threshold_id",
             thresh_type=OBO_P_VALUE_FWER_QNAME,
             label="Height Threshold: p<0.050000 (FWE)",
             value="0.05",
             equiv_thresh="niiri:height_threshold_id_2",
             equiv_thresh2="niiri:height_threshold_id_3"),
        "HeightThreshold-2":
        dict(height_threshold_id="niiri:height_threshold_id_2",
             thresh_type=OBO_STATISTIC_QNAME,
             label="Height Threshold",
             value="4.85241745689539"),
        "HeightThreshold-3":
        dict(
            height_threshold_id="niiri:height_threshold_id_3",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold",
            value="2.7772578456986e-06",
        ),
        "ExtentThresholdStat_equivThresh_equivThresh2_clusterSizeResels":
        dict(extent_threshold_id="niiri:extent_threshold_id",
             label="Extent Threshold: k>=0",
             cluster_size_vox="0",
             cluster_size_resels="0",
             equiv_thresh="niiri:extent_threshold_id_2",
             equiv_thresh2="niiri:extent_threshold_id_3"),
        "ExtentThreshold-2":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_2",
            label="Extent Threshold",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="1",
        ),
        "ExtentThreshold-3":
        dict(
            extent_threshold_id="niiri:extent_threshold_id_3",
            label="Extent Threshold",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            value="1",
        ),
        "PeakDefinitionCriteria_MaxPeaks":
        dict(peak_definition_criteria_id="niiri:peak_definition_criteria_id",
             label="Peak Definition Criteria",
             max_num_peaks="3",
             min_dist_peaks="8.0"),
        "ClusterDefinitionCriteria":
        dict(cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
             label="Cluster Connectivity Criterion: 18",
             connectivity="nidm:NIDM_0000128"),
        "Inference":
        dict(inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:statistic_map_id",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             Inference_mask_id="niiri:sub_volume_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "ExcursionSetMap":
        dict(
            id="niiri:excursion_set_map_id",
            label="Excursion Set Map",
            location="ExcursionSet.nii.gz",
            format="image/nifti",
            filename="ExcursionSet.nii.gz",
            cluster_label_map_id="niiri:cluster_label_map_id",
            max_intensity_projection_id="niiri:maximum_intensity_projection\
_id",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="d96b82761c299a66978893cab6034f3f8aed25d0a135636b0ffe79f4cf11b\
ecce86ba261f7aeb43717f5d0e47ad0b14cfb0402786251e3f2c507890c83b27652",
            num_of_clusters="5",
            p_value="2.83510681598e-09",
            inference_id="niiri:inference_id"),
        "SupraThresholdCluster-1":
        dict(cluster_id="niiri:supra_threshold_cluster_0001",
             label="Supra-Threshold Cluster: 0001",
             cluster_size_in_voxels="839",
             cluster_label_id="1",
             cluster_size_in_resels="6.31265696809113",
             p_value_unc="3.55896824480477e-19",
             p_value_fwe="0",
             p_value_fdr="1.77948412240239e-18",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-2":
        dict(cluster_id="niiri:supra_threshold_cluster_0002",
             label="Supra-Threshold Cluster: 0002",
             cluster_size_in_voxels="695",
             cluster_label_id="2",
             cluster_size_in_resels="5.22919736927692",
             p_value_unc="5.34280282632073e-17",
             p_value_fwe="0",
             p_value_fdr="1.33570070658018e-16",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-3":
        dict(cluster_id="niiri:supra_threshold_cluster_0003",
             label="Supra-Threshold Cluster: 0003",
             cluster_size_in_voxels="37",
             cluster_label_id="3",
             cluster_size_in_resels="0.278388924695318",
             p_value_unc="0.00497953247554004",
             p_value_fwe="0.000255384009130943",
             p_value_fdr="0.00829922079256674",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-4":
        dict(cluster_id="niiri:supra_threshold_cluster_0004",
             label="Supra-Threshold Cluster: 0004",
             cluster_size_in_voxels="29",
             cluster_label_id="4",
             cluster_size_in_resels="0.218196724761195",
             p_value_unc="0.0110257032104773",
             p_value_fwe="0.000565384750377596",
             p_value_fdr="0.0137821290130967",
             excursion_set_id="niiri:excursion_set_map_id"),
        "SupraThresholdCluster-5":
        dict(cluster_id="niiri:supra_threshold_cluster_0005",
             label="Supra-Threshold Cluster: 0005",
             cluster_size_in_voxels="12",
             cluster_label_id="5",
             cluster_size_in_resels="0.0902882999011843",
             p_value_unc="0.0818393184514307",
             p_value_fwe="0.00418900977248904",
             p_value_fdr="0.0818393184514307",
             excursion_set_id="niiri:excursion_set_map_id"),
        "Peak_ValueP-1":
        dict(peak_id="niiri:peak_0001",
             label="Peak: 0001",
             location="niiri:coordinate_0001",
             value="17.5207633972168",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="1.19156591713838e-11",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-1":
        dict(coordinate_id="niiri:coordinate_0001",
             label="Coordinate: 0001",
             coord="[ -60, -25, 11 ]"),
        "Peak_ValueP-2":
        dict(peak_id="niiri:peak_0002",
             label="Peak: 0002",
             location="niiri:coordinate_0002",
             value="13.0321407318",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="1.19156591714e-11",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-2":
        dict(coordinate_id="niiri:coordinate_0002",
             label="Coordinate: 0002",
             coord="[ -42, -31, 11 ]"),
        "Peak_ValueP-3":
        dict(peak_id="niiri:peak_0003",
             label="Peak: 0003",
             location="niiri:coordinate_0003",
             value="10.2856016159058",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="7.69451169446711e-12",
             p_value_fdr="6.84121260274992e-10",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate-3":
        dict(coordinate_id="niiri:coordinate_0003",
             label="Coordinate: 0003",
             coord="[ -66, -31, -1 ]"),
        "Peak_ValueP-4":
        dict(peak_id="niiri:peak_0004",
             label="Peak: 0004",
             location="niiri:coordinate_0004",
             value="13.5425577163696",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="1.19156591713838e-11",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-4":
        dict(coordinate_id="niiri:coordinate_0004",
             label="Coordinate: 0004",
             coord="[ 63, -13, -4 ]"),
        "Peak_ValueP-5":
        dict(peak_id="niiri:peak_0005",
             label="Peak: 0005",
             location="niiri:coordinate_0005",
             value="12.4728717803955",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="1.19156591713838e-11",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-5":
        dict(coordinate_id="niiri:coordinate_0005",
             label="Coordinate: 0005",
             coord="[ 60, -22, 11 ]"),
        "Peak_ValueP-6":
        dict(peak_id="niiri:peak_0006",
             label="Peak: 0006",
             location="niiri:coordinate_0006",
             value="9.72103404998779",
             equiv_z="INF",
             p_uncorr="1.22124532708767e-15",
             p_value_fwe="6.9250605250204e-11",
             p_value_fdr="6.52169693024352e-09",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "Coordinate-6":
        dict(coordinate_id="niiri:coordinate_0006",
             label="Coordinate: 0006",
             coord="[ 57, -40, 5 ]"),
        "Peak_ValueP-7":
        dict(peak_id="niiri:peak_0007",
             label="Peak: 0007",
             location="niiri:coordinate_0007",
             value="6.55745935440063",
             equiv_z="5.87574033699266",
             p_uncorr="2.10478867668229e-09",
             p_value_fwe="9.17574302586877e-05",
             p_value_fdr="0.00257605396646668",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "Coordinate-7":
        dict(coordinate_id="niiri:coordinate_0007",
             label="Coordinate: 0007",
             coord="[ 36, -28, -13 ]"),
        "Peak_ValueP-8":
        dict(peak_id="niiri:peak_0008",
             label="Peak: 0008",
             location="niiri:coordinate_0008",
             value="6.19558477401733",
             equiv_z="5.60645028016544",
             p_uncorr="1.0325913235576e-08",
             p_value_fwe="0.000382453907303626",
             p_value_fdr="0.00949154522981781",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "Coordinate-8":
        dict(coordinate_id="niiri:coordinate_0008",
             label="Coordinate: 0008",
             coord="[ -33, -31, -16 ]"),
        "Peak_ValueP-9":
        dict(peak_id="niiri:peak_0009",
             label="Peak: 0009",
             location="niiri:coordinate_0009",
             value="5.27320194244385",
             equiv_z="4.88682085490477",
             p_uncorr="5.12386299833523e-07",
             p_value_fwe="0.0119099090973821",
             p_value_fdr="0.251554254717758",
             cluster_id="niiri:supra_threshold_cluster_0005"),
        "Coordinate-9":
        dict(coordinate_id="niiri:coordinate_0009",
             label="Coordinate: 0009",
             coord="[ 45, -40, 32 ]"),
        "SearchSpaceMaskMap":
        dict(  # The "search space"
            search_space_id="niiri:search_space_mask_id",
            location="SearchSpaceMask.nii.gz",
            filename="SearchSpaceMask.nii.gz",
            label="Search Space Mask Map",
            format="image/nifti",
            user_defined="false",
            coordinate_space_id="niiri:coordinate_space_id_1",
            expected_num_voxels="4.02834655908613",
            expected_num_clusters="0.0512932943875478",
            height_critical_fwe05="4.85241745689539",
            height_critical_fdr05="5.7639536857605",
            smallest_size_fwe05="12",
            smallest_size_fdr05="29",
            search_vol_voxels="69306",
            search_vol_units="1871262",
            resel_size="132.907586178202",
            search_vol_resels="467.07642343881",
            search_vol_resels_geom="[7, 42.96312274763, 269.40914815306, \
467.07642343881]",
            noise_fwhm_in_voxels="[ 5.41278985910694, 5.43638957240286, \
4.51666658877481 ]",
            noise_fwhm_in_units="[ 16.2383695773208, 16.3091687172086, \
13.5499997663244 ]",
            random_field_station="true",
            sha="932fd9f0d55e9822748f4a9b35a0a7f0fe442f3e061e2eda48c2617a2938\
df50ea84deca8de0725641a0105b712a80a0c8931df9bdf3bef788b1041379d00875",
            inference_id="niiri:inference_id"),
        "DerivedMap":
        dict(
            derived_from_map_id="niiri:contrast_map_id_der",
            derived_map_type="nidm:NIDM_0000002",
            filename="con_0001.nii",
            format="image/nifti",
            sha="277dd1da13d391c33c172fb8c71060008cc66e173de6362eb857b0055b41e\
9bae57911f7ec4b45659905103b1139ebf3da0c2d04cf105bbce0cdc3004b643c22",
            map_id="niiri:contrast_map_id"),
        "NIDMBundle":
        dict(bundle_id="niiri:spm_results_id",
             label="NIDM-Results",
             object_model="nidm:NIDM_0000027",
             version="1.3.0",
             time="2014-05-19T10:30:00.000+01:00",
             export_id="niiri:export_id"),
        "SPM_ReselsPerVoxelMap":
        dict(
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
            label="Resels per Voxel Map",
            location="ReselsPerVoxel.nii.gz",
            filename="ReselsPerVoxel.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="2025dc6c33708b80708c2eba3215fb1149df236fb558a8e8f8f6cf34595fb\
54734fe5e436db3e192a424d99699dd7feb2f4a9020ceae8e7bcbd881b17825256a",
            model_pe_id="niiri:model_pe_id"),
        "SPM_InferenceUsedRPVMap":
        dict(inference_id="niiri:inference_id",
             resels_per_voxel_map_id="niiri:resels_per_voxel_map_id"),
        "DerivedMap-RPVMap":
        dict(
            derived_from_map_id="niiri:resels_per_voxel_map_id_der",
            derived_map_type="nidm:NIDM_0000144",
            filename="RPV.nii",
            format="image/nifti",
            sha="963283cdde607c40e4640c27453867bd0d70133b6d61482933862487c0f4a\
5acdb2e338a12a2605ee044b1aa47b5717f0c520b90ed3c49b5227f0483bd48512d",
            map_id="niiri:resels_per_voxel_map_id"),
        "ClusterLabelsMap":
        dict(
            cluster_label_map_id="niiri:cluster_label_map_id",
            location="ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti",
            label="Cluster Labels Map",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="a132bb284da461fd9e20eb2986373a9171c90a342c1e694297bc02f5674a3\
11a560b7ff34bdf045dc191d4afff8c690a373db6408c1fe93f7c25e23707ce65c3"),
        "SPM_Software":
        dict(software_id="niiri:software_id",
             software_type="scr:SCR_007037",
             label="SPM",
             version="12.12.1"),
        "Image":
        dict(image_id="niiri:maximum_intensity_projection_id",
             location="MaximumIntensityProjection.png",
             filename="MaximumIntensityProjection.png",
             format="image/png"),
        "GrandMeanMap":
        dict(
            grand_mean_map_id="niiri:grand_mean_map_id",
            label="Grand Mean Map",
            location="GrandMean.nii.gz",
            filename="GrandMean.nii.gz",
            format="image/nifti",
            masked_median="132.008995056152",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="4d3528031bce4a9c1b994b8124e6e0eddb9df90b49c84787652ed94df8c14\
c04ec92100a2d8ea86a8df24ba44617aca7457ddcb2f42253fc17e33296a1aea1cb",
            model_pe_id="niiri:model_pe_id"),
        "ExporterSoftware":
        dict(software_id="niiri:exporter_id",
             software_type="nidm:NIDM_0000168",
             label="spm_results_nidm",
             version="12b.5858"),
        "Export":
        dict(export_id="niiri:export_id",
             label="NIDM-Results export",
             exporter_id="niiri:exporter_id")
    }

    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, 'example001_spm_results.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
示例#5
0
def main():
    nidm_classes = {
        "NIDMBundle":
        dict(comment="NIDM-Results Bundle",
             bundle_id="niiri:nidm_results_id",
             label="NIDM-Results",
             object_model="nidm:NIDM_0000027",
             version="1.1.0",
             time="2014-05-19T10:30:00.000+01:00",
             export_id="niiri:export_id"),
        "SPM_Software":
        dict(software_id="niiri:spm_software_id",
             software_type="scr:SCR_007037",
             label="SPM",
             version="8.6225"),
        "FSL_Software":
        dict(software_id="niiri:software_id",
             software_type="scr:SCR_002823",
             label="FSL",
             version="5.0.1",
             feat_version="6.00"),
        "ExporterSoftware-FSL":
        dict(software_id="niiri:exporter_id",
             software_type="nidm:NIDM_0000167",
             label="nidmfsl",
             version="0.2.0"),
        "Export":
        dict(export_id="niiri:export_id",
             label="NIDM-Results export",
             exporter_id="niiri:exporter_id"),
        "ExporterSoftware-SPM":
        dict(software_id="niiri:exporter_id",
             software_type="nidm:NIDM_0000168",
             label="spm_results_nidm",
             version="12b.5858"),
        "DesignMatrix":
        dict(comment="Design Matrix: Group Level",
             design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id"),
        "DesignMatrix_1stLevel":
        dict(comment="Design Matrix: Subject Level",
             design_matrix_id='niiri:first_level_design_matrix_id',
             label="First-Level Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             hrf_basis="niiri:hrf_basis_id",
             drift_model="niiri:drift_model_id",
             regressors="[\\\"Sn(1) active*bf(1)\\\",\\\"Sn(1) constant\\\"]"),
        "DesignMatrix_1stLevel-FIR":
        dict(comment="HRF: FIR Basis Set",
             design_matrix_id='niiri:first_level_design_matrix_id',
             label="First-Level Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             hrf_basis=NIDM_FINITE_IMPULSE_RESPONSE_HRB,
             drift_model="niiri:drift_model_id",
             regressors="[\\\"Sn(1) active*bf(1)\\\",\\\"Sn(1) constant\\\"]"),
        "DesignMatrix_1stLevel_HRFBasis2_HRFBasis3-InformedBasisSet":
        dict(comment="HRF: SPM's Informed Basis Set",
             design_matrix_id='niiri:first_level_design_matrix_id',
             label="First-Level Design Matrix",
             location="DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             hrf_basis=SPM_CANONICAL_HRF,
             hrf_basis_2=SPM_TEMPORAL_DERIVATIVE,
             hrf_basis_3=SPM_DISPERSION_DERIVATIVE,
             drift_model="niiri:drift_model_id",
             regressors="[\\\"Sn(1) active*bf(1)\\\",\\\"Sn(1) constant\\\"]"),
        "Map_atLocation-nii":
        dict(comment="Map: One-file Nifti (.nii)",
             map_type="nidm:NIDM_0000052",
             map_id="niiri:map_id",
             filename='image.nii',
             coordinate_space_id="niiri:coordinate_space_id",
             sha="e43b6e01b0463fe7d40782137867ae43b6e01b0463fe7d40782137867a",
             location="image.nii"),
        "Map_atLocation_hasMapHeader-img":
        dict(comment="Map: Nifti (.img)",
             map_type="nidm:NIDM_0000052",
             map_id="niiri:map_id",
             filename='image.img',
             coordinate_space_id="niiri:coordinate_space_id",
             sha="e43b6e01b0463fe7d40782137867ae43b6e01b0463fe7d40782137867a",
             map_header="niiri:map_header_id",
             location="image.img"),
        "MapHeader":
        dict(comment="Map Header: Nifti header (.hdr)",
             map_header_id="niiri:map_header_id",
             filename='image.hdr',
             sha="e43b6e01b0463fe7d40782137867ae43b6e01b0463fe7d40782137867a",
             location="image.hdr"),
        "Image-DesignMatrix":
        dict(comment="Image: Design Matrix",
             image_id="niiri:design_matrix_png_id",
             location="DesignMatrix.png",
             filename="DesignMatrix.png",
             format="image/png"),
        "Group":
        dict(id="niiri:group_id",
             label="Group: Control",
             name="Control",
             numsubjects="23"),
        "Group-2":
        dict(id="niiri:group2_id",
             label="Group: Patient",
             name="Patient",
             numsubjects="21"),
        "Data_wasAttributedTo":
        dict(
            comment="Data",
            data_id='niiri:data_id',
            label="Data",
            scaling="true",
            target=100,
            scanner_id="niiri:my_scanner_id",
            sub_or_group_id="niiri:group_id",
            group2_id="niiri:group2_id",
            mr_protocol=q_graph.qname(NLX_FMRI_PROTOCOL),
        ),
        "ImagingInstrument":
        dict(
            id="niiri:mr_scanner_id",
            label="MRI Scanner",
            type=q_graph.qname(NLX_MRI_SCANNER),
        ),
        "ErrorModel":
        dict(comment="Error Model",
             error_model_id="niiri:error_model_id",
             noise_distribution="obo:STATO_0000227",
             variance_homo="true",
             variance_spatial="nidm:NIDM_0000073",
             dependence="nidm:NIDM_0000048",
             dependence_spatial="nidm:NIDM_0000073"),
        "ErrorModel-SPMnonSphericity":
        dict(comment="Error Model: SPM non sphericity",
             error_model_id="niiri:error_model_id",
             noise_distribution="obo:STATO_0000227",
             variance_homo="false",
             variance_spatial=NIDM_SPATIALLY_LOCAL_MODEL,
             dependence=STATO_UNSTRUCTURED_COVARIANCE,
             dependence_spatial=NIDM_SPATIALLY_GLOBAL_MODEL),
        "ModelParametersEstimation":
        dict(comment="Model Parameters Estimation",
             model_pe_id="niiri:model_pe_id",
             label="Model parameters estimation",
             est_method=STATO_OLS_STR,
             est_method_comment=STATO_OLS_LABEL,
             software_id="niiri:software_id",
             design_matrix_id="niiri:design_matrix_id",
             data_matrix_id="niiri:data_id",
             error_model_id="niiri:error_model_id"),
        "ParameterEstimateMap":
        dict(comment="Parameter Estimate Map",
             beta_map_id="niiri:beta_map_id_1",
             label="Beta Map 1",
             location="ParameterEstimate_0001.nii.gz",
             filename="ParameterEstimate_0001.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "ResidualMeanSquaresMap":
        dict(comment="Residual Mean Squares Map",
             residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             label="Residual Mean Squares Map",
             location="ResidualMeanSquares.nii.gz",
             filename="ResidualMeanSquares.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             param_est_id="niiri:model_pe_id"),
        "MaskMap":
        dict(comment="Mask Map",
             mask_id="niiri:mask_id_2",
             user_defined="false",
             label="Mask",
             location="Mask.nii.gz",
             filename="Mask.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             used_by_act_id="niiri:model_pe_id"),
        "ContrastWeights":
        dict(comment="Contrast Weights",
             contrast_id="niiri:contrast_id",
             label="Contrast: Listening > Rest",
             value="[ 1, 0, 0 ]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="listening > rest"),
        "ContrastEstimation":
        dict(comment="Contrast Estimation",
             contrast_estimation_id="niiri:contrast_estimation_id",
             label="Contrast estimation",
             software_id="niiri:software_id",
             mask_id="niiri:mask_id_2",
             residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
             design_matrix_id="niiri:design_matrix_id",
             contrast_id="niiri:contrast_id",
             param_est_map="niiri:beta_map_id_1"),
        "ContrastMap":
        dict(comment="Contrast Map",
             contrast_map_id="niiri:contrast_map_id",
             label="Contrast Map: listening > rest",
             location="Contrast.nii.gz",
             format="image/nifti",
             filename="Contrast.nii.gz",
             contrast_name="listening > rest",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             contrast_est_id="niiri:contrast_estimation_id"),
        "ContrastStandardErrorMap":
        dict(
            comment="Contrast Standard Error Map",
            contrast_standard_error_map_id="niiri:contrast_standard_error_map_\
id",
            label="Contrast Standard Error Map",
            location="ContrastStandardError.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            contrast_est_id="niiri:contrast_estimation_id"),
        "StatisticMap_T":
        dict(comment="Statistic Map: T",
             statistic_map_id="niiri:statistic_map_id",
             label="Statistic Map: listening > rest",
             location="TStatistic.nii.gz",
             format="image/nifti",
             filename="TStatistic.nii.gz",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="listening > rest",
             error_dof="72.9999999990787",
             effect_dof="1",
             sha="e43b6e01b0463fe7d40782137867a",
             coordinate_space_id="niiri:coordinate_space_id_1",
             contrast_est_id="niiri:contrast_estimation_id"),
        "HeightThreshold_equivThresh-FWER":
        dict(comment="Height Threshold: p<0.05 FWER",
             height_threshold_id="niiri:height_threshold_fwer_id",
             label="Height Threshold: p<0.05 (FWER-corrected)",
             value="0.05",
             thresh_type=OBO_P_VALUE_FWER_QNAME,
             equiv_thresh="niiri:height_threshold_stat_id"),
        "HeightThreshold-Stat":
        dict(
            comment="Height Threshold: Z<0.0000000672357409",
            height_threshold_id="niiri:height_threshold_stat_id",
            label="Height Threshold: Z<0.0000000672357409",
            value="0.0000000672357409",
            thresh_type=OBO_STATISTIC_QNAME,
        ),
        "HeightThreshold-FDR":
        dict(comment="Height Threshold: p<0.05 FDR",
             height_threshold_id="niiri:height_threshold_fdr_id",
             label="Height Threshold: p<0.05 (FDR-corrected)",
             value="0.05",
             thresh_type=OBO_Q_VALUE_FDR_QNAME),
        "HeightThreshold-Unc":
        dict(comment="Height Threshold: p<0.001 uncorrected",
             height_threshold_id="niiri:height_threshold_unc_id",
             label="Height Threshold: p<0.001 (uncorrected)",
             value="0.001",
             thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME),
        "ExtentThresholdStat_clusterSizeResels":
        dict(
            comment="Extent Threshold: k>=0",
            extent_threshold_id="niiri:extent_threshold_stat_id",
            label="Extent Threshold: k>=0",
            cluster_size_vox="0",
            cluster_size_resels="0",
        ),
        "ExtentThreshold_equivThresh-FWER":
        dict(comment="Extent Threshold: p<0.05 FWER",
             extent_threshold_id="niiri:extent_threshold_fwer_id",
             thresh_type=OBO_P_VALUE_FWER_QNAME,
             label="Extent Threshold: p<0.05 (FWER-corrected)",
             value="0.05",
             equiv_thresh="niiri:extent_threshold_stat_id"),
        "ExtentThreshold-FDR":
        dict(comment="Extent Threshold: p<0.05 FDR",
             extent_threshold_id="niiri:extent_threshold_fdr_id",
             thresh_type=OBO_Q_VALUE_FDR_QNAME,
             label="Extent Threshold: p<0.05 (FDR-corrected)",
             value="0.05"),
        "ExtentThreshold-Unc":
        dict(comment="Extent Threshold: p<0.001 uncorrected",
             extent_threshold_id="niiri:extent_threshold_unc_id",
             thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
             label="Extent Threshold: p<0.001 (uncorrected)",
             value="0.001"),
        "SPM_ReselsPerVoxelMap":
        dict(comment="Resels per Voxel Map",
             resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
             label="Resels per Voxel Map",
             location="ReselsPerVoxel.nii.gz",
             filename="ReselsPerVoxel.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             model_pe_id="niiri:model_pe_id"),
        "ClusterLabelsMap":
        dict(comment="Cluster Labels Map",
             cluster_label_map_id="niiri:cluster_label_map_id",
             location="ClusterLabels.nii.gz",
             filename="ClusterLabels.nii.gz",
             format="image/nifti"),
        "DisplayMaskMap":
        dict(comment="Display Mask Map",
             display_map_id="niiri:display_map_id",
             label="Display Mask Map",
             location="DisplayMask.nii.gz",
             filename="DisplayMask.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_2",
             sha="e43b6e01b0463fe7d40782137867a"),
        "PeakDefinitionCriteria_MaxPeaks":
        dict(comment="Peak Definition Criteria",
             peak_definition_criteria_id="niiri:peak_definition_criteria_id",
             label="Peak Definition Criteria",
             max_num_peaks="3",
             min_dist_peaks="8.0"),
        "ClusterDefinitionCriteria":
        dict(
            comment="Cluster Definition Criteria",
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"),
        "Inference":
        dict(comment="Inference",
             inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:statistic_map_id",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             inference_mask_id="niiri:mask_id_3",
             display_mask_id="niiri:display_map_id",
             mask_id="niiri:mask_id",
             software_id="niiri:software_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id"),
        "ConjunctionInference":
        dict(comment="Conjunction Inference",
             conj_inference_id="niiri:inference_id",
             label="Conjunction Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id_1="niiri:statistic_map_id",
             stat_map_id_2="niiri:statistic_map_id_2",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             display_mask_id="niiri:display_map_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "SPM_KConjunctionInference":
        dict(comment="SPM's Partial Conjunction Inference",
             conj_inference_id="niiri:conjunction_id_2",
             label="SPM's Partial Conjunction Inference",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id_1="niiri:statistic_map_id_1",
             stat_map_id_2="niiri:statistic_map_id_2",
             global_null_degree="1",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             display_mask_id="niiri:display_map_id",
             peak_def_id="niiri:peak_definition_criteria_id",
             cluster_def_id="niiri:cluster_definition_criteria_id",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "ExcursionSetMap":
        dict(comment="Excursion Set Map",
             id="niiri:excursion_set_map_id",
             label="Excursion Set Map",
             location="ExcursionSet.nii.gz",
             format="image/nifti",
             filename="ExcursionSet.nii.gz",
             cluster_label_map_id="niiri:cluster_label_map_id",
             max_intensity_projection_id="niiri:maximum_intensity_projection_\
id",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             num_of_clusters="8",
             p_value="8.95949980872501e-14",
             inference_id="niiri:inference_id"),
        "SupraThresholdCluster":
        dict(comment="Supra-Threshold Cluster",
             cluster_id="niiri:supra_threshold_cluster_0001",
             label="Supra-Threshold Cluster 0001",
             cluster_size_in_voxels="530",
             cluster_label_id="1",
             cluster_size_in_resels="23.1209189500945",
             p_value_unc="9.56276736481136e-52",
             p_value_fwe="0",
             p_value_fdr="7.65021389184909e-51",
             excursion_set_id="niiri:excursion_set_map_id"),
        "Peak_ValueP":
        dict(comment="Peak",
             peak_id="niiri:peak_0001",
             label="Peak 0001",
             location="niiri:coordinate_0001",
             value="13.9346199035645",
             equiv_z="INF",
             p_uncorr="4.44089209850063e-16",
             p_value_fwe="0",
             p_value_fdr="6.3705194444993e-11",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "Coordinate":
        dict(comment="Coordinate",
             coordinate_id="niiri:coordinate_0001",
             label="Coordinate: 0001",
             coord="[ -60, -28, 13 ]"),
        "SearchSpaceMaskMap":
        dict(comment="Search Space Mask Map",
             search_space_id="niiri:search_space_mask_id",
             location="SearchSpaceMask.nii.gz",
             filename="SearchSpaceMask.nii.gz",
             label="Search Space Mask Map",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_2",
             expected_num_voxels="0.553331387916112",
             expected_num_clusters="0.0889172687960151",
             height_critical_fwe05="5.23529984739211",
             height_critical_fdr05="6.22537899017334",
             smallest_size_fwe05="1",
             smallest_size_fdr05="3",
             search_vol_voxels="65593",
             search_vol_units="1771011",
             resel_size="22.9229643140043",
             search_vol_resels="2552.68032521656",
             search_vol_resels_geom="[3, 72.3216126440484, 850.716735116472, \
2552.68032521656]",
             noise_fwhm_in_voxels="[ 2.95881189165801, 2.96628446669584, \
2.61180425626264 ]",
             noise_fwhm_in_units="[ 8.87643567497404, 8.89885340008753, \
7.83541276878791 ]",
             random_field_station="false",
             sha="e43b6e01b0463fe7d40782137867a",
             inference_id="niiri:inference_id"),
        "FSL_ClusterCenterOfGravity":
        dict(
            comment="Cluster Center Of Gravity",
            center_of_gravity_id="niiri:center_of_gravity_1",
            location="niiri:coordinate_0001",
            label="Center of gravity",
            cluster_id="niiri:supra_threshold_cluster_0001",
        ),
        "CoordinateSpace":
        dict(comment="Coordinate Space",
             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, -50],[0, 0, 0, 1]]",
             voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
             voxel_size="[ 3, 3, 3 ]",
             coord_system="nidm:NIDM_0000051",
             number_of_dim="3",
             dimensions="[ 53, 63, 46 ]"),
        "Image":
        dict(comment="Image",
             image_id="niiri:maximum_intensity_projection_id",
             location="MaximumIntensityProjection.png",
             filename="MaximumIntensityProjection.png",
             format="image/png"),
        "GrandMeanMap":
        dict(comment="Grand Mean Map",
             grand_mean_map_id="niiri:grand_mean_map_id",
             label="Grand Mean Map",
             location="GrandMean.nii.gz",
             filename="GrandMean.nii.gz",
             format="image/nifti",
             masked_median="115",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a",
             model_pe_id="niiri:model_pe_id"),
        "SPM_DriftModel":
        dict(comment="SPM's DCT Drift Model",
             id="niiri:drift_model_id",
             label="SPM's DCT Drift Model",
             cut_off="128"),
        "FSL_DriftModel":
        dict(comment="FSL's Gaussian Running Line Drift Model",
             id="niiri:drift_model_id",
             label="FSL's Gaussian Running Line Drift Model",
             cut_off="2")
    }

    NIDM_TERMS_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'terms')
    EX_DIR = os.path.join(NIDM_TERMS_DIR, 'examples')
    example = ExampleFromTemplate(nidm_classes, EX_DIR, True)
    example.create_example()