Beispiel #1
0
def design_matrix_event_related():
    nidm_classes = {
        "DesignMatrix_1stLevel": dict(
            design_matrix_id='niiri:design_matrix_id',
            label="Design Matrix",
            location="file://./DesignMatrix.csv",
            format="text/csv",
            filename="DesignMatrix.csv",
            design_matrix_png_id="niiri:design_matrix_png_id",
            regressors="",
            design=q_graph.qname(NIDM_EVENT_RELATED_DESIGN),
            hrf_basis="",
            drift_model=""),
        "ActivityUsedEntity": dict(
            activity_id="niiri:model_parameter_estimation_id",
            activity_type=q_graph.qname(NIDM_MODEL_PARAMETERS_ESTIMATION),
            entity_id="niiri:design_matrix_id",
            )
        }

    MIN_EX_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'event_related_design')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(
        nidm_classes, ttl_file, False,
        remove_att=[NIDM_REGRESSOR_NAMES, NIDM_HAS_HRF_BASIS,
                    NIDM_HAS_DRIFT_MODEL])
    example.create_example()
Beispiel #2
0
def explicit_mask():
    nidm_classes = {
        "MaskMap": dict(
            mask_id="niiri:explicit_mask_id",
            label="Mask Map",
            location="",
            filename="",
            user_defined="true",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="",
            used_by_act_id="niiri:model_parameter_estimation_id"
            ),
        "ActivityUsedEntity": dict(
            activity_id="niiri:model_parameter_estimation_id",
            activity_type=q_graph.qname(NIDM_MODEL_PARAMETERS_ESTIMATION),
            entity_id="niiri:explicit_mask_id",
            )
        }

    MIN_EX_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'explicit_mask')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(
        nidm_classes, ttl_file, False, remove_att=[
            NIDM_IN_COORDINATE_SPACE,
            PROV.atLocation, NFO.fileName, CRYPTO.sha512, DC.description])
    example.create_example()
Beispiel #3
0
def main():
    nidm_classes = {
        "HeightThreshold":
        dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<0.05 (uncorrected)",
            value="0.050000",
        ),
        "ExtentThresholdStat":
        dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: k>=0",
            thresh_type=OBO_STATISTIC_QNAME,
            cluster_size_vox="0",
        ),
        "InferenceUsedThresh":
        dict(
            inference_id="niiri:inference_id",
            height_thresh_id="niiri:height_threshold_id",
            extent_thresh_id="niiri:extent_threshold_id",
        )
    }

    NIDM_FSL_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'fsl',
        'example003')
    ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #4
0
def main():
    nidm_classes = {
        "DisplayMaskMap":
        dict(display_map_id="niiri:display_map_id",
             label="Display Mask Map",
             location="file://./DisplayMask.nii.gz",
             user_defined="true",
             filename="DisplayMask.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a..."),
        "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_0000051",
             number_of_dim="3",
             dimensions="[ 53, 63, 52 ]"),
        "ActivityUsedEntity":
        dict(
            activity_id="niiri:display_map_id",
            activity_type="nidm:NIDM_0000049",
            entity_id="niiri:height_threshold_id",
        )
    }

    NIDM_SPM_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'spm',
        'example005')
    ttl_file = os.path.join(NIDM_SPM_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #5
0
def main():
	nidm_classes = {
        "HeightThreshold": dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<0.05 (uncorrected)",
            value="0.050000",
            ),
        "ExtentThresholdStat": dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: k>=0",
            thresh_type=OBO_STATISTIC_QNAME,
            cluster_size_vox="0",
            ),
		"InferenceUsedThresh": dict(
			inference_id="niiri:inference_id",
			height_thresh_id="niiri:height_threshold_id", 
			extent_thresh_id="niiri:extent_threshold_id", 
			)
		}

	NIDM_FSL_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'fsl', 'example003')
	ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.ttl')
	example = ExampleFromTemplate(nidm_classes, ttl_file, False)
	example.create_example()
Beispiel #6
0
def main():
    nidm_classes = {
        "HeightThreshold": dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold: p<0.05 (FWE)",
            value="0.050000",
            ),
        "ExtentThresholdStat": dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: k>=0",
            thresh_type=OBO_STATISTIC_QNAME,
            cluster_size_vox="0",
            ),
        "InferenceUsedThresh": dict(
            inference_id="niiri:inference_id",
            height_thresh_id="niiri:height_threshold_id",
            extent_thresh_id="niiri:extent_threshold_id",
            )
        }

    NIDM_FSL_DIR = os.path.join(os.path.dirname(
        os.path.dirname(
            os.path.abspath(__file__))), 'test', 'ground_truth',
        'voxelwise_p050_fwe')
    ttl_file = os.path.join(NIDM_FSL_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #7
0
def main():
	nidm_classes = {
		"HeightThreshold_PFWE": dict(
			height_threshold_id="niiri:height_threshold_id",
			label="Height Threshold: p<0.05 (FWE)",
			p_fwe="0.050000",
			thresh_type="p-value FWE"
			),
		"FSL_ExtentThresholdNoType": dict(
			extent_threshold_id="niiri:extent_threshold_id",
			label="Extent Threshold: k>=0",
			p_fwe="1.0"
			),
		"InferenceUsedThresh": dict(
			inference_id="niiri:inference_id",
			height_thresh_id="niiri:height_threshold_id", 
			extent_thresh_id="niiri:extent_threshold_id", 
			)
		}

	NIDM_FSL_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'fsl', 'example002')
	ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.ttl')
	example = ExampleFromTemplate(nidm_classes, ttl_file, False)
	example.create_example()
Beispiel #8
0
def explicit_mask():
    nidm_classes = {
        "MaskMap":
        dict(mask_id="niiri:explicit_mask_id",
             label="Mask Map",
             location="",
             filename="",
             user_defined="true",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="",
             used_by_act_id="niiri:model_parameter_estimation_id"),
        "ActivityUsedEntity":
        dict(
            activity_id="niiri:model_parameter_estimation_id",
            activity_type=q_graph.qname(NIDM_MODEL_PARAMETERS_ESTIMATION),
            entity_id="niiri:explicit_mask_id",
        )
    }

    MIN_EX_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'explicit_mask')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes,
                                  ttl_file,
                                  False,
                                  remove_att=[
                                      NIDM_IN_COORDINATE_SPACE,
                                      PROV.atLocation, NFO.fileName,
                                      CRYPTO.sha512, DC.description
                                  ])
    example.create_example()
Beispiel #9
0
def main():
	nidm_classes = {
		"DisplayMaskMap": dict(
			display_map_id="niiri:display_map_id",
			label="Display Mask Map",
			location="file://./DisplayMask.nii.gz",
			user_defined="true",
			filename="DisplayMask.nii.gz",
			format="image/nifti",
			coordinate_space_id="niiri:coordinate_space_id_1",
			sha="e43b6e01b0463fe7d40782137867a..."
			),
		"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_0000051",
			number_of_dim="3",
			dimensions="[ 53, 63, 52 ]"),
		"ActivityUsedEntity": dict(
			activity_id="niiri:display_map_id",
			activity_type="nidm:NIDM_0000049",
			entity_id="niiri:height_threshold_id", 
			)
		}

	NIDM_SPM_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'spm', 'example005')
	ttl_file = os.path.join(NIDM_SPM_DIR, 'nidm.ttl')
	example = ExampleFromTemplate(nidm_classes, ttl_file, False)
	example.create_example()
Beispiel #10
0
def design_matrix_event_related():
    nidm_classes = {
        "DesignMatrix_1stLevel":
        dict(design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="file://./DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             regressors="",
             design=q_graph.qname(NIDM_EVENT_RELATED_DESIGN),
             hrf_basis="",
             drift_model=""),
        "ActivityUsedEntity":
        dict(
            activity_id="niiri:model_parameter_estimation_id",
            activity_type=q_graph.qname(NIDM_MODEL_PARAMETERS_ESTIMATION),
            entity_id="niiri:design_matrix_id",
        )
    }

    MIN_EX_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'event_related_design')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes,
                                  ttl_file,
                                  False,
                                  remove_att=[
                                      NIDM_REGRESSOR_NAMES, NIDM_HAS_HRF_BASIS,
                                      NIDM_HAS_DRIFT_MODEL
                                  ])
    example.create_example()
Beispiel #11
0
def f_test():
    nidm_classes = {
        "ContrastExplainedMeanSquareMap":
        dict(
            id="niiri:contrast_explained_mean_square_map_id",
            label="Contrast Explained Mean Square Map",
            location="file://./ContrastExplainedMeanSquareMap_F001.nii.gz",
            filename="ContrastExplainedMeanSquareMap_F001.nii.gz",
            format="image/nifti",
            coordinate_space_id="",
            sha="",
            contrast_est_id="niiri:contrast_estimation_id",
        ),
        "EntityWasGeneratedByActivity":
        dict(
            activity_id="niiri:contrast_estimation_id",
            activity_type=q_graph.qname(NIDM_CONTRAST_ESTIMATION),
            entity_id="niiri:contrast_explained_mean_square_map_id",
        )
    }

    MIN_EX_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'f_test')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(
        nidm_classes,
        ttl_file,
        False,
        remove_att=[NIDM_IN_COORDINATE_SPACE, PROV.atLocation, CRYPTO.sha512])
    example.create_example()
def main():
    nidm_classes = {
        "HeightThreshold":
        dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            label="Height Threshold: p<0.05 (FWE)",
            value="0.050000",
        ),
        "ExtentThresholdStat":
        dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: k>=0",
            thresh_type=OBO_STATISTIC_QNAME,
            cluster_size_vox="0",
        ),
        "InferenceUsedThresh":
        dict(
            inference_id="niiri:inference_id",
            height_thresh_id="niiri:height_threshold_id",
            extent_thresh_id="niiri:extent_threshold_id",
        )
    }

    NIDM_FSL_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'test',
        'ground_truth', 'voxelwise_p050_fwe')
    ttl_file = os.path.join(NIDM_FSL_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #13
0
def f_test():
    nidm_classes = {
        "ContrastExplainedMeanSquareMap": dict(
            id="niiri:contrast_explained_mean_square_map_id",
            label="Contrast Explained Mean Square Map",
            location="file://./ContrastExplainedMeanSquareMap_F001.nii.gz",
            filename="ContrastExplainedMeanSquareMap_F001.nii.gz",
            format="image/nifti",
            coordinate_space_id="",
            sha="",
            contrast_est_id="niiri:contrast_estimation_id",
            ),
        "EntityWasGeneratedByActivity": dict(
            activity_id="niiri:contrast_estimation_id",
            activity_type=q_graph.qname(NIDM_CONTRAST_ESTIMATION),
            entity_id="niiri:contrast_explained_mean_square_map_id",
            )
        }

    MIN_EX_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'test',
        'minimal_examples', 'f_test')
    ttl_file = os.path.join(MIN_EX_DIR, 'nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False,
                                  remove_att=[
                                      NIDM_IN_COORDINATE_SPACE,
                                      PROV.atLocation, CRYPTO.sha512])
    example.create_example()
Beispiel #14
0
def main():
	nidm_classes = {
		"Inference": dict(
			inference_id="niiri:inference_id_1",
			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_1",
			software_id="niiri:software_id"
			),
		"ConjunctionInference": dict(
			conj_inference_id="niiri:conjunction_id_1",
			label="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", 
			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(
			conj_inference_id="niiri:conjunction_id_2",
			label="k-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"
			),
		}

	NIDM_SPM_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'spm', "example004")
	ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_inference_activities.ttl')
	example = ExampleFromTemplate(nidm_classes, ttl_file, False)
	example.create_example()
Beispiel #15
0
def main():
    nidm_classes = {
        "Inference":
        dict(inference_id="niiri:inference_id_1",
             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_1",
             software_id="niiri:software_id"),
        "ConjunctionInference":
        dict(conj_inference_id="niiri:conjunction_id_1",
             label="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",
             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(conj_inference_id="niiri:conjunction_id_2",
             label="k-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"),
    }

    NIDM_SPM_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'spm',
        "example004")
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_inference_activities.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #16
0
def main():
    nidm_classes = {
        "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"),
        "Data":
        dict(data_id='niiri:data_id', label="Data", scaling="true",
             target=100),
        "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_Location-1":
        dict(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"),
        "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_Location-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Beta Map 2",
             location="ParameterEstimate_0002.nii",
             filename="ParameterEstimate_0002.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="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.1.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"),
        "SPM_Software":
        dict(software_id="niiri:software_id",
             software_type="nlx:nif-0000-00343",
             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_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="[\\\"Gen\\\", \\\"Gen*temporal_derivative\\\""
            ", \\\"Shad\\\", \\\"Shad*temporal_derivative\\\"]",
            hrf_basis="fsl:FSL_0000001",
            drift_model="niiri:drift_model_id"),
        "FSL_DriftModel": dict(
            id="niiri:drift_model_id",
            label="FSL's Gaussian Running Line Drift Model",
            cut_off="1908"
            ),
        "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="10000",
            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_0000074"
            ),
        "ModelParametersEstimation": dict(
            model_pe_id="niiri:model_parameters_estimation_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 1",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Parameter estimate 2",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-3": dict(
            beta_map_id="niiri:beta_map_id_3",
            label="Parameter estimate 3",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-4": dict(
            beta_map_id="niiri:beta_map_id_4",
            label="Parameter estimate 4",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            param_est_id="niiri:model_parameters_estimation_id"),
        "CoordinateSpace": dict(
            coordinate_space_id="niiri:coordinate_space_id_1",
            label="Coordinate space",
            voxel_to_world_mapping="[[ -3.5, 0, 0, 108.5], \
[ 0, 3.5, 0, -108.5], [ 0, 0, 3.5, -52.5], [ 0, 0, 0, 1]]",
            voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
            voxel_size="[ 3.5, 3.5, 3.5 ]",
            coord_system="nidm:NIDM_0000077",
            number_of_dim="3",
            dimensions="[ 64, 64, 42 ]"),
        "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="1327a300eb1e20d42c67abb3c49a47b80ecabfebd13d0ba0aca0560e8bf43\
891f0e35a958c1afa84e041f62cf0038f58b4ab71f68b0b50d4153210aeed74f4ff",
            param_est_id="niiri:model_parameters_estimation_id"),
        "MaskMap_Analysis": dict(  # Analysis mask
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="Mask.nii.gz",
            filename="Mask.nii.gz",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            generated_by_act_id="niiri:model_parameters_estimation_id",
            used_by_act_id="niiri:contrast_estimation_id_1"),
        "ContrastWeights": dict(
            contrast_id="niiri:contrast_id_1",
            label="Contrast Weights: Generation",
            value="[1, 0, 0, 0]",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="Generation"
            ),
        "ContrastEstimation": dict(
            contrast_estimation_id="niiri:contrast_estimation_id_1",
            label="Contrast estimation: Generation",
            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_1",
            param_est_map="niiri:beta_map_id_1"
            ),
        "ContrastMap": dict(
            contrast_map_id="niiri:contrast_map_id_1",
            label="Contrast Map: Generation",
            location="Contrast.nii.gz",
            format="image/nifti",
            filename="Contrast.nii.gz",
            contrast_name="Generation",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="4c755c0ae6088f8001e0458f89e51fea0e2719b5dc747fed6f617ae12ad5c\
6a643e1afcb886bcabaaac7911f5e69086c1bd084af9f75dae75913d44a783151f6",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "ContrastStandardErrorMap": dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map\
_id_1",
            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="8529f3ff9f10da8f332ced9d579990321475c1498b56d79ede560ba2eccf6\
d68718757dc7af78eb1e86617a41e6c9f55161f756d184e2b0fb06c3d419dc99856",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "DerivedMap-ContrastVariance": dict(
            derived_from_map_id="niiri:d4de4b20b2d408cd8d825ac0edb6030a",
            derived_map_type="nidm:NIDM_0000135",
            filename="varcope1.nii.gz",
            format="image/nifti",
            sha="7d183bbacc0b99cd1db84174d32445457f532bca9f774fdcc53bc1d0faa5e\
7d250a1abf03864bd90b30f96f5a7516e0056104a729a565019b0f254a8a7bced1e",
            map_id="niiri:contrast_standard_error_map_id_1"
            ),
        "StatisticMap": dict(
            statistic_map_id="niiri:statistic_map_id_1",
            label="Statistic Map: Generation",
            location="TStatistic.nii.gz",
            format="image/nifti",
            filename="TStatistic.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="Generation",
            error_dof="102",
            effect_dof="1",
            sha="b6286d36e678c23622b5b0486f0efb5b274f9a5e2a3ee6aceb6a0338f7745\
fb8a4d8f72b8af22c4ffb40c860bfb65940c87b03a7336cdf1a665f9cb07a5c2527",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "StatisticMap-Z": dict(
            statistic_map_id="niiri:z_statistic_map_id_1",
            label="Z-Statistic Map: Generation",
            location="ZStatistic.nii.gz",
            format="image/nifti",
            filename="ZStatistic.nii.gz",
            statistic_type=STATO_ZSTATISTIC_STR,
            stat_type_comment=STATO_ZSTATISTIC_LABEL,
            contrast_name="Generation",
            effect_dof="1",
            error_dof="INF",
            sha="3a68a4e5963766af86d22a871a4dbca9568a46441a567855b3a84dbd47ea0\
1acea11ed77b37ce85078a219adaa92264296a4548c1ba39b11ff028e8fefd95d03",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "HeightThreshold": dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold: Z>2.3",
            value="2.3",
            ),
        "ExtentThreshold": dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: p<0.05 (FWE)",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="0.05",
            ),
        "PeakDefinitionCriteria": dict(
            peak_definition_criteria_id="niiri:peak_definition_criteria_id_1",
            label="Peak Definition Criteria",
            min_dist_peaks="0.0"
            ),
        "ClusterDefinitionCriteria": dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id_1",
            label="Cluster Connectivity Criterion: 26",
            connectivity="nidm:NIDM_0000129"
            ),
        "Inference": dict(
            inference_id="niiri:inference_id_1",
            label="Inference: Generation",
            alternative_hyp="nidm:NIDM_0000060",
            stat_map_id="niiri:z_statistic_map_id_1",
            height_thresh_id="niiri:height_threshold_id",
            extent_thresh_id="niiri:extent_threshold_id",
            peak_def_id="niiri:peak_definition_criteria_id_1",
            cluster_def_id="niiri:cluster_definition_criteria_id_1",
            mask_id="niiri:mask_id_1",
            software_id="niiri:software_id"
            ),
        "FSL_ExcursionSetMap": dict(
            id="niiri:excursion_set_map_id_1",
            label="Excursion Set Map",
            location="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="c74e3c47e4308f27423a195c7c3e70b64b8fd362d612a2543da76bced67f6\
66949b70272033ab3d4b7d0bbbfe22b7da13d56d25521664be0c96454fd180ee4cc",
            inference_id="niiri:inference_id_1"
            ),
        "Image": dict(
            image_id="niiri:excursion_set_png_id_1",
            location="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="81",
            cluster_label_id="1",
            cluster_size_in_resels="23.1209189500945",
            p_value_fwe="0.00894",
            excursion_set_id="niiri:excursion_set_map_id_1"
            ),
        "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 0001",
            coord="[ -5.8, 19.1, 38.5 ]",
            coord_in_vox="[ 32.3, 39.2, 31.0 ]",
            ),
        "FSL_SupraThresholdCluster-2": dict(
            cluster_id="niiri:supra_threshold_cluster_0002",
            label="Supra-Threshold Cluster 0002",
            cluster_size_in_voxels="117",
            cluster_label_id="2",
            cluster_size_in_resels="19.4128470430038",
            p_value_fwe="0.000621",
            excursion_set_id="niiri:excursion_set_map_id_1"
            ),
        "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 0002",
            coord="[ -56.9, -57.1, 9.86 ]",
            coord_in_vox="[ 47.1, 19.2, 19.7 ]",
            ),
        "FSL_SupraThresholdCluster-3": dict(
            cluster_id="niiri:supra_threshold_cluster_0003 ",
            label="Supra-Threshold Cluster 0003",
            cluster_size_in_voxels="499",
            cluster_label_id="3",
            cluster_size_in_resels="19.4128470430038",
            p_value_fwe="1.26e-12",
            excursion_set_id="niiri:excursion_set_map_id_1"
            ),
        "FSL_ClusterCenterOfGravity-3 ": dict(
            center_of_gravity_id="niiri:center_of_gravity_3 ",
            label="Center of gravity 3",
            location="niiri:COG_coordinate_0003 ",
            cluster_id="niiri:supra_threshold_cluster_0003 "
            ),
        "FSL_Coordinate-COG3 ": dict(
            coordinate_id="niiri:COG_coordinate_0003 ",
            label="Coordinate 0003",
            coord="[ -47.2, 17.3, 9.18 ]",
            coord_in_vox="[ 43.4, 40.3, 23.9 ]",
            ),
        "FSL_SupraThresholdCluster-4": dict(
            cluster_id="niiri:supra_threshold_cluster_0004 ",
            label="Supra-Threshold Cluster 0004",
            cluster_size_in_voxels="1203",
            cluster_label_id="4",
            p_value_fwe="8.02e-24",
            excursion_set_id="niiri:excursion_set_map_id_1"
            ),
        "FSL_ClusterCenterOfGravity-4  ": dict(
            center_of_gravity_id="niiri:center_of_gravity_4",
            label="Center of gravity 4",
            location="niiri:COG_coordinate_0004  ",
            cluster_id="niiri:supra_threshold_cluster_0004  "
            ),
        "FSL_Coordinate-COG4  ": dict(
            coordinate_id="niiri:COG_coordinate_0004  ",
            label="Coordinate 0004",
            coord="[ -7.38, -72.5, -8.5 ]",
            coord_in_vox="[ 34.0, 14.7, 14.0 ]",
            ),
        "Peak-M4-1": dict(
            peak_id="niiri:peak_0004_1",
            label="Peak 0004_1",
            p_uncorr="3.51932e-09",
            location="niiri:coordinate_0004_1",
            equiv_z="5.79",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-1": dict(
            coordinate_id="niiri:coordinate_0004_1",
            label="Coordinate 0004_1",
            coord="[ -33.7, -66.7, -14.7 ]",
            coord_in_vox="[ 41, 17, 13 ]",
            ),
        "Peak-4-2": dict(
            peak_id="niiri:peak_0004_2",
            label="Peak 0004_2",
            p_uncorr="9.01048e-09",
            location="niiri:coordinate_0004_2",
            equiv_z="5.63",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-2": dict(
            coordinate_id="niiri:coordinate_0004_2",
            label="Coordinate 0004_2",
            coord="[ -38.0, -53.9, -21.9 ]",
            coord_in_vox="[ 42, 21, 12 ]",
            ),
        "Peak-4-3": dict(
            peak_id="niiri:peak_0004_3",
            label="Peak 0004_3",
            p_uncorr="9.54787e-09",
            location="niiri:coordinate_0004_3",
            equiv_z="5.62",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-3": dict(
            coordinate_id="niiri:coordinate_0004_3",
            label="Coordinate 0004_3",
            coord="[ 16.1, -96.6, 5.82 ]",
            coord_in_vox="[ 28, 7, 16 ]",
            ),
        "Peak-4-4": dict(
            peak_id="niiri:peak_0004_4",
            label="Peak 0004_4",
            p_uncorr="1.01163e-08",
            location="niiri:coordinate_0004_4",
            equiv_z="5.61",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-4": dict(
            coordinate_id="niiri:coordinate_0004_4",
            label="Coordinate 0004_4",
            coord="[ -48.1, -73.7, -9.24 ]",
            coord_in_vox="[ 45, 15, 14 ]"
            ),
        "Peak-4-5": dict(
            peak_id="niiri:peak_0004_5",
            label="Peak 0004_5",
            p_uncorr="1.07176e-08",
            location="niiri:coordinate_0004_5",
            equiv_z="5.6",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-5": dict(
            coordinate_id="niiri:coordinate_0004_5",
            label="Coordinate 0004_5",
            coord="[ -25.5, -80.4, -15.3 ]",
            coord_in_vox="[ 39, 13, 12 ]"
            ),
        "Peak-4-6": dict(
            peak_id="niiri:peak_0004_6",
            label="Peak 0004_6",
            p_uncorr="1.34887e-08",
            location="niiri:coordinate_0004_6",
            equiv_z="5.56",
            cluster_id="niiri:supra_threshold_cluster_0004"
            ),
        "FSL_Coordinate-4-6": dict(
            coordinate_id="niiri:coordinate_0004_6",
            label="Coordinate 0004_6",
            coord="[ 0.791, -87.2, 3.23 ]",
            coord_in_vox="[ 32, 10, 16 ]"
            ),
        "Peak-M3-1": dict(
            peak_id="niiri:peak_0003_1",
            label="Peak 0003_1",
            p_uncorr="1.01163e-08",
            location="niiri:coordinate_0003_1",
            equiv_z="5.61",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-1": dict(
            coordinate_id="niiri:coordinate_0003_1",
            label="Coordinate 0003_1",
            coord="[ -38.3, 20.7, 13.2 ]",
            coord_in_vox="[ 41, 41, 25 ]"
            ),
        "Peak-3-2": dict(
            peak_id="niiri:peak_0003_2",
            label="Peak 0003_2",
            p_uncorr="1.52768e-07",
            location="niiri:coordinate_0003_2",
            equiv_z="5.12",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-2": dict(
            coordinate_id="niiri:coordinate_0003_2",
            label="Coordinate 0003_2",
            coord="[ -45.5, 17.8, -6.65 ]",
            coord_in_vox="[ 43, 41, 20 ]"
            ),
        "Peak-3-3": dict(
            peak_id="niiri:peak_0003_3",
            label="Peak 0003_3",
            p_uncorr="1.82833e-06",
            location="niiri:coordinate_0003_3",
            equiv_z="4.63",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-3": dict(
            coordinate_id="niiri:coordinate_0003_3",
            label="Coordinate 0003_3",
            coord="[ -63.4, 3.78, 0.366 ]",
            coord_in_vox="[ 48, 37, 21 ]"
            ),
        "Peak-3-4": dict(
            peak_id="niiri:peak_0003_4",
            label="Peak 0003_4",
            p_uncorr="9.77365e-06",
            location="niiri:coordinate_0003_4",
            equiv_z="4.27",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-4": dict(
            coordinate_id="niiri:coordinate_0003_4",
            label="Coordinate 0003_4",
            coord="[ -57.4, 31.8, -2.12 ]",
            coord_in_vox="[ 46, 45, 22 ]"
            ),
        "Peak-3-5": dict(
            peak_id="niiri:peak_0003_5",
            label="Peak 0003_5",
            p_uncorr="1.22151e-05",
            location="niiri:coordinate_0003_5",
            equiv_z="4.22",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-5": dict(
            coordinate_id="niiri:coordinate_0003_5",
            label="Coordinate 0003_5",
            coord="[ -34.0, 8.84, 28.3 ]",
            coord_in_vox="[ 40, 37, 28 ]"
            ),
        "Peak-3-6": dict(
            peak_id="niiri:peak_0003_6",
            label="Peak 0003_6",
            p_uncorr="1.89436e-05",
            location="niiri:coordinate_0003_6",
            equiv_z="4.12",
            cluster_id="niiri:supra_threshold_cluster_0003"
            ),
        "FSL_Coordinate-3-6": dict(
            coordinate_id="niiri:coordinate_0003_6",
            label="Coordinate 0003_6",
            coord="[ -53.3, 23.3, 12.2 ]",
            coord_in_vox="[ 45, 42, 25 ]"
            ),
        "Peak-M2-1": dict(
            peak_id="niiri:peak_0002_1",
            label="Peak 0002_1",
            p_uncorr="1.74205e-06",
            location="niiri:coordinate_0002_1",
            equiv_z="4.64",
            cluster_id="niiri:supra_threshold_cluster_0002"
            ),
        "FSL_Coordinate-2-1": dict(
            coordinate_id="niiri:coordinate_0002_1",
            label="Coordinate 0002_1",
            coord="[ -56.2, -61.9, 4.03 ]",
            coord_in_vox="[ 47, 18, 18 ]"
            ),
        "Peak-2-2": dict(
            peak_id="niiri:peak_0002_2",
            label="Peak 0002_2",
            p_uncorr="4.71165e-06",
            location="niiri:coordinate_0002_2",
            equiv_z="4.43",
            cluster_id="niiri:supra_threshold_cluster_0002"
            ),
        "FSL_Coordinate-2-2": dict(
            coordinate_id="niiri:coordinate_0002_2",
            label="Coordinate 0002_2",
            coord="[ -56.7, -53.1, 18.2 ]",
            coord_in_vox="[ 47, 20, 22 ]"
            ),
        "Peak-M1-1": dict(
            peak_id="niiri:peak_0001_1",
            label="Peak 0001_1",
            p_uncorr="2.01334e-06",
            location="niiri:coordinate_0001_1",
            equiv_z="4.61",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "FSL_Coordinate-1-1": dict(
            coordinate_id="niiri:coordinate_0001_1",
            label="Coordinate 0001_1",
            coord="[ -8.35, 15.1, 39.6 ]",
            coord_in_vox="[ 33, 38, 31 ]"
            ),
        "Peak-1-2": dict(
            peak_id="niiri:peak_0001_2",
            label="Peak 0001_2",
            p_uncorr="0.000788846",
            location="niiri:coordinate_0001_2",
            equiv_z="3.16",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "FSL_Coordinate-1-2": dict(
            coordinate_id="niiri:coordinate_0001_2",
            label="Coordinate 0001_2",
            coord="[ -9.14, 30.5, 23.7 ]",
            coord_in_vox="[ 33, 43, 28 ]"
            ),
        "Peak-1-3": dict(
            peak_id="niiri:peak_0001_3",
            label="Peak 0001_3",
            p_uncorr="0.00122277",
            location="niiri:coordinate_0001_3",
            equiv_z="3.03",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "FSL_Coordinate-1-3": dict(
            coordinate_id="niiri:coordinate_0001_3",
            label="Coordinate 0001_3",
            coord="[ -19.6, 17.4, 34.7 ]",
            coord_in_vox="[ 36, 39, 30 ]"
            ),
        "Peak-1-4": dict(
            peak_id="niiri:peak_0001_4",
            label="Peak 0001_4",
            p_uncorr="0.00554262",
            location="niiri:coordinate_0001_4",
            equiv_z="2.54",
            cluster_id="niiri:supra_threshold_cluster_0001"
            ),
        "FSL_Coordinate-1-4": dict(
            coordinate_id="niiri:coordinate_0001_4",
            label="Coordinate 0001_4",
            coord="[ -9.64, 40.1, 17.3 ]",
            coord_in_vox="[ 33, 46, 27 ]"
            ),
        "FSL_SearchSpaceMaskMap": dict(
            search_space_id="niiri:search_space_mask_id",
            location="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_1",
            search_vol_voxels="45203",
            search_vol_units="1.93808e+06",
            search_vol_resels="3753.84",
            resel_size="12.0418",
            noise_roughness="0.384676",
            random_field_station="true",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            inference_id="niiri:inference_id_1",
            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"
            ),
        "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="9597.36",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="7a2703cea740e27a5170fb19e4a09b5e815e4b7e477bc75958404d675aa40\
8f53f747892a2ef4472f933cf5f12cd21cea99d5f5e551938081636fb6d4049473e",
            model_pe_id="niiri:model_parameters_estimation_id"
            ),
        "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"
            )
        }

    NIDM_FSL_DIR = os.path.join(os.path.dirname(
        os.path.dirname(os.path.abspath(__file__))), 'fsl', "example001")
    ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.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_Location-1": dict(
            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"),
        "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_Location-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 2",
            location="ParameterEstimate_0002.nii.gz",
            filename="ParameterEstimate_0002.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_Location-3": dict(
            beta_map_id="niiri:beta_map_id_3",
            label="Beta Map 3",
            location="ParameterEstimate_0003.nii.gz",
            filename="ParameterEstimate_0003.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",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            generated_by_act_id="niiri:model_pe_id",
            # fixme: also used by niiri:contrast_estimation_id_2
            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="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="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=NIDM_P_VALUE_UNCORRECTED_QNAME,
            label="Height Threshold: p<7.62276079258051e-07 (unc)",
            value="7.62276079258051e-07",
            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.23529984739211"
            ),
        "HeightThreshold-3": dict(
            height_threshold_id="niiri:height_threshold_id_3",
            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>=10",
            cluster_size_vox="10",
            cluster_size_resels="3.3",
            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",
            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"
            ),
        "ClusterDefinitionCriteria": dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"
            ),
        "ConjunctionInference": dict(
            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"
            ),
        "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-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.1.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"
        ),
        "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"
            ),
        "Image": dict(
            image_id="niiri:maximum_intensity_projection_id",
            location="MaximumIntensityProjection.png",
            filename="MaximumIntensityProjection.png",
            format="image/png"
            ),
        "ClusterLabelsMap": dict(
            cluster_label_map_id="niiri:cluster_label_map_id",
            location="ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti"
            ),
        "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', "example003")
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_results_conjunction.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #19
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"),
        "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="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"),
        "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_Location-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Beta Map 2",
             location="ParameterEstimate_0002.nii.gz",
             filename="ParameterEstimate_0002.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_Location-3":
        dict(beta_map_id="niiri:beta_map_id_3",
             label="Beta Map 3",
             location="ParameterEstimate_0003.nii.gz",
             filename="ParameterEstimate_0003.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",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="e43b6e01b0463fe7d40782137867a",
            generated_by_act_id="niiri:model_pe_id",
            # fixme: also used by niiri:contrast_estimation_id_2
            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="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="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=NIDM_P_VALUE_UNCORRECTED_QNAME,
             label="Height Threshold: p<7.62276079258051e-07 (unc)",
             value="7.62276079258051e-07",
             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.23529984739211"),
        "HeightThreshold-3":
        dict(
            height_threshold_id="niiri:height_threshold_id_3",
            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>=10",
             cluster_size_vox="10",
             cluster_size_resels="3.3",
             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",
             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"),
        "ClusterDefinitionCriteria":
        dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"),
        "ConjunctionInference":
        dict(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"),
        "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-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.1.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"),
        "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"),
        "Image":
        dict(image_id="niiri:maximum_intensity_projection_id",
             location="MaximumIntensityProjection.png",
             filename="MaximumIntensityProjection.png",
             format="image/png"),
        "ClusterLabelsMap":
        dict(cluster_label_map_id="niiri:cluster_label_map_id",
             location="ClusterLabels.nii.gz",
             filename="ClusterLabels.nii.gz",
             format="image/nifti"),
        "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',
        "example003")
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_results_conjunction.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #20
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(
            comment="Group: Control group with 23 subjects",
            id="niiri:group_id",
            label="Group: Control",
            name="Control",
            numsubjects="23"
            ),
        "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-OLS": dict(
            comment="Error Model: Ordinary least squares",
            error_model_id="niiri:error_model_id",
            noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
            variance_homo="true",
            variance_spatial=NIDM_SPATIALLY_LOCAL_MODEL,
            dependence=NIDM_INDEPENDENT_ERROR,
            dependence_spatial=NIDM_SPATIALLY_LOCAL_MODEL
            ),
        "ErrorModel-WLS": dict(
            comment="Error Model: Weighted least squares",
            error_model_id="niiri:error_model_id",
            noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
            variance_homo="false",
            variance_spatial=NIDM_SPATIALLY_LOCAL_MODEL,
            dependence=NIDM_INDEPENDENT_ERROR,
            dependence_spatial=NIDM_SPATIALLY_LOCAL_MODEL
            ),
        "ErrorModel-SPMnonSphericity": dict(
            comment="Error Model: SPM non sphericity",
            error_model_id="niiri:error_model_id",
            noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
            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"
            ),
        "Inference-OneTailed": dict(
            comment="Inference: one-tailed",
            inference_id="niiri:inference_id",
            label="Inference",
            alternative_hyp=NIDM_ONE_TAILED_TEST,
            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"
            ),
        "Inference-TwoTailed": dict(
            comment="Inference: two-tailed",
            inference_id="niiri:inference_id",
            label="Inference",
            alternative_hyp=NIDM_TWO_TAILED_TEST,
            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"
            ),
        "ClusterDefinitionCriteria-06": dict(
            comment="Cluster connectivity: face",
            cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
            label="Cluster Connectivity Criterion: 6",
            connectivity="nidm:NIDM_0000130"
            ),
        "ClusterDefinitionCriteria-18": dict(
            comment="Cluster connectivity: face or edge",
            cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"
            ),
        "ClusterDefinitionCriteria-26": dict(
            comment="Cluster connectivity: face, edge or corner",
            cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
            label="Cluster Connectivity Criterion: 26",
            connectivity="nidm:NIDM_0000129"
            )
        }

    # Delete old examples
    shutil.rmtree(EX_DIR)
    os.mkdir(EX_DIR)
    example = ExampleFromTemplate(nidm_classes, EX_DIR, True)
    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="[\\\"Gen\\\", \\\"Gen*temporal_derivative\\\""
             ", \\\"Shad\\\", \\\"Shad*temporal_derivative\\\"]",
             hrf_basis="fsl:FSL_0000001",
             drift_model="niiri:drift_model_id"),
        "FSL_DriftModel":
        dict(id="niiri:drift_model_id",
             label="FSL's Gaussian Running Line Drift Model",
             cut_off="1908"),
        "Image-DesignMatrix":
        dict(image_id="niiri:design_matrix_png_id",
             location="DesignMatrix.png",
             filename="DesignMatrix.png",
             format="image/png"),
        "ClusterLabelsMap":
        dict(
            cluster_label_map_id="niiri:cluster_label_map_id",
            label="Cluster Labels Map",
            location="ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="13093aae03897e2518307d000eb298f4b1439814d8d3d77c622b717423f93\
506dd5de5669513ab65c6dd74a7d27ee9df08620f546ed00575517b40e5878c2c96"),
        "Person":
        dict(id='niiri:subject_id', label="Person"),
        "Data":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target="10000",
             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_0000074"),
        "ModelParametersEstimation":
        dict(model_pe_id="niiri:model_parameters_estimation_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 1",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            location="ParameterEstimate_001.nii.gz",
            filename="ParameterEstimate_001.nii.gz",
            sha="4c755c0ae6088f8001e0458f89e51fea0e2719b5dc747fed6f617ae12ad5c\
6a643e1afcb886bcabaaac7911f5e69086c1bd084af9f75dae75913d44a783151f6",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-2":
        dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Parameter estimate 2",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="b6146d013976c471fe43a083a56b8852c39a13e0566b2d04e172275bd2fc7\
b7ffb0c0ae99fac11337d3c27f131c4a00e92f5df15d32723148639a3cc9ffd7c1f",
            location="ParameterEstimate_002.nii.gz",
            filename="ParameterEstimate_002.nii.gz",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-3":
        dict(
            beta_map_id="niiri:beta_map_id_3",
            label="Parameter estimate 3",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="f5dd8123b389fe755086f7ad3becb5b79f39d70cf0095b08ed8c3e5cb7179\
42711264528f08fa99e58aaaf24e03581c64567864110518247d95031ef3fe2e761",
            location="ParameterEstimate_003.nii.gz",
            filename="ParameterEstimate_003.nii.gz",
            param_est_id="niiri:model_parameters_estimation_id"),
        "ParameterEstimateMap-4":
        dict(
            beta_map_id="niiri:beta_map_id_4",
            label="Parameter estimate 4",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="aca2503769bfb6ee3801bc50c2e033755cd9844d13ee78a38aa23140ad558\
b5c6f0517c4748f84acac27cf6608222553003f418097c18f254312b49b5522b831",
            location="ParameterEstimate_004.nii.gz",
            filename="ParameterEstimate_004.nii.gz",
            param_est_id="niiri:model_parameters_estimation_id"),
        "CoordinateSpace":
        dict(coordinate_space_id="niiri:coordinate_space_id_1",
             label="Coordinate space",
             voxel_to_world_mapping="[[ -3.5, 0, 0, 108.5], \
[ 0, 3.5, 0, -108.5], [ 0, 0, 3.5, -52.5], [ 0, 0, 0, 1]]",
             voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
             voxel_size="[ 3.5, 3.5, 3.5 ]",
             coord_system="nidm:NIDM_0000077",
             number_of_dim="3",
             dimensions="[ 64, 64, 42 ]"),
        "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="1327a300eb1e20d42c67abb3c49a47b80ecabfebd13d0ba0aca0560e8bf43\
891f0e35a958c1afa84e041f62cf0038f58b4ab71f68b0b50d4153210aeed74f4ff",
            param_est_id="niiri:model_parameters_estimation_id"),
        "MaskMap_Analysis":
        dict(  # Analysis mask
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="Mask.nii.gz",
            filename="Mask.nii.gz",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            generated_by_act_id="niiri:model_parameters_estimation_id",
            used_by_act_id="niiri:contrast_estimation_id_1"),
        "ContrastWeights":
        dict(contrast_id="niiri:contrast_id_1",
             label="Contrast Weights: Generation",
             value="[1, 0, 0, 0]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="Generation"),
        "ContrastEstimation":
        dict(contrast_estimation_id="niiri:contrast_estimation_id_1",
             label="Contrast estimation: Generation",
             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_1",
             param_est_map="niiri:beta_map_id_1"),
        "ContrastMap":
        dict(
            contrast_map_id="niiri:contrast_map_id_1",
            label="Contrast Map: Generation",
            location="Contrast.nii.gz",
            format="image/nifti",
            filename="Contrast.nii.gz",
            contrast_name="Generation",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="4c755c0ae6088f8001e0458f89e51fea0e2719b5dc747fed6f617ae12ad5c\
6a643e1afcb886bcabaaac7911f5e69086c1bd084af9f75dae75913d44a783151f6",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "ContrastStandardErrorMap":
        dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map\
_id_1",
            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="8529f3ff9f10da8f332ced9d579990321475c1498b56d79ede560ba2eccf6\
d68718757dc7af78eb1e86617a41e6c9f55161f756d184e2b0fb06c3d419dc99856",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "DerivedMap-ContrastVariance":
        dict(
            derived_from_map_id="niiri:d4de4b20b2d408cd8d825ac0edb6030a",
            derived_map_type="nidm:NIDM_0000135",
            filename="varcope1.nii.gz",
            format="image/nifti",
            sha="7d183bbacc0b99cd1db84174d32445457f532bca9f774fdcc53bc1d0faa5e\
7d250a1abf03864bd90b30f96f5a7516e0056104a729a565019b0f254a8a7bced1e",
            map_id="niiri:contrast_standard_error_map_id_1"),
        "StatisticMap":
        dict(
            statistic_map_id="niiri:statistic_map_id_1",
            label="T-Statistic Map: Generation",
            location="TStatistic.nii.gz",
            format="image/nifti",
            filename="TStatistic.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="Generation",
            error_dof="102",
            effect_dof="1",
            sha="b6286d36e678c23622b5b0486f0efb5b274f9a5e2a3ee6aceb6a0338f7745\
fb8a4d8f72b8af22c4ffb40c860bfb65940c87b03a7336cdf1a665f9cb07a5c2527",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "StatisticMap-Z":
        dict(
            statistic_map_id="niiri:z_statistic_map_id_1",
            label="Z-Statistic Map: Generation",
            location="ZStatistic.nii.gz",
            format="image/nifti",
            filename="ZStatistic.nii.gz",
            statistic_type=STATO_ZSTATISTIC_STR,
            stat_type_comment=STATO_ZSTATISTIC_LABEL,
            contrast_name="Generation",
            effect_dof="1",
            error_dof="INF",
            sha="3a68a4e5963766af86d22a871a4dbca9568a46441a567855b3a84dbd47ea0\
1acea11ed77b37ce85078a219adaa92264296a4548c1ba39b11ff028e8fefd95d03",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "HeightThreshold":
        dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold: Z>2.3",
            value="2.3",
        ),
        "ExtentThreshold":
        dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: p<0.05 (FWE)",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="0.05",
        ),
        "PeakDefinitionCriteria":
        dict(peak_definition_criteria_id="niiri:peak_definition_criteria_id_1",
             label="Peak Definition Criteria",
             min_dist_peaks="0.0"),
        "ClusterDefinitionCriteria":
        dict(cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id_1",
             label="Cluster Connectivity Criterion: 26",
             connectivity="nidm:NIDM_0000129"),
        "Inference":
        dict(inference_id="niiri:inference_id_1",
             label="Inference: Generation",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:z_statistic_map_id_1",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             peak_def_id="niiri:peak_definition_criteria_id_1",
             cluster_def_id="niiri:cluster_definition_criteria_id_1",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "FSL_ExcursionSetMap":
        dict(
            id="niiri:excursion_set_map_id_1",
            label="Excursion Set Map",
            location="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="c74e3c47e4308f27423a195c7c3e70b64b8fd362d612a2543da76bced67f6\
66949b70272033ab3d4b7d0bbbfe22b7da13d56d25521664be0c96454fd180ee4cc",
            inference_id="niiri:inference_id_1"),
        "Image":
        dict(image_id="niiri:excursion_set_png_id_1",
             location="ExcursionSet.png",
             filename="ExcursionSet.png",
             format="image/png"),
        "FSL_SupraThresholdCluster-1":
        dict(cluster_id="niiri:supra_threshold_cluster_0001",
             label="Supra-Threshold Cluster 0001",
             cluster_size_in_voxels="81",
             cluster_label_id="1",
             cluster_size_in_resels="23.1209189500945",
             p_value_fwe="0.00894",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "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 0001",
            coord="[ -4.39, 28.6, 55.9 ]",
            coord_in_vox="[ 32.3, 39.2, 31.0 ]",
        ),
        "FSL_SupraThresholdCluster-2":
        dict(cluster_id="niiri:supra_threshold_cluster_0002",
             label="Supra-Threshold Cluster 0002",
             cluster_size_in_voxels="117",
             cluster_label_id="2",
             cluster_size_in_resels="19.4128470430038",
             p_value_fwe="0.000621",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "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 0002",
            coord="[ -56.4, -41.4, 16.5 ]",
            coord_in_vox="[ 47.1, 19.2, 19.7 ]",
        ),
        "FSL_SupraThresholdCluster-3":
        dict(cluster_id="niiri:supra_threshold_cluster_0003 ",
             label="Supra-Threshold Cluster 0003",
             cluster_size_in_voxels="499",
             cluster_label_id="3",
             cluster_size_in_resels="19.4128470430038",
             p_value_fwe="1.26e-12",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "FSL_ClusterCenterOfGravity-3 ":
        dict(center_of_gravity_id="niiri:center_of_gravity_3 ",
             label="Center of gravity 3",
             location="niiri:COG_coordinate_0003 ",
             cluster_id="niiri:supra_threshold_cluster_0003 "),
        "FSL_Coordinate-COG3 ":
        dict(
            coordinate_id="niiri:COG_coordinate_0003 ",
            label="Coordinate 0003",
            coord="[-43.5, 32.6, 31.1]",
            coord_in_vox="[ 43.4, 40.3, 23.9 ]",
        ),
        "FSL_SupraThresholdCluster-4":
        dict(cluster_id="niiri:supra_threshold_cluster_0004 ",
             label="Supra-Threshold Cluster 0004",
             cluster_size_in_voxels="1203",
             cluster_label_id="4",
             p_value_fwe="8.02e-24",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "FSL_ClusterCenterOfGravity-4  ":
        dict(center_of_gravity_id="niiri:center_of_gravity_4",
             label="Center of gravity 4",
             location="niiri:COG_coordinate_0004  ",
             cluster_id="niiri:supra_threshold_cluster_0004  "),
        "FSL_Coordinate-COG4  ":
        dict(
            coordinate_id="niiri:COG_coordinate_0004  ",
            label="Coordinate 0004",
            coord="[-10.5, -56.9, -3.41]",
            coord_in_vox="[ 34.0, 14.7, 14.0 ]",
        ),
        "Peak-M4-1":
        dict(peak_id="niiri:peak_0004_1",
             label="Peak 4_01",
             p_uncorr="3.51932e-09",
             location="niiri:coordinate_0004_1",
             equiv_z="5.79",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-1":
        dict(
            coordinate_id="niiri:coordinate_0004_1",
            label="Coordinate 4_01",
            coord="[ -35.0, -49.0, -7.0 ]",
            coord_in_vox="[ 41, 17, 13 ]",
        ),
        "Peak-4-2":
        dict(peak_id="niiri:peak_0004_2",
             label="Peak 4_02",
             p_uncorr="9.01048e-09",
             location="niiri:coordinate_0004_2",
             equiv_z="5.63",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-2":
        dict(
            coordinate_id="niiri:coordinate_0004_2",
            label="Coordinate 4_02",
            coord="[-38.5, -35.0, -10.5]",
            coord_in_vox="[ 42, 21, 12 ]",
        ),
        "Peak-4-3":
        dict(peak_id="niiri:peak_0004_3",
             label="Peak 4_03",
             p_uncorr="9.54787e-09",
             location="niiri:coordinate_0004_3",
             equiv_z="5.62",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-3":
        dict(
            coordinate_id="niiri:coordinate_0004_3",
            label="Coordinate 4_03",
            coord="[ 10.5, -84.0, 3.5]",
            coord_in_vox="[ 28, 7, 16 ]",
        ),
        "Peak-4-4":
        dict(peak_id="niiri:peak_0004_4",
             label="Peak 4_04",
             p_uncorr="1.01163e-08",
             location="niiri:coordinate_0004_4",
             equiv_z="5.61",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-4":
        dict(coordinate_id="niiri:coordinate_0004_4",
             label="Coordinate 4_04",
             coord="[-49.0, -56.0, -3.5]",
             coord_in_vox="[ 45, 15, 14 ]"),
        "Peak-4-5":
        dict(peak_id="niiri:peak_0004_5",
             label="Peak 4_05",
             p_uncorr="1.07176e-08",
             location="niiri:coordinate_0004_5",
             equiv_z="5.6",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-5":
        dict(coordinate_id="niiri:coordinate_0004_5",
             label="Coordinate 4_05",
             coord="[-28.0, -63.0, -10.5]",
             coord_in_vox="[ 39, 13, 12 ]"),
        "Peak-4-6":
        dict(peak_id="niiri:peak_0004_6",
             label="Peak 4_06",
             p_uncorr="1.34887e-08",
             location="niiri:coordinate_0004_6",
             equiv_z="5.56",
             cluster_id="niiri:supra_threshold_cluster_0004"),
        "FSL_Coordinate-4-6":
        dict(coordinate_id="niiri:coordinate_0004_6",
             label="Coordinate 4_06",
             coord="[-3.5, -73.5, 3.5]",
             coord_in_vox="[ 32, 10, 16 ]"),
        "Peak-M3-1":
        dict(peak_id="niiri:peak_0003_1",
             label="Peak 3_01",
             p_uncorr="1.01163e-08",
             location="niiri:coordinate_0003_1",
             equiv_z="5.61",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-1":
        dict(coordinate_id="niiri:coordinate_0003_1",
             label="Coordinate 3_01",
             coord="[-35.0, 35.0, 35.0]",
             coord_in_vox="[ 41, 41, 25 ]"),
        "Peak-3-2":
        dict(peak_id="niiri:peak_0003_2",
             label="Peak 3_02",
             p_uncorr="1.52768e-07",
             location="niiri:coordinate_0003_2",
             equiv_z="5.12",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-2":
        dict(coordinate_id="niiri:coordinate_0003_2",
             label="Coordinate 3_02",
             coord="[-42.0, 35.0, 17.5]",
             coord_in_vox="[ 43, 41, 20 ]"),
        "Peak-3-3":
        dict(peak_id="niiri:peak_0003_3",
             label="Peak 3_03",
             p_uncorr="1.82833e-06",
             location="niiri:coordinate_0003_3",
             equiv_z="4.63",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-3":
        dict(coordinate_id="niiri:coordinate_0003_3",
             label="Coordinate 3_03",
             coord="[-59.5, 21.0, 21.0]",
             coord_in_vox="[ 48, 37, 21 ]"),
        "Peak-3-4":
        dict(peak_id="niiri:peak_0003_4",
             label="Peak 3_04",
             p_uncorr="9.77365e-06",
             location="niiri:coordinate_0003_4",
             equiv_z="4.27",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-4":
        dict(coordinate_id="niiri:coordinate_0003_4",
             label="Coordinate 3_04",
             coord="[-52.5, 49.0, 24.5]",
             coord_in_vox="[ 46, 45, 22 ]"),
        "Peak-3-5":
        dict(peak_id="niiri:peak_0003_5",
             label="Peak 3_05",
             p_uncorr="1.22151e-05",
             location="niiri:coordinate_0003_5",
             equiv_z="4.22",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-5":
        dict(coordinate_id="niiri:coordinate_0003_5",
             label="Coordinate 3_05",
             coord="[-31.5, 21.0, 45.5]",
             coord_in_vox="[ 40, 37, 28 ]"),
        "Peak-3-6":
        dict(peak_id="niiri:peak_0003_6",
             label="Peak 3_06",
             p_uncorr="1.89436e-05",
             location="niiri:coordinate_0003_6",
             equiv_z="4.12",
             cluster_id="niiri:supra_threshold_cluster_0003"),
        "FSL_Coordinate-3-6":
        dict(coordinate_id="niiri:coordinate_0003_6",
             label="Coordinate 3_06",
             coord="[-49.0, 38.5, 35.0]",
             coord_in_vox="[ 45, 42, 25 ]"),
        "Peak-M2-1":
        dict(peak_id="niiri:peak_0002_1",
             label="Peak 2_01",
             p_uncorr="1.74205e-06",
             location="niiri:coordinate_0002_1",
             equiv_z="4.64",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "FSL_Coordinate-2-1":
        dict(coordinate_id="niiri:coordinate_0002_1",
             label="Coordinate 2_01",
             coord="[-56.0, -45.5, 10.5]",
             coord_in_vox="[ 47, 18, 18 ]"),
        "Peak-2-2":
        dict(peak_id="niiri:peak_0002_2",
             label="Peak 2_02",
             p_uncorr="4.71165e-06",
             location="niiri:coordinate_0002_2",
             equiv_z="4.43",
             cluster_id="niiri:supra_threshold_cluster_0002"),
        "FSL_Coordinate-2-2":
        dict(coordinate_id="niiri:coordinate_0002_2",
             label="Coordinate 2_02",
             coord="[-56.0, -38.5, 24.5]",
             coord_in_vox="[ 47, 20, 22 ]"),
        "Peak-M1-1":
        dict(peak_id="niiri:peak_0001_1",
             label="Peak 1_01",
             p_uncorr="2.01334e-06",
             location="niiri:coordinate_0001_1",
             equiv_z="4.61",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-1-1":
        dict(coordinate_id="niiri:coordinate_0001_1",
             label="Coordinate 1_01",
             coord="[-7.0, 24.5, 56.0]",
             coord_in_vox="[ 33, 38, 31 ]"),
        "Peak-1-2":
        dict(peak_id="niiri:peak_0001_2",
             label="Peak 1_02",
             p_uncorr="0.000788846",
             location="niiri:coordinate_0001_2",
             equiv_z="3.16",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-1-2":
        dict(coordinate_id="niiri:coordinate_0001_2",
             label="Coordinate 1_02",
             coord="[-7.0, 42.0, 45.5]",
             coord_in_vox="[ 33, 43, 28 ]"),
        "Peak-1-3":
        dict(peak_id="niiri:peak_0001_3",
             label="Peak 1_03",
             p_uncorr="0.00122277",
             location="niiri:coordinate_0001_3",
             equiv_z="3.03",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-1-3":
        dict(coordinate_id="niiri:coordinate_0001_3",
             label="Coordinate 1_03",
             coord="[-17.5, 28.0, 52.5]",
             coord_in_vox="[ 36, 39, 30 ]"),
        "Peak-1-4":
        dict(peak_id="niiri:peak_0001_4",
             label="Peak 1_04",
             p_uncorr="0.00554262",
             location="niiri:coordinate_0001_4",
             equiv_z="2.54",
             cluster_id="niiri:supra_threshold_cluster_0001"),
        "FSL_Coordinate-1-4":
        dict(coordinate_id="niiri:coordinate_0001_4",
             label="Coordinate 1_04",
             coord="[-7.0, 52.5, 42.0]",
             coord_in_vox="[ 33, 46, 27 ]"),
        "FSL_SearchSpaceMaskMap":
        dict(
            search_space_id="niiri:search_space_mask_id",
            location="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_1",
            search_vol_voxels="45203",
            search_vol_units="1.93808e+06",
            search_vol_resels="3753.84",
            resel_size="12.0418",
            noise_roughness="0.384676",
            random_field_station="true",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            inference_id="niiri:inference_id_1",
            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.3.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"),
        "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="9597.36",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="7a2703cea740e27a5170fb19e4a09b5e815e4b7e477bc75958404d675aa40\
8f53f747892a2ef4472f933cf5f12cd21cea99d5f5e551938081636fb6d4049473e",
            model_pe_id="niiri:model_parameters_estimation_id"),
        "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")
    }

    NIDM_FSL_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'fsl',
        "example001")
    ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
def main():
    nidm_classes = {
        "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"
            ),
        "Data": dict(
            data_id='niiri:data_id',
            label="Data",
            scaling="true",
            target=100
            ),
        "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="Beta Map 1",
            coordinate_space_id="niiri:coordinate_space_id_1",
            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="fab2573099693215bac756bc796fbc983524473dec5c1b2d66fb83694c174\
12731df7f574094cb6c4a77994af7be11ed9aa545090fbe8ec6565a5c3c3dae8f0f",
            map_id="niiri:beta_map_id_1"
            ),
        "ParameterEstimateMap-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 2",
            coordinate_space_id="niiri:coordinate_space_id_1",
            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, \
-70],[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, 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="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.05 (FWE)",
            value="0.0499999999999976",
            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"
            ),
        "DerivedMap-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"
            ),
        "NIDMBundle": dict(
            bundle_id="niiri:spm_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_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"
            ),
        "SPM_Software": dict(
            software_id="niiri:software_id",
            software_type="nlx:nif-0000-00343",
            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()
Beispiel #23
0
def main():
    nidm_classes = {
        "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"),
        "Data":
        dict(data_id='niiri:data_id', label="Data", scaling="true",
             target=100),
        "ErrorModel":
        dict(error_model_id="niiri:error_model_id",
             noise_distribution="nidm:NIDM_0000032",
             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="Beta Map 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="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_Location-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Beta Map 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="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_Location-3":
        dict(beta_map_id="niiri:beta_map_id_3",
             label="Beta Map 3",
             location="file:///path/to/ParameterEstimate_0003.nii.gz",
             filename="ParameterEstimate_0003.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="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",
            # fixme: also used by niiri:contrast_estimation_id_2
            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="file:///path/to/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="file:///path/to/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="file:///path/to/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="file:///path/to/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="Statistic Map: listening > reading",
             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 > 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="Statistic Map: motor",
             location="file:///path/to/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=NIDM_P_VALUE_UNCORRECTED_QNAME,
             label="Height Threshold: p<7.62276079258051e-07 (unc)",
             value="7.62276079258051e-07",
             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.23529984739211"),
        "HeightThreshold-3":
        dict(
            height_threshold_id="niiri:height_threshold_id_3",
            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>=10",
             cluster_size_vox="10",
             cluster_size_resels="3.3",
             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",
             user_defined="true",
             location="file:///path/to/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"),
        "ClusterDefinitionCriteria":
        dict(
            cluster_definition_criteria_id="niiri:cluster_definition_criteria_\
id",
            label="Cluster Connectivity Criterion: 18",
            connectivity="nidm:NIDM_0000128"),
        "ConjunctionInference":
        dict(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"),
        "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.1.0",
             time="2014-05-19T10:30:00.000+01:00"),
        "SPM_ReselsPerVoxelMap":
        dict(resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
             label="Resels per Voxel Map",
             location="file:///path/to/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"),
        "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="nlx:nif-0000-00343",
             label="SPM",
             version="12b.5853"),
        "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_SPM_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'spm',
        "example003")
    ttl_file = os.path.join(NIDM_SPM_DIR, 'spm_results_conjunction.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
Beispiel #24
0
def main():
    nidm_classes = {
        "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://./DesignMatrix.png",
            filename="DesignMatrix.png",
            format="image/png"
            ),
        "Data": dict(
            data_id='niiri:data_id',
            label="Data",
            scaling="true",
            target=100
            ),
        "ErrorModel": dict(
            error_model_id="niiri:error_model_id",
            noise_distribution="nidm:NIDM_0000032",
            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,
            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(
            beta_map_id="niiri:beta_map_id_1",
            label="Beta Map 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="e43b6e01b0463fe7d40782137867a...",
            param_est_id="niiri:model_pe_id"),
        "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": dict(
            mask_id="niiri:mask_id_2",
            user_defined="false",
            label="Mask",
            location="file:///path/to/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(
            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"),
        "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="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="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"),
        "StatisticMap_T": dict(
            statistic_map_id="niiri:statistic_map_id",
            label="Statistic Map: listening > rest",
            location="file:///path/to/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(
            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(
            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(
            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(
            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(
            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(
            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(
            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(
            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(
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
            label="Resels per Voxel Map",
            location="file:///path/to/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(
            cluster_label_map_id="niiri:cluster_label_map_id",
            location="file:///path/to/ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti"
            ),
        "DisplayMaskMap": dict(
            display_map_id="niiri:display_map_id",
            label="Display Mask Map",
            location="file:///path/to/DisplayMask.nii.gz",
            filename="DisplayMask.nii.gz",
            format="image/nifti",
            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: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"
            ),
        "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",
            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"
            ),
        "SignificantCluster": dict(
            cluster_id="niiri:significant_cluster_0001",
            label="Significant 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(
            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:significant_cluster_0001"
            ),
        "Coordinate": dict(
            coordinate_id="niiri:coordinate_0001",
            label="Coordinate: 0001",
            coord="[ -60, -28, 13 ]"
            ),
        "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",
            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(
            center_of_gravity_id="niiri:center_of_gravity_1",
            location="niiri:coordinate_0001",
            label="Center of gravity",
            cluster_id="niiri:significant_cluster_0001",
            ),
        "CoordinateSpace": dict(
            coordinate_space_id="niiri:coordinate_space_id_1",
            label="Coordinate space 1",
            voxel_to_world_mapping="[[-3, 0, 0, 78],[0, 3, 0, -112],\
[0, 0, 3, -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(
            image_id="niiri:maximum_intensity_projection_id",
            location="file:///path/to/MaximumIntensityProjection.png",
            filename="MaximumIntensityProjection.png",
            format="image/png"
            ),
        "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"
            ),
        "SPM_DriftModel": dict(
            id="niiri:drift_model_id",
            label="SPM's DCT Drift Model",
            cut_off="128"
            ),
        "FSL_DriftModel": dict(
            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()
Beispiel #25
0
def main():
    nidm_classes = {
        "DesignMatrix_1stLevel":
        dict(design_matrix_id='niiri:design_matrix_id',
             label="Design Matrix",
             location="file://./DesignMatrix.csv",
             format="text/csv",
             filename="DesignMatrix.csv",
             design_matrix_png_id="niiri:design_matrix_png_id",
             regressors="[\\\"Gen\\\", \\\"Gen*temporal_derivative\\\""
             ", \\\"Shad\\\", \\\"Shad*temporal_derivative\\\"]",
             design="nidm:" + str(NIDM_EVENT_RELATED_DESIGN).split("#")[1],
             hrf_basis="fsl:FSL_0000001",
             drift_model="niiri:drift_model_id"),
        "FSL_DriftModel":
        dict(id="niiri:drift_model_id",
             label="FSL's Gaussian Running Line Drift Model",
             cut_off="1908"),
        "Image_fileName-DesignMatrix":
        dict(image_id="niiri:design_matrix_png_id",
             location="file://./DesignMatrix.png",
             filename="DesignMatrix.png",
             filename_2="design.png",
             format="image/png"),
        "Data":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target="10000"),
        "ErrorModel":
        dict(error_model_id="niiri:error_model_id",
             noise_distribution="nidm:NIDM_0000032",
             variance_homo="true",
             variance_spatial="nidm:NIDM_0000073",
             dependence="obo:STATO_0000357",
             dependence_spatial="nidm:NIDM_0000074"),
        "ModelParametersEstimation":
        dict(model_pe_id="niiri:model_parameters_estimation_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"),
        "FSL_ParameterEstimateMapNoLocation-1":
        dict(beta_map_id="niiri:beta_map_id_1",
             label="Parameter estimate 1",
             filename="pe1.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a...",
             param_est_id="niiri:model_parameters_estimation_id"),
        "FSL_ParameterEstimateMapNoLocation-2":
        dict(beta_map_id="niiri:beta_map_id_2",
             label="Parameter estimate 2",
             filename="pe2.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a...",
             param_est_id="niiri:model_parameters_estimation_id"),
        "FSL_ParameterEstimateMapNoLocation-3":
        dict(beta_map_id="niiri:beta_map_id_3",
             label="Parameter estimate 3",
             filename="pe3.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a...",
             param_est_id="niiri:model_parameters_estimation_id"),
        "FSL_ParameterEstimateMapNoLocation-4":
        dict(beta_map_id="niiri:beta_map_id_4",
             label="Parameter estimate 4",
             filename="pe4.nii.gz",
             format="image/nifti",
             coordinate_space_id="niiri:coordinate_space_id_1",
             sha="e43b6e01b0463fe7d40782137867a...",
             param_est_id="niiri:model_parameters_estimation_id"),
        "CoordinateSpace":
        dict(coordinate_space_id="niiri:coordinate_space_id_1",
             label="Coordinate space",
             voxel_to_world_mapping="[[ -3.5, 0, 0, 108.5], \
[ 0, 3.5, 0, -108.5], [ 0, 0, 3.5, -52.5], [ 0, 0, 0, 1]]",
             voxel_units="[ \\\"mm\\\", \\\"mm\\\", \\\"mm\\\" ]",
             voxel_size="[ 3.5, 3.5, 3.5 ]",
             coord_system="nidm:NIDM_0000077",
             number_of_dim="3",
             dimensions="[ 64, 64, 42 ]"),
        "FSL_ResidualMeanSquaresMap":
        dict(
            residual_mean_squares_map_id="niiri:residual_mean_squares_map_id",
            label="Residual Mean Squares Map",
            location="file://./ResidualMeanSquares.nii.gz",
            filename_1="ResidualMeanSquares.nii.gz",
            filename_2="sigmasquareds.nii.gz",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="1327a300eb1e20d42c67abb3c49a47b80ecabfebd13d0ba0aca0560e8bf43\
891f0e35a958c1afa84e041f62cf0038f58b4ab71f68b0b50d4153210aeed74f4ff",
            param_est_id="niiri:model_parameters_estimation_id"),
        "MaskMap_Analysis_fileName":
        dict(  # Analysis mask
            mask_id="niiri:mask_id_1",
            label="Mask",
            location="file://./Mask.nii.gz",
            filename="Mask.nii.gz",
            filename_2="mask.nii.gz",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            generated_by_act_id="niiri:model_parameters_estimation_id",
            used_by_act_id="niiri:contrast_estimation_id_1"),
        "ContrastWeights":
        dict(contrast_id="niiri:contrast_id_1",
             label="Contrast Weights: Generation",
             value="[1, 0, 0, 0]",
             statistic_type=STATO_TSTATISTIC_STR,
             stat_type_comment=STATO_TSTATISTIC_LABEL,
             contrast_name="Generation"),
        "ContrastEstimation":
        dict(contrast_estimation_id="niiri:contrast_estimation_id_1",
             label="Contrast estimation: Generation",
             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_1",
             param_est_map="niiri:beta_map_id_1"),
        "FSL_ContrastMap":
        dict(
            contrast_map_id="niiri:contrast_map_id_1",
            label="Contrast Map: Generation",
            location="file://./Contrast.nii.gz",
            format="image/nifti",
            filename_1="Contrast.nii.gz",
            filename_2="cope1.nii.gz",
            contrast_name="Generation",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="4c755c0ae6088f8001e0458f89e51fea0e2719b5dc747fed6f617ae12ad5c\
6a643e1afcb886bcabaaac7911f5e69086c1bd084af9f75dae75913d44a783151f6",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "ContrastStandardErrorMap":
        dict(
            contrast_standard_error_map_id="niiri:contrast_standard_error_map\
_id_1",
            label="Contrast Standard Error Map",
            location="file://./ContrastStandardError.nii.gz",
            format="image/nifti",
            filename="ContrastStandardError.nii.gz",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="8529f3ff9f10da8f332ced9d579990321475c1498b56d79ede560ba2eccf6\
d68718757dc7af78eb1e86617a41e6c9f55161f756d184e2b0fb06c3d419dc99856",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "DerivedMap-ContrastVariance":
        dict(
            derived_from_map_id="niiri:d4de4b20b2d408cd8d825ac0edb6030a",
            derived_map_type="nidm:NIDM_0000135",
            filename="varcope1.nii.gz",
            format="image/nifti",
            sha="7d183bbacc0b99cd1db84174d32445457f532bca9f774fdcc53bc1d0faa5e\
7d250a1abf03864bd90b30f96f5a7516e0056104a729a565019b0f254a8a7bced1e",
            map_id="niiri:contrast_standard_error_map_id_1"),
        "FSL_StatisticMap":
        dict(
            statistic_map_id="niiri:statistic_map_id_1",
            label="Statistic Map: Generation",
            location="file://./TStatistic.nii.gz",
            format="image/nifti",
            filename_1="TStatistic.nii.gz",
            filename_2="tstat1.nii.gz",
            statistic_type=STATO_TSTATISTIC_STR,
            stat_type_comment=STATO_TSTATISTIC_LABEL,
            contrast_name="Generation",
            error_dof="102",
            effect_dof="1",
            sha="b6286d36e678c23622b5b0486f0efb5b274f9a5e2a3ee6aceb6a0338f7745\
fb8a4d8f72b8af22c4ffb40c860bfb65940c87b03a7336cdf1a665f9cb07a5c2527",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "FSL_StatisticMap-Z":
        dict(
            statistic_map_id="niiri:z_statistic_map_id_1",
            label="Z-Statistic Map: Generation",
            location="file://./ZStatistic.nii.gz",
            format="image/nifti",
            filename_1="ZStatistic.nii.gz",
            filename_2="zstat1.nii.gz",
            statistic_type=STATO_ZSTATISTIC_STR,
            stat_type_comment=STATO_ZSTATISTIC_LABEL,
            contrast_name="Generation",
            effect_dof="1",
            error_dof="INF",
            sha="3a68a4e5963766af86d22a871a4dbca9568a46441a567855b3a84dbd47ea0\
1acea11ed77b37ce85078a219adaa92264296a4548c1ba39b11ff028e8fefd95d03",
            coordinate_space_id="niiri:coordinate_space_id_1",
            contrast_est_id="niiri:contrast_estimation_id_1"),
        "HeightThreshold":
        dict(
            height_threshold_id="niiri:height_threshold_id",
            thresh_type=OBO_STATISTIC_QNAME,
            label="Height Threshold: Z>2.3",
            value="2.3",
        ),
        "ExtentThreshold":
        dict(
            extent_threshold_id="niiri:extent_threshold_id",
            label="Extent Threshold: p<0.05 (FWE)",
            thresh_type=OBO_P_VALUE_FWER_QNAME,
            value="0.05",
        ),
        "PeakDefinitionCriteria":
        dict(peak_definition_criteria_id="niiri:peak_definition_criteria_id_1",
             label="Peak Definition Criteria",
             min_dist_peaks="0.0"),
        "ClusterDefinitionCriteria":
        dict(cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id_1",
             label="Cluster Connectivity Criterion: 26",
             connectivity="nidm:NIDM_0000129"),
        "Inference":
        dict(inference_id="niiri:inference_id_1",
             label="Inference: Generation",
             alternative_hyp="nidm:NIDM_0000060",
             stat_map_id="niiri:z_statistic_map_id_1",
             height_thresh_id="niiri:height_threshold_id",
             extent_thresh_id="niiri:extent_threshold_id",
             peak_def_id="niiri:peak_definition_criteria_id_1",
             cluster_def_id="niiri:cluster_definition_criteria_id_1",
             mask_id="niiri:mask_id_1",
             software_id="niiri:software_id"),
        "FSL_ExcursionSetMap":
        dict(
            id="niiri:excursion_set_map_id_1",
            label="Excursion Set Map",
            location="file://./ExcursionSet.nii.gz",
            format="image/nifti",
            filename_1="ExcursionSet.nii.gz",
            filename_2="thresh_zstat1.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="c74e3c47e4308f27423a195c7c3e70b64b8fd362d612a2543da76bced67f6\
66949b70272033ab3d4b7d0bbbfe22b7da13d56d25521664be0c96454fd180ee4cc",
            inference_id="niiri:inference_id_1"),
        "Image":
        dict(image_id="niiri:excursion_set_png_id_1",
             location="file://./rendered_thresh_zstat1.png",
             filename="rendered_thresh_zstat1.png",
             format="image/png"),
        "FSL_SignificantCluster-1":
        dict(cluster_id="niiri:significant_cluster_0001",
             label="Significant Cluster 0001",
             cluster_size_in_voxels="81",
             cluster_label_id="1",
             cluster_size_in_resels="23.1209189500945",
             p_value_fwe="0.00894",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "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:significant_cluster_0001"),
        "FSL_Coordinate-COG1":
        dict(
            coordinate_id="niiri:COG_coordinate_0001",
            label="Coordinate 0001",
            coord="[ -5.8, 19.1, 38.5 ]",
            coord_in_vox="[ 32.3, 39.2, 31.0 ]",
        ),
        "FSL_SignificantCluster-2":
        dict(cluster_id="niiri:significant_cluster_0002",
             label="Significant Cluster 0002",
             cluster_size_in_voxels="117",
             cluster_label_id="2",
             cluster_size_in_resels="19.4128470430038",
             p_value_fwe="0.000621",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "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:significant_cluster_0002"),
        "FSL_Coordinate-COG2":
        dict(
            coordinate_id="niiri:COG_coordinate_0002",
            label="Coordinate 0002",
            coord="[ -56.9, -57.1, 9.86 ]",
            coord_in_vox="[ 47.1, 19.2, 19.7 ]",
        ),
        "FSL_SignificantCluster-3":
        dict(cluster_id="niiri:significant_cluster_0003 ",
             label="Significant Cluster 0003",
             cluster_size_in_voxels="499",
             cluster_label_id="3",
             cluster_size_in_resels="19.4128470430038",
             p_value_fwe="1.26e-12",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "FSL_ClusterCenterOfGravity-3 ":
        dict(center_of_gravity_id="niiri:center_of_gravity_3 ",
             label="Center of gravity 3",
             location="niiri:COG_coordinate_0003 ",
             cluster_id="niiri:significant_cluster_0003 "),
        "FSL_Coordinate-COG3 ":
        dict(
            coordinate_id="niiri:COG_coordinate_0003 ",
            label="Coordinate 0003",
            coord="[ -47.2, 17.3, 9.18 ]",
            coord_in_vox="[ 43.4, 40.3, 23.9 ]",
        ),
        "FSL_SignificantCluster-4":
        dict(cluster_id="niiri:significant_cluster_0004 ",
             label="Significant Cluster 0004",
             cluster_size_in_voxels="1203",
             cluster_label_id="4",
             p_value_fwe="8.02e-24",
             excursion_set_id="niiri:excursion_set_map_id_1"),
        "FSL_ClusterCenterOfGravity-4  ":
        dict(center_of_gravity_id="niiri:center_of_gravity_4",
             label="Center of gravity 4",
             location="niiri:COG_coordinate_0004  ",
             cluster_id="niiri:significant_cluster_0004  "),
        "FSL_Coordinate-COG4  ":
        dict(
            coordinate_id="niiri:COG_coordinate_0004  ",
            label="Coordinate 0004",
            coord="[ -7.38, -72.5, -8.5 ]",
            coord_in_vox="[ 34.0, 14.7, 14.0 ]",
        ),
        "Peak-M4-1":
        dict(peak_id="niiri:peak_0004_1",
             label="Peak 0004_1",
             p_uncorr="3.51932e-09",
             location="niiri:coordinate_0004_1",
             equiv_z="5.79",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-1":
        dict(
            coordinate_id="niiri:coordinate_0004_1",
            label="Coordinate 0004_1",
            coord="[ -33.7, -66.7, -14.7 ]",
            coord_in_vox="[ 41, 17, 13 ]",
        ),
        "Peak-4-2":
        dict(peak_id="niiri:peak_0004_2",
             label="Peak 0004_2",
             p_uncorr="9.01048e-09",
             location="niiri:coordinate_0004_2",
             equiv_z="5.63",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-2":
        dict(
            coordinate_id="niiri:coordinate_0004_2",
            label="Coordinate 0004_2",
            coord="[ -38.0, -53.9, -21.9 ]",
            coord_in_vox="[ 42, 21, 12 ]",
        ),
        "Peak-4-3":
        dict(peak_id="niiri:peak_0004_3",
             label="Peak 0004_3",
             p_uncorr="9.54787e-09",
             location="niiri:coordinate_0004_3",
             equiv_z="5.62",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-3":
        dict(
            coordinate_id="niiri:coordinate_0004_3",
            label="Coordinate 0004_3",
            coord="[ 16.1, -96.6, 5.82 ]",
            coord_in_vox="[ 28, 7, 16 ]",
        ),
        "Peak-4-4":
        dict(peak_id="niiri:peak_0004_4",
             label="Peak 0004_4",
             p_uncorr="1.01163e-08",
             location="niiri:coordinate_0004_4",
             equiv_z="5.61",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-4":
        dict(coordinate_id="niiri:coordinate_0004_4",
             label="Coordinate 0004_4",
             coord="[ -48.1, -73.7, -9.24 ]",
             coord_in_vox="[ 45, 15, 14 ]"),
        "Peak-4-5":
        dict(peak_id="niiri:peak_0004_5",
             label="Peak 0004_5",
             p_uncorr="1.07176e-08",
             location="niiri:coordinate_0004_5",
             equiv_z="5.6",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-5":
        dict(coordinate_id="niiri:coordinate_0004_5",
             label="Coordinate 0004_5",
             coord="[ -25.5, -80.4, -15.3 ]",
             coord_in_vox="[ 39, 13, 12 ]"),
        "Peak-4-6":
        dict(peak_id="niiri:peak_0004_6",
             label="Peak 0004_6",
             p_uncorr="1.34887e-08",
             location="niiri:coordinate_0004_6",
             equiv_z="5.56",
             cluster_id="niiri:significant_cluster_0004"),
        "FSL_Coordinate-4-6":
        dict(coordinate_id="niiri:coordinate_0004_6",
             label="Coordinate 0004_6",
             coord="[ 0.791, -87.2, 3.23 ]",
             coord_in_vox="[ 32, 10, 16 ]"),
        "Peak-M3-1":
        dict(peak_id="niiri:peak_0003_1",
             label="Peak 0003_1",
             p_uncorr="1.01163e-08",
             location="niiri:coordinate_0003_1",
             equiv_z="5.61",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-1":
        dict(coordinate_id="niiri:coordinate_0003_1",
             label="Coordinate 0003_1",
             coord="[ -38.3, 20.7, 13.2 ]",
             coord_in_vox="[ 41, 41, 25 ]"),
        "Peak-3-2":
        dict(peak_id="niiri:peak_0003_2",
             label="Peak 0003_2",
             p_uncorr="1.52768e-07",
             location="niiri:coordinate_0003_2",
             equiv_z="5.12",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-2":
        dict(coordinate_id="niiri:coordinate_0003_2",
             label="Coordinate 0003_2",
             coord="[ -45.5, 17.8, -6.65 ]",
             coord_in_vox="[ 43, 41, 20 ]"),
        "Peak-3-3":
        dict(peak_id="niiri:peak_0003_3",
             label="Peak 0003_3",
             p_uncorr="1.82833e-06",
             location="niiri:coordinate_0003_3",
             equiv_z="4.63",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-3":
        dict(coordinate_id="niiri:coordinate_0003_3",
             label="Coordinate 0003_3",
             coord="[ -63.4, 3.78, 0.366 ]",
             coord_in_vox="[ 48, 37, 21 ]"),
        "Peak-3-4":
        dict(peak_id="niiri:peak_0003_4",
             label="Peak 0003_4",
             p_uncorr="9.77365e-06",
             location="niiri:coordinate_0003_4",
             equiv_z="4.27",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-4":
        dict(coordinate_id="niiri:coordinate_0003_4",
             label="Coordinate 0003_4",
             coord="[ -57.4, 31.8, -2.12 ]",
             coord_in_vox="[ 46, 45, 22 ]"),
        "Peak-3-5":
        dict(peak_id="niiri:peak_0003_5",
             label="Peak 0003_5",
             p_uncorr="1.22151e-05",
             location="niiri:coordinate_0003_5",
             equiv_z="4.22",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-5":
        dict(coordinate_id="niiri:coordinate_0003_5",
             label="Coordinate 0003_5",
             coord="[ -34.0, 8.84, 28.3 ]",
             coord_in_vox="[ 40, 37, 28 ]"),
        "Peak-3-6":
        dict(peak_id="niiri:peak_0003_6",
             label="Peak 0003_6",
             p_uncorr="1.89436e-05",
             location="niiri:coordinate_0003_6",
             equiv_z="4.12",
             cluster_id="niiri:significant_cluster_0003"),
        "FSL_Coordinate-3-6":
        dict(coordinate_id="niiri:coordinate_0003_6",
             label="Coordinate 0003_6",
             coord="[ -53.3, 23.3, 12.2 ]",
             coord_in_vox="[ 45, 42, 25 ]"),
        "Peak-M2-1":
        dict(peak_id="niiri:peak_0002_1",
             label="Peak 0002_1",
             p_uncorr="1.74205e-06",
             location="niiri:coordinate_0002_1",
             equiv_z="4.64",
             cluster_id="niiri:significant_cluster_0002"),
        "FSL_Coordinate-2-1":
        dict(coordinate_id="niiri:coordinate_0002_1",
             label="Coordinate 0002_1",
             coord="[ -56.2, -61.9, 4.03 ]",
             coord_in_vox="[ 47, 18, 18 ]"),
        "Peak-2-2":
        dict(peak_id="niiri:peak_0002_2",
             label="Peak 0002_2",
             p_uncorr="4.71165e-06",
             location="niiri:coordinate_0002_2",
             equiv_z="4.43",
             cluster_id="niiri:significant_cluster_0002"),
        "FSL_Coordinate-2-2":
        dict(coordinate_id="niiri:coordinate_0002_2",
             label="Coordinate 0002_2",
             coord="[ -56.7, -53.1, 18.2 ]",
             coord_in_vox="[ 47, 20, 22 ]"),
        "Peak-M1-1":
        dict(peak_id="niiri:peak_0001_1",
             label="Peak 0001_1",
             p_uncorr="2.01334e-06",
             location="niiri:coordinate_0001_1",
             equiv_z="4.61",
             cluster_id="niiri:significant_cluster_0001"),
        "FSL_Coordinate-1-1":
        dict(coordinate_id="niiri:coordinate_0001_1",
             label="Coordinate 0001_1",
             coord="[ -8.35, 15.1, 39.6 ]",
             coord_in_vox="[ 33, 38, 31 ]"),
        "Peak-1-2":
        dict(peak_id="niiri:peak_0001_2",
             label="Peak 0001_2",
             p_uncorr="0.000788846",
             location="niiri:coordinate_0001_2",
             equiv_z="3.16",
             cluster_id="niiri:significant_cluster_0001"),
        "FSL_Coordinate-1-2":
        dict(coordinate_id="niiri:coordinate_0001_2",
             label="Coordinate 0001_2",
             coord="[ -9.14, 30.5, 23.7 ]",
             coord_in_vox="[ 33, 43, 28 ]"),
        "Peak-1-3":
        dict(peak_id="niiri:peak_0001_3",
             label="Peak 0001_3",
             p_uncorr="0.00122277",
             location="niiri:coordinate_0001_3",
             equiv_z="3.03",
             cluster_id="niiri:significant_cluster_0001"),
        "FSL_Coordinate-1-3":
        dict(coordinate_id="niiri:coordinate_0001_3",
             label="Coordinate 0001_3",
             coord="[ -19.6, 17.4, 34.7 ]",
             coord_in_vox="[ 36, 39, 30 ]"),
        "Peak-1-4":
        dict(peak_id="niiri:peak_0001_4",
             label="Peak 0001_4",
             p_uncorr="0.00554262",
             location="niiri:coordinate_0001_4",
             equiv_z="2.54",
             cluster_id="niiri:significant_cluster_0001"),
        "FSL_Coordinate-1-4":
        dict(coordinate_id="niiri:coordinate_0001_4",
             label="Coordinate 0001_4",
             coord="[ -9.64, 40.1, 17.3 ]",
             coord_in_vox="[ 33, 46, 27 ]"),
        "FSL_SearchSpaceMaskMap":
        dict(
            search_space_id="niiri:search_space_mask_id",
            location="file://./SearchSpaceMask.nii.gz",
            filename_1="SearchSpaceMask.nii.gz",
            filename_2="mask.nii.gz",
            label="Search Space Mask Map",
            user_defined="false",
            format="image/nifti",
            coordinate_space_id="niiri:coordinate_space_id_1",
            search_vol_voxels="45203",
            search_vol_units="1.93808e+06",
            search_vol_resels="3753.84",
            resel_size="12.0418",
            noise_roughness="0.384676",
            random_field_station="true",
            sha="cc1a96a6111e5107eb08487e38e6d7f8164b9d1d3f1fc10948bdbcfaea642\
fe9bfae278c7fc372b65cac7232ea58fd8fb5914014e7b9a5d6200592b12b2a728b",
            inference_id="niiri:inference_id_1",
            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"),
        "FSL_Software":
        dict(software_id="niiri:software_id",
             software_type="nlx:birnlex_2067",
             label="FSL",
             version="5.0.x",
             feat_version="6.00"),
        "FSL_GrandMeanMap":
        dict(
            grand_mean_map_id="niiri:grand_mean_map_id",
            label="Grand Mean Map",
            location="file://./GrandMean.nii.gz",
            filename_1="GrandMean.nii.gz",
            filename_2="mean_func.nii.gz",
            format="image/nifti",
            masked_median="9597.36",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="7a2703cea740e27a5170fb19e4a09b5e815e4b7e477bc75958404d675aa40\
8f53f747892a2ef4472f933cf5f12cd21cea99d5f5e551938081636fb6d4049473e",
            model_pe_id="niiri:model_parameters_estimation_id")
    }

    NIDM_FSL_DIR = os.path.join(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'fsl',
        "example001")
    ttl_file = os.path.join(NIDM_FSL_DIR, 'fsl_nidm.ttl')
    example = ExampleFromTemplate(nidm_classes, ttl_file, False)
    example.create_example()
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.3.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(comment="Group: Control group with 23 subjects",
             id="niiri:group_id",
             label="Group: Control",
             name="Control",
             numsubjects="23"),
        "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-OLS":
        dict(comment="Error Model: Ordinary least squares",
             error_model_id="niiri:error_model_id",
             noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
             variance_homo="true",
             variance_spatial=NIDM_SPATIALLY_LOCAL_MODEL,
             dependence=NIDM_INDEPENDENT_ERROR,
             dependence_spatial=NIDM_SPATIALLY_LOCAL_MODEL),
        "ErrorModel-WLS":
        dict(comment="Error Model: Weighted least squares",
             error_model_id="niiri:error_model_id",
             noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
             variance_homo="false",
             variance_spatial=NIDM_SPATIALLY_LOCAL_MODEL,
             dependence=NIDM_INDEPENDENT_ERROR,
             dependence_spatial=NIDM_SPATIALLY_LOCAL_MODEL),
        "ErrorModel-SPMnonSphericity":
        dict(comment="Error Model: SPM non sphericity",
             error_model_id="niiri:error_model_id",
             noise_distribution=STATO_GAUSSIAN_DISTRIBUTION,
             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_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"),
        "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="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"),
        "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",
            label="Cluster Labels Map",
            coordinate_space_id="niiri:coordinate_space_id_1",
            sha="13093aae03897e2518307d000eb298f4b1439814d8d3d77c622b717423f93\
506dd5de5669513ab65c6dd74a7d27ee9df08620f546ed00575517b40e5878c2c96"),
        "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"),
        "Inference-OneTailed":
        dict(comment="Inference: one-tailed",
             inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp=NIDM_ONE_TAILED_TEST,
             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"),
        "Inference-TwoTailed":
        dict(comment="Inference: two-tailed",
             inference_id="niiri:inference_id",
             label="Inference",
             alternative_hyp=NIDM_TWO_TAILED_TEST,
             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"),
        "ClusterDefinitionCriteria-06":
        dict(comment="Cluster connectivity: face",
             cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
             label="Cluster Connectivity Criterion: 6",
             connectivity="nidm:NIDM_0000130"),
        "ClusterDefinitionCriteria-18":
        dict(comment="Cluster connectivity: face or edge",
             cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
             label="Cluster Connectivity Criterion: 18",
             connectivity="nidm:NIDM_0000128"),
        "ClusterDefinitionCriteria-26":
        dict(comment="Cluster connectivity: face, edge or corner",
             cluster_definition_criteria_id="niiri:cluster_definition_criteria\
_id",
             label="Cluster Connectivity Criterion: 26",
             connectivity="nidm:NIDM_0000129")
    }

    # Delete old examples
    shutil.rmtree(EX_DIR)
    os.mkdir(EX_DIR)
    example = ExampleFromTemplate(nidm_classes, EX_DIR, True)
    example.create_example()
Beispiel #27
0
def main():
    nidm_classes = {
        "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"),
        "Data":
        dict(data_id='niiri:data_id',
             label="Data",
             scaling="true",
             target="10000"),
        "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=
            "400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            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=
            "400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            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=
            "400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            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=
            "400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            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=
            "400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
            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="nlx:birnlex_2067",
             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()
Beispiel #28
0
def main():
    nidm_classes = {
        "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",
        ),
        "Data": dict(data_id="niiri:data_id", label="Data", scaling="true", target=100),
        "ErrorModel": dict(
            error_model_id="niiri:error_model_id",
            noise_distribution="nidm:NIDM_0000032",
            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="Beta Map 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="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_Location-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 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="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_Location-3": dict(
            beta_map_id="niiri:beta_map_id_3",
            label="Beta Map 3",
            location="file:///path/to/ParameterEstimate_0003.nii.gz",
            filename="ParameterEstimate_0003.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="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",
            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="file:///path/to/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="file:///path/to/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="file:///path/to/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="file:///path/to/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="Statistic Map: listening > reading",
            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 > 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="Statistic Map: motor",
            location="file:///path/to/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="file:///path/to/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="file:///path/to/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="file:///path/to/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",
            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",
        ),
        "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_2",
            extent_thresh_id="niiri:extent_threshold_id_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",
        ),
        "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.1.0",
            time="2014-05-19T10:30:00.000+01:00",
        ),
        "SPM_ReselsPerVoxelMap": dict(
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
            label="Resels per Voxel Map",
            location="file:///path/to/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="nlx:nif-0000-00343", label="SPM", version="12b.5853"
        ),
        "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_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()
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="Beta Map 1",
            coordinate_space_id="niiri:coordinate_space_id_1",
            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="fab2573099693215bac756bc796fbc983524473dec5c1b2d66fb83694c174\
12731df7f574094cb6c4a77994af7be11ed9aa545090fbe8ec6565a5c3c3dae8f0f",
            map_id="niiri:beta_map_id_1"
            ),
        "ParameterEstimateMap-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 2",
            coordinate_space_id="niiri:coordinate_space_id_1",
            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, \
-70],[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, 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="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.05 (FWE)",
            value="0.0499999999999976",
            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"
            ),
        "DerivedMap-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"
            ),
        "NIDMBundle": dict(
            bundle_id="niiri:spm_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_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"
            ),
        "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()
Beispiel #30
0
def main():
    nidm_classes = {
        "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"
            ),
        "Data": dict(
            data_id='niiri:data_id',
            label="Data",
            scaling="true",
            target=100
            ),
        "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="file:///path/to/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_Location-1": dict(
            beta_map_id="niiri:beta_map_id_1",
            label="Beta Map 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="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_Location-2": dict(
            beta_map_id="niiri:beta_map_id_2",
            label="Beta Map 2",
            location="file:///path/to/ParameterEstimate_0002.nii",
            filename="ParameterEstimate_0002.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="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(  # Mask generated by Model Param. Est.
            # (analysis mask)
            mask_id="niiri:mask_id_2",
            label="Mask Map 2",
            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"),
        "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="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="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="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"),
        "StatisticMap_T": dict(
            statistic_map_id="niiri:statistic_map_id",
            label="Statistic Map: listening > rest",
            location="file:///path/to/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="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"
            ),
        "MaskMap-2": dict(  # Explicit mask used by Inference
            mask_id="niiri:mask_id_3",
            label="Mask Map",
            location="file:///path/to/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="file:///path/to/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"
            ),
        "SignificantCluster-1": dict(
            cluster_id="niiri:significant_cluster_0001",
            label="Significant 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"
            ),
        "SignificantCluster-2": dict(
            cluster_id="niiri:significant_cluster_0002",
            label="Significant 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"
            ),
        "SignificantCluster-3": dict(
            cluster_id="niiri:significant_cluster_0003",
            label="Significant 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:significant_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:significant_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:significant_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:significant_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:significant_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:significant_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:significant_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="file:///path/to/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.1.0",
            time="2014-05-19T10:30:00.000+01:00"
            ),
        "SPM_ReselsPerVoxelMap": dict(
            resels_per_voxel_map_id="niiri:resels_per_voxel_map_id",
            label="Resels per Voxel Map",
            location="file:///path/to/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="file:///path/to/ClusterLabels.nii.gz",
            filename="ClusterLabels.nii.gz",
            format="image/nifti"
            ),
        "SPM_Software": dict(
            software_id="niiri:software_id",
            software_type="nlx:nif-0000-00343",
            label="SPM",
            version="12b.5853"
            ),
        "Image": dict(
            image_id="niiri:maximum_intensity_projection_id",
            location="file:///path/to/MaximumIntensityProjection.png",
            filename="MaximumIntensityProjection.png",
            format="image/png"
            ),
        "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_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()
Beispiel #31
0
def main():
	nidm_classes = {
		"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"
			),
		"Data": dict(
			data_id='niiri:data_id',
			label="Data",
			scaling="true",
			target="10000"
			),
		"ErrorModel": dict(
			error_model_id="niiri:error_model_id",
			noise_distribution="nidm:NIDM_0000032",
			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"
			),
		"FSL_ParameterEstimateMap-1": dict(
			beta_map_id="niiri:beta_map_id_1",
			label="Parameter estimate 1",
			location="file://path/to/ParameterEstimate_0001.nii.gz",
			filename_1="pe1.nii.gz",
			filename_2="ParameterEstimate_0001.nii.gz",
			format="image/nifti",
			coordinate_space_id="niiri:coordinate_space_id_1",
			sha="f51b6e01b0463fe7d40782137867a...",
			param_est_id="niiri:model_pe_id"),
		"FSL_ParameterEstimateMap-2": dict(
			beta_map_id="niiri:beta_map_id_2",
			label="Parameter estimate 2",
			location="file://path/to/ParameterEstimate_0002.nii.gz",
			filename_1="pe2.nii.gz",
			filename_2="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 ]"),
		"FSL_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_1="ResidualMeanSquares.nii.gz",
			filename_2="sigmasquareds.nii.gz",
			format="image/nifti",
			coordinate_space_id="niiri:coordinate_space_id_1",
			sha="e43b6e01b0463fe7d40782137867a...",
			param_est_id="niiri:model_pe_id"),
		"MaskMap_Analysis_fileName": dict( # The analysis mask
			mask_id="niiri:mask_id_1",
			label="Mask",
			location="file://path/to/Mask.nii.gz",
			filename="Mask.nii.gz", 
			filename_2="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"
			),
		"FSL_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_1="Contrast.nii.gz",
			filename_2="cope1.nii.gz",
			contrast_name="listening > rest",
			coordinate_space_id="niiri:coordinate_space_id_1",
			sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
			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"
			),
		"FSL_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_1="TStatistic_0001.nii.gz",
			filename_2="tstat1.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="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
			coordinate_space_id="niiri:coordinate_space_id_1",
			contrast_est_id="niiri:contrast_estimation_id"),
		"FSL_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_1="ZStatistic_0001.nii.gz",
			filename_2="zstat1.nii.gz",
			statistic_type=STATO_ZSTATISTIC_STR,
			contrast_name="listening > rest",
			error_dof="INF",
			effect_dof="1",
			sha="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
			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_fileName": 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",
			filename_2="mask.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_1="ExcursionSet.nii.gz",
			filename_2="thresh_zstat1.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="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
			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_SignificantCluster-1": dict(
			cluster_id="niiri:significant_cluster_0001",
			label="Significant 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:significant_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_SignificantCluster-2": dict(
			cluster_id="niiri:significant_cluster_0002",
			label="Significant 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:significant_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:significant_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:significant_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:significant_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:significant_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:significant_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:significant_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_1="SearchSpaceMask.nii.gz",
			filename_2="mask.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="400a2f07d99ed9be06577e6ecc89222cf4b688c654bc89067da558e88b73b97dd1b25e6c98f2a735fa0a1409598cff7e6025bda55abb6b9f5ef65d8d307eeba8",
			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"
			),
		"FSL_Software": dict(
			software_id="niiri:software_id",
			software_type="nlx:birnlex_2067",
			label="FSL",
			version="5.0.x",
			feat_version="6.00"
			),
		"FSL_GrandMeanMap": dict(
			grand_mean_map_id="niiri:grand_mean_map_id",
			label="Grand Mean Map",
			location="file://path/to/GrandMean.nii.gz",
			filename_1="GrandMean.nii.gz",
			filename_2="mean_func.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()