[ImageJ-devel] proposed changes in the ImgLib2 abstract class hierarchy

Lee Kamentsky leek at broadinstitute.org
Fri Mar 16 08:15:47 CDT 2012


On 3/15/2012 5:34 PM, Albert Cardona wrote:
> El 15 de març de 2012 16:57, Tobias Pietzsch<pietzsch at mpi-cbg.de>  ha escrit:
> Now that is a very cool example! It is surprising how short the code 
> is. A perhaps more relevant example for bioimage informatics is the 
> extraction of an interpolated pixel at a specific floating-point 
> coordinate, which could be used to infinitely zoom in/out onto an 
> image. (Not that different from what you do in the Mandelbrot 
> example). If you want to make it even more relevant, use it to 
> generate the tiles necessary for a single CATMAID section, in 
> combination with the XYProjector and the flashy new ImgSaver :) Albert 
The Mandelbrot is insanely cool and shows how powerful the real space 
technique might be. It's short, even if it is in Java ;-) (python for 
Mandelbrot below and it doesn't zoom). I would love to see Albert's 
suggestion as a bicubic spline representation of an image using this 
technique - you could extract gradient information and operate on the 
Euclidean space directly which I'm guessing would be useful for 
techniques like active contours and SIFT.

import numpy as np
import pylab

re, im = np.mgrid[-1000:500, -640:641].astype(np.float64) / 640
i, j = np.mgrid[0:re.shape[0], 0:re.shape[1]]
re0, im0 = re.copy(), im.copy()
mandelbrot = np.zeros(re.shape, int)
mask = np.ones(re.shape, bool)
for _ in range(256):
     squre, squim = re ** 2, im ** 2
     mask = squre + squim <= 4
     mandelbrot[i, j] += 1
     im = 2 * re[mask] * im[mask] + im0[mask]
     re = squre[mask] - squim[mask] + re0[mask]
     i, j, re0, im0 = i[mask], j[mask], re0[mask], im0[mask]
pylab.imshow(mandelbrot)
pylab.show()



More information about the ImageJ-devel mailing list