if copy:
// FIXME: "import copy" overwrites input parameter "copy"!
import copy
data = copy.copy(data)
affine = copy.copy(affine)
if target_affine is None and target_shape is None:
return niimg
if (np.all(np.array(target_shape) == data.shape) and
After Change
// noop cases
niimg = utils.check_niimg(niimg)
if copy:
niimg = Nifti1Image(niimg.get_data(), niimg.get_affine())
if target_affine is None and target_shape is None:
return niimg
shape = utils._get_shape(niimg)
affine = niimg.get_affine()
if (np.all(np.array(target_shape) == shape[:3]) and
np.allclose(target_affine, affine)):