-
Notifications
You must be signed in to change notification settings - Fork 49
Description
It would be nice to expose data via array slice notation.
That is, source[y1:y2,x1:x2,:] would be the same as source.getRegion(format=TILE_FORMAT_NUMPY, region=dict(left=x1, right=x2, top=y1, bottom=y2)). And, source.shape would return (sizeY, sizeX, bandCount).
Further, using a value like source[y1:y2:2, x1:x2:2. :] or source[y1:y2:3, x1:x2:3. :] would automatically use the nearest neighbor at the smallest resolution that is sufficient for distinct pixels (resample would always be false).
For explicit magnifications and resolutions, there should be a pair of convenience functions: source.atMagnification(10)[...] and sourceAtScale(scale, units)[...]. For scale, specifying units via a string of m, mm, or um (or one of the projection values for geospatial) would be handy. The shape property would work on these arrays, too.
For array responses over a certain size, maybe we should consider returning a dask array rather than a numpy array so that it does kill memory (e.g., asking for source[:, :, :] would be bad.
To handle multi-axis data, we could accept slices like source[frame,y1:y2,x1:y2,:]. I don't know if we could also slice via named tuples (e.g., source[c=4,t=slice(0, 5),y1:y2,x1:x2,:]).
We do want to support rolling axes (e.g., if we are natively Z, T, C, Y, X, S, we should be able to use numpy or some other syntax to conceptually make the axes in another order).