I am looking for real-world examples of usage of imglib2-roi. In particular, I have the following image processing task: a set of 3D
RealPoint with a radius (same radius for all), and a 4D data set.
What I envision is the following:
img4D = ... # a 4-dimensional RandomAccessibleInterval points = ... # list of 3-dimensional RealPoint table = [ for p in points] # list of lists: one list per point, each list as long as the time axis for t in xrange(img4D.dimension(3)): img3D = Views.hyperSlice(img4D, 3, t) for i, point in enumerate(points): # TODO: measure average pixel value at point + radius average = ... table[i].append(average)
How would one accomplish this with imglib2-roi?
The trivial way would be using the reverse: build a KDTree with the points, and iterate over all pixels in
img3D asking, with a radius neighbor search, for the nearest point, and summing pixel readings at each point and then dividing by the total to get the average. The disadvantage is that all pixels need to be iterated. I’d rather only iterate the pixels within radius distance of each
RealPoint of interest.
Thanks for any suggestions.