c5ad56010a3302472f6d25ba1a34d1f826d2d2cb,nisl/tests/test_masking.py,,test_apply_mask,#,90

Before Change


    mask = np.ones((40, 40, 40))
    for affine in (np.eye(4), np.diag((1, 1, -1, 1)),
                   np.diag((.5, 1, .5, 1))):
        series = masking.apply_mask(Nifti1Image(data, affine),
                                    Nifti1Image(mask, affine), smooth=9)
        series = np.reshape(series[0, :], (40, 40, 40))
        vmax = series.max()
        // We are expecting a full-width at half maximum of
        // 9mm/voxel_size:

After Change


    data = np.zeros((40, 40, 40, 2))
    data[20, 20, 20] = 1
    mask = np.ones((40, 40, 40))
    for create_files in (False, True):
        for affine in (np.eye(4), np.diag((1, 1, -1, 1)),
                       np.diag((.5, 1, .5, 1))):
            data_img = Nifti1Image(data, affine)
            mask_img = Nifti1Image(mask, affine)
            with write_tmp_imgs(data_img, mask_img, create_files=create_files)\
                     as filenames:
                series = masking.apply_mask(filenames[0], filenames[1],
                                            smooth=9)

            series = np.reshape(series[0, :], (40, 40, 40))
            vmax = series.max()
            // We are expecting a full-width at half maximum of
            // 9mm/voxel_size:
            above_half_max = series > .5 * vmax
            for axis in (0, 1, 2):
                proj = np.any(np.any(np.rollaxis(above_half_max,
                              axis=axis), axis=-1), axis=-1)
                np.testing.assert_equal(proj.sum(),
                                        9 / np.abs(affine[axis, axis]))

    // Check that NaNs in the data do not propagate
    data[10, 10, 10] = np.NaN
    data_img = Nifti1Image(data, affine)
    mask_img = Nifti1Image(mask, affine)
    series = masking.apply_mask(data_img, mask_img, smooth=9)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: nilearn/nilearn
Commit Name: c5ad56010a3302472f6d25ba1a34d1f826d2d2cb
Time: 2013-05-14
Author: philippe.gervais@inria.fr
File Name: nisl/tests/test_masking.py
Class Name:
Method Name: test_apply_mask


Project Name: interactiveaudiolab/nussl
Commit Name: 310f9e600e32a69efcb60ae7efee33138d665f51
Time: 2017-09-06
Author: daniel.felixkim@gmail.com
File Name: nussl/separation/nmf_mfcc.py
Class Name: NMF_MFCC
Method Name: make_audio_signals


Project Name: rusty1s/pytorch_geometric
Commit Name: 1f0750670cf8ea24ad264debf9603002ab0fb565
Time: 2021-03-15
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/pool/mem_pool.py
Class Name: MemPool
Method Name: forward