Beispiel #1
0
def test_BrainMapDecoder_failure(testdata_laird):
    """
    Smoke test for discrete.BrainMapDecoder where there are no features left.
    """
    decoder = discrete.BrainMapDecoder(features=["doggy"])
    with pytest.raises(Exception):
        decoder.fit(testdata_laird)
Beispiel #2
0
def test_BrainMapDecoder(testdata_laird):
    """Smoke test for discrete.BrainMapDecoder."""
    ids = testdata_laird.ids[:5]
    labels = testdata_laird.get_labels(ids=testdata_laird.ids)
    decoder = discrete.BrainMapDecoder(features=labels)
    decoder.fit(testdata_laird)
    decoded_df = decoder.transform(ids=ids)
    assert isinstance(decoded_df, pd.DataFrame)
    assert decoded_df.shape == (len(labels), 6)
Beispiel #3
0
def test_BrainMapDecoder(testdata_laird):
    """
    Smoke test for discrete.BrainMapDecoder
    """
    ids = testdata_laird.ids[:5]
    decoder = discrete.BrainMapDecoder()
    decoder.fit(testdata_laird)
    decoded_df = decoder.transform(ids=ids)
    assert isinstance(decoded_df, pd.DataFrame)
Beispiel #4
0
arr[65:75, 50:60, 50:60] = 1
mask_img = nib.Nifti1Image(arr, dset.masker.mask_img.affine)
plot_roi(mask_img, draw_cross=False)

# Get studies with voxels in the mask
ids = dset.get_studies_by_mask(mask_img)

###############################################################################
#
# .. _brain-map-decoder-example:
#
# Decode an ROI image using the BrainMap method
# -----------------------------------------------------------------------------

# Run the decoder
decoder = discrete.BrainMapDecoder(correction=None)
decoder.fit(dset)
decoded_df = decoder.transform(ids=ids)
decoded_df.sort_values(by="probReverse", ascending=False).head()

###############################################################################
#
# .. _neurosynth-chi2-decoder-example:
#
# Decode an ROI image using the Neurosynth chi-square method
# -----------------------------------------------------------------------------

# Run the decoder
decoder = discrete.NeurosynthDecoder(correction=None)
decoder.fit(dset)
decoded_df = decoder.transform(ids=ids)