e2bf248a400175ac1a153cdba62147e9162a710f,nilearn/image/resampling.py,,resample_img,#,291

Before Change


        // TODO: flip axes that are flipped
        // TODO: un-shuffle permuted dimensions

        indices = []
        for tmpo, tmpb in zip(offsets[:3], b):
            indices.append()
        slices=1
        // for each dimension:
        //     Save index as translation + offset
        //       (if not flipped: offset before, else: offset after)

After Change


        if copy and not input_img_is_string:
            img = _utils.copy_img(img)
        return img
    if target_affine is affine and target_shape is shape:
        return img
    if target_affine is not None:
        target_affine = np.asarray(target_affine)

    if (np.all(np.array(target_shape) == shape[:3]) and
            np.allclose(target_affine, affine)):
        if copy and not input_img_is_string:
            img = _utils.copy_img(img)
        return img

    // We now know that some resampling must be done.
    // The value of "copy" is of no importance: output is always a separate
    // array.
    data = img.get_data()

    // Get a bounding box for the transformed data
    // Embed target_affine in 4x4 shape if necessary
    if target_affine.shape == (3, 3):
        missing_offset = True
        target_affine_tmp = np.eye(4)
        target_affine_tmp[:3, :3] = target_affine
        target_affine = target_affine_tmp
    else:
        missing_offset = False
        target_affine = target_affine.copy()
    print(affine)
    print(target_affine)
    transform_affine = np.linalg.inv(target_affine).dot(affine)
    (xmin, xmax), (ymin, ymax), (zmin, zmax) = get_bounds(
        data.shape[:3], transform_affine)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: nilearn/nilearn
Commit Name: e2bf248a400175ac1a153cdba62147e9162a710f
Time: 2019-04-17
Author: gkiar07@gmail.com
File Name: nilearn/image/resampling.py
Class Name:
Method Name: resample_img


Project Name: D2KLab/entity2rec
Commit Name: b0848e1af4b1cf9c4898d549de19e81b167043b2
Time: 2018-07-17
Author: enricopalumbo0@gmail.com
File Name: entity2rec/evaluator.py
Class Name: Evaluator
Method Name: evaluate


Project Name: daniel-kukiela/nmt-chatbot
Commit Name: 0e2a7f6d85a341959eba41d65019b2566084b406
Time: 2017-12-03
Author: daniel@kukiela.pl
File Name: inference.py
Class Name:
Method Name: