Accessing 3D Textures in Script TOP via numpyArray()

Hello TouchDesigner Community,

I am working with the Script TOP and am trying to access a 3D texture created by stacking multiple images. Specifically, I would like to retrieve a numpy array with the shape (N, res_x, res_y, 3), where N represents the number of images, and res_x and res_y are the dimensions of each image with 3 RGB channels.

Currently, I am using an OP Viewer to flatten the images and then extracting the data in Python inside the Script TOP. However, this method is quite inefficient in terms of performance.

Is it possible to use the numpyArray() method to directly access such a 3D texture from the Script TOP? If so, I would appreciate any guidance or examples on how to achieve this.

Thank you for your help or suggestions

Hi @LivingSparks,

I don’t think that is currently possible. Added it as an RFE.

Best
Markus

Thanks @snaut !

For now I can share my implementation inside the Script TOP

def extract_patches(image, patch_size=224, rows=4, cols=4):
    height, width, channels = image.shape
    patches = []
    for row in range(rows-1, -1, -1):  # Start from bottom row
        for col in range(cols):
            y_start = row * patch_size
            x_start = col * patch_size
            patch = image[y_start:y_start+patch_size, x_start:x_start+patch_size, :]
            patches.append(patch)
    return np.array(patches)