[Numpy-discussion] masked arrays and nd_image
Peter Verveer
verveer at embl-heidelberg.de
Wed Aug 11 06:27:05 CDT 2004
> > I did not write nd_image with masked arrays in mind, I imagine it
> won't
> > work for most functions. I am not planning to support masked arrays
>
> Yes, I expected this. I knew I was pretending too much ;o)
One can always try :-)
> > . If you just want to mask out some of the results, apply the mask
> > afterwards. If you actually want to deal with masked values in the
> > convolution itself, you are out of luck with the convolve1d
> function,
> > it does not support that. In that case you could try to write your
> own,
> > using the generic filter functions (see the manual).
>
> Ok, this would imply writing a function with prototype
> FilterFunction1D, right? And the mask argument should be packed with
> the data or is there a way (which I don't see) to pass arguments to
> the filter other than the input image. Sorry if I'm annoying ;o)
If you do it in python, you feed generic_filter1d a function, if you
make that a method of an object, your mask can be accessed as a
attribute of your object.
If you want to do it in C, you can pass a CObject that holds the
function pointer to a callback function with prototype
FilterFunction1D. Additionally you can set the description pointer of
the same CObject to an arbitrary pointer, which is passed at every call
to the callback function. You can use that to store additional
information for you filter, such as the mask. See the example in the
manual which is written for the shift function, but the principle is
the same.
Cheers, Peter
More information about the Numpy-discussion
mailing list