# Looking for a package for data on (sparse) uniform grids

I have large amounts of sparse 2d and 3d "volumetric" data, i.e. fixed data associated with positions in a uniform (integer coordinate) grid. I think of it as partial function

$$f: \mathbb Z^n \to D.$$

The data defined for each point has always the same structure - it's usually a list of numbers, or a matrix or another (nested) 3d grid of data. Ideally, I could store an arbitrary but fixed-format expression on each point.

I need operations such as the following:

• Accessing individual elements efficiently
• Accessing all elements in a neighborhood
• Applying operations to individual elements and neighborhoods, including convolutions and more general filters
• Constructing a grid with only a rearranged sublist of the current data on each point (e.g. for rearranging and pre-alpha-multiplying the color channels in an image, I would map the data {r,g,b,a} on each point to say a*{b,g,r})
• Dropping points which match certain criteria.
• Listing all indices for which data is defined.
• Converting this data structure to other representations for interoperability and visualization

I would like to abstract-away the different ways of representing such data (I could think of using Image, Image3D, an array/tensor (an expression), a SparseArray, an Association, other ways to represent finite mappings, etc) and focus on the operations.

Has somebody already done this or seen a project that uses something like that?