You need to create the copy of the object. You may do it using numpy.copy() since you are having numpy object. Hence, your initialisation should be like:

imageEdited_3d = imageOriginal_3d.copy()

Also there is copy module for creating the deep copy OR, shallow copy. This works independent of object type. For example, your code using copy should be as:

from copy import copy, deepcopy

# Creates shallow copy of object
imageEdited_3d = copy(imageOriginal_3d)

# Creates deep copy of object
imageEdited_3d = deepcopy(imageOriginal_3d)

Description:

A shallow copy constructs a new compound object and then (to the extent possible) inserts references into it to the objects found in the original.

A deep copy constructs a new compound object and then, recursively, inserts copies into it of the objects found in the original.

Answer from Moinuddin Quadri on Stack Overflow
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.copy.html
numpy.copy โ€” NumPy v2.5 Manual
Note that, np.copy clears previously set WRITEABLE=False flag. >>> a = np.array([1, 2, 3]) >>> a.flags["WRITEABLE"] = False >>> b = np.copy(a) >>> b.flags["WRITEABLE"] True >>> b[0] = 3 >>> b array([3, 2, 3])
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ user โ€บ basics.copies.html
Copies and views โ€” NumPy v2.5 Manual
When a new array is created by duplicating the data buffer as well as the metadata, it is called a copy. Changes made to the copy do not reflect on the original array. Making a copy is slower and memory-consuming but sometimes necessary. A copy can be forced by using ndarray.copy.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ how-to-copy-numpy-array-into-another-array
How to Copy NumPy array into another array? - GeeksforGeeks
January 10, 2024 - Many times there is a need to copy one array to another. Numpy provides the facility to copy array using different methods. In this Copy NumPy Array into Another ArrayThere are various ways to copies created in NumPy arrays in Python, here we are discussing some generally used methods for copies cre
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ numpy-copy-and-view
NumPy Copy and View of Array - GeeksforGeeks
January 14, 2026 - Explanation: A NumPy array arr is created and a view v is made using .view(). Though they have different IDs, they share the same data, so changes in arr (like arr[0] = 12) also appear in v. A copy creates a new, independent array with its own memory. Any change to the copied array wonโ€™t affect the original one, and vice versa. This is useful when you want to modify data safely without touching the original.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.2 โ€บ reference โ€บ generated โ€บ numpy.ndarray.copy.html
numpy.ndarray.copy โ€” NumPy v2.2 Manual
>>> import copy >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) >>> c = copy.deepcopy(a) >>> c[2][0] = 10 >>> c array([1, 'm', list([10, 3, 4])], dtype=object) >>> a array([1, 'm', list([2, 3, 4])], dtype=object)
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.copy.html
numpy.copy โ€” NumPy v2.1 Manual
Note that, np.copy clears previously set WRITEABLE=False flag. >>> a = np.array([1, 2, 3]) >>> a.flags["WRITEABLE"] = False >>> b = np.copy(a) >>> b.flags["WRITEABLE"] True >>> b[0] = 3 >>> b array([3, 2, 3])
๐ŸŒ
w3resource
w3resource.com โ€บ numpy โ€บ array-creation โ€บ copy.php
NumPy: numpy.copy() function - w3resource
The numpy.copy() function is used to get an array copy of an given object. The copy() function can be useful when you want to make changes to an array without modifying the original array.
Find elsewhere
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.copy.html
numpy.copy โ€” NumPy v2.6.dev0 Manual
Note that, np.copy clears previously set WRITEABLE=False flag. >>> a = np.array([1, 2, 3]) >>> a.flags["WRITEABLE"] = False >>> b = np.copy(a) >>> b.flags["WRITEABLE"] True >>> b[0] = 3 >>> b array([3, 2, 3])
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ python โ€“ numpy array copy
Python - NumPy Array Copy - Spark By {Examples}
March 27, 2024 - Use numpy.copy() function to copy Python NumPy array (ndarray) to another array. This method takes the array you wanted to copy as an argument and returns
๐ŸŒ
Sciinstitute
sciinstitute.github.io โ€บ ShapeWorks โ€บ 6.3 โ€บ notebooks โ€บ array-passing-without-copying.html
Array passing without copying - ShapeWorks
img2 = sw.Image(img1) # make a copy to be processed by a scipy Python filter (spacing preserved) In [ ]: from scipy import ndimage ยท In [ ]: ck = ndimage.gaussian_filter(img2.toArray(), 12.0) In [ ]: ck.shape ยท In [ ]: ck.dtype ยท In [ ]: ck.flags['OWNDATA'] In [ ]: img2.assign(ck) In [ ]: # notice numpy array ownership has been transferred to Image ck.flags['OWNDATA'] In [ ]: plotter.add_volume(sw.sw2vtkImage(img2), shade=True, show_scalar_bar=True) plotter.add_volume(sw.sw2vtkImage(img1), shade=True, show_scalar_bar=True) In [ ]: plotter.show()
๐ŸŒ
Readthedocs
ecco-v4-python-tutorial.readthedocs.io โ€บ ECCO_v4_Operating_on_Numpy_Arrays.html
Operating on Numpy arrays โ€” ECCO Version 4 Python Tutorial 4.4.1 documentation
Operating on the right hand side of the assignment does indeed new arrays in memory leaving the original SSH numpy array untouched. A second way to have a new variable assignment not point to the original variable is to use the copy or deepcopy command.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.ndarray.copy.html
numpy.ndarray.copy โ€” NumPy v2.6.dev0 Manual
>>> import copy >>> a = np.array([1, 'm', [2, 3, 4]], dtype=np.object_) >>> c = copy.deepcopy(a) >>> c[2][0] = 10 >>> c array([1, 'm', list([10, 3, 4])], dtype=object) >>> a array([1, 'm', list([2, 3, 4])], dtype=object)
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ array-copying-in-python
Array Copying in Python - GeeksforGeeks
April 30, 2025 - Explanation: A deep copy creates an independent copy of the array, including all of its elements. Using copy(), b becomes a separate object, so changes to a do not affect b . When dealing with NumPy matrices, numpy.copy() will give you a deep copy.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.ndarray.copy.html
numpy.ndarray.copy โ€” NumPy v2.1 Manual
>>> import copy >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) >>> c = copy.deepcopy(a) >>> c[2][0] = 10 >>> c array([1, 'm', list([10, 3, 4])], dtype=object) >>> a array([1, 'm', list([2, 3, 4])], dtype=object)
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ third party โ€บ numpy โ€บ copy()
Python Numpy copy() - Create Array Copy
November 7, 2024 - Use the copy() function when you need to preserve the original data without any unintentional modifications due to variable referencing in Python. When splitting datasets or performing transformations during preprocessing, making a copy of your ...
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.0 โ€บ user โ€บ basics.copies.html
Copies and views โ€” NumPy v2.0 Manual
When a new array is created by duplicating the data buffer as well as the metadata, it is called a copy. Changes made to the copy do not reflect on the original array. Making a copy is slower and memory-consuming but sometimes necessary. A copy can be forced by using ndarray.copy.
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ numpy โ€บ python numpy deep copy
NumPy Deep Copy | Delft Stack
March 11, 2025 - In this article, we will explore two main methods for achieving deep copies of NumPy arrays in Python: using the built-in copy.deepcopy() function and a user-defined approach.