예제 #1
0
def test_getMeanFile():
    paths = [
        'analysis.ica/melodic_IC.nii.gz', 'analysis.ica/melodic_mix',
        'analysis.ica/melodic_FTmix', 'analysis.ica/mean.nii.gz'
    ]

    paths = [op.join(*p.split('/')) for p in paths]

    with tests.testdir(paths) as testdir:
        meldir = op.join(testdir, 'analysis.ica')
        expected = op.join(testdir, 'analysis.ica', 'mean.nii.gz')

        assert mela.getMeanFile(meldir) == expected

    paths = [
        'analysis.ica/melodic_IC.nii.gz', 'analysis.ica/melodic_mix',
        'analysis.ica/melodic_FTmix', 'analysis.ica/mean.txt'
    ]

    paths = [op.join(*p.split('/')) for p in paths]

    with tests.testdir(paths) as testdir:
        meldir = op.join(testdir, 'analysis.ica')
        with pytest.raises(fslpath.PathError):
            mela.getMeanFile(meldir)
예제 #2
0
def test_MelodicImage_atts():

    with tests.testdir() as testdir:
        meldir = _create_dummy_melodic_analysis(testdir)
        img = meli.MelodicImage(meldir)

        assert img.shape == (10, 10, 10, 10)
        assert img.pixdim == (1, 1, 1, 1)
        assert np.all(img.voxToWorldMat == np.eye(4))
        assert img.numComponents() == 10
        assert img.getMelodicDir() == meldir

        assert img.getReportFile() == mela.getReportFile(meldir)
        assert img.getTopLevelAnalysisDir() == mela.getTopLevelAnalysisDir(
            meldir)
        assert img.getDataFile() == mela.getDataFile(meldir)
        assert img.getMeanFile() == mela.getMeanFile(meldir)