[SciPy-User] 2D slice of transformed data
Thu Mar 24 10:09:24 CDT 2011
That works fine for the XY view with no Z translate, but breaks down
completely as soon as you want to look at other views or introduce a Z
It is possible to read pixel data back after OpenGL has applied transforms,
e.g. by using a framebuffer object (FBO) to render to a texture and then
using glGetTexImage to read the texture's pixels. Even ignoring the issue of
nonapplicability for non-XY views, I suspect scipy's interpolation would be
more accurate than OpenGL's.
On Thu, Mar 24, 2011 at 5:16 AM, Sebastian Haase <email@example.com>wrote:
> Hi Chris,
> if I understood correctly, you are foremost interested in visualizing
> the data after applying the respective pixel transforms. Could you
> not simply use the OpenGL rotate, translate and scale operations ? --
> then it could be done literally instantaneously.
> There is already code for this in the viewer modules in my Priithon
> For such large data it would be good to have a video card with 1GB (if
> not 2GB) memory, which is now rather cheap (one to a few 100 $) to
> buy these days.
> I'm not sure but it might even be feasible, once the user has
> confirmed that a given transform parameter set is optimal, to read the
> transformed pixel values back from the graphics card -- if you really
> want that; but I would probably suggest to just store the parameters
> to the image data header, and take those into account for all further
> visualizations and other image processing you might be doing.
> On Thu, Mar 24, 2011 at 2:22 AM, Isaiah Norton <firstname.lastname@example.org>
> > Hi Chris,
> > It's not strictly Python, but VTK and ITK are the heavy-iron for this
> > of thing (py wrappings available). There are several tools built on these
> > libraries to provide user-friendly 3D/4D registration, visualization,
> > GoFigure2: http://gofigure2.sourceforge.net/
> > - very microscopy oriented. 4D support. linux/mac/win
> > V3D: http://penglab.janelia.org/proj/v3d/V3D/About_V3D.html
> > - also 4D and triplatform.
> > BioImageXD
> > - mostly written in Python glue for vtk/itk.
> > If you want to build something custom in Python, check out MayaVi - it
> > VTK under the hood so the transforms will be handled fast in C++, but has
> > nice pythonic tvtk syntax and native numpy support.
> > -Isaiah
> > On Wed, Mar 23, 2011 at 6:00 PM, Chris Weisiger <email@example.com>
> > wrote:
> >> In preface, I'm not remotely an expert at array manipulation here. I'm
> >> experienced programmer, but not an experienced *scientific* programmer.
> >> sure what I want to do is possible, and I'm pretty certain it's even
> >> possible to do efficiently, but figuring out the actual implementation
> >> giving me fits.
> >> I have two four-dimensional arrays of data: time, Z, Y, X. These
> >> microscopy data taken of the same sample with two different cameras.
> >> views don't quite match up if you overlay them, so we have a
> >> three-dimensional transform to align one array with the other. That
> >> transformation consists of X, Y, and Z translations (shifts), rotation
> >> the Z axis, and equal scaling in X and Y -- thus, the transformation has
> >> parameters. I can perform the transformation on the data without
> >> with ndimage.affine_transform, but because we typically have hundreds of
> >> millions of pixels in one array, it takes a moderately long time. A
> >> representative array would be 30x50x512x512 or thereabouts.
> >> I'm writing a program to allow users to adjust the transformation and
> >> how well-aligned the data looks from several perspectives. In addition
> >> the traditional XY view, we also want to show XZ and YZ views, as well
> >> kymographs (e.g. TX, TY, TZ views). Thus, I need to be able to show 2D
> >> slices of the transformed data in a timely fashion. These slices are
> >> perpendicular to two axes (e.g. an XY slice passing through T = 0, Z =
> >> or a TZ slice passing through X = 256, Y = 256), never diagonal. It
> >> like the fast way to do this would be to take each pixel in the desired
> >> slice, apply the reverse transform, and figure out where in the original
> >> data it came from. But I'm having trouble figuring out how to
> efficiently do
> >> this.
> >> I could construct a 3D array with shape (length of axis 1), (length of
> >> axis 2), (4), such that each position in the array is a 4-tuple of the
> >> coordinates of the pixel in the desired slice. For example, if doing a
> >> slice at T = 10, Z = 20, the array would look like [[[10, 20, 0, 0],
> >> 20, 1, 0], [10, 20, 2, 0], ...], [[10, 20, 0, 1], 10, 20, 1, 1], ...]].
> >> perhaps there'd be some way to efficiently apply the inverse transform
> >> each coordinate tuple, then using ndimage.map_coordinates to turn those
> >> pixel data. But I haven't managed to figure that out yet.
> >> By any chance is this already solved? If not, any suggestions /
> >> would be wonderful.
> >> -Chris
> >> _______________________________________________
> >> SciPy-User mailing list
> >> SciPy-User@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/scipy-user
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User