S
orry for bothering you again... The solution is in the User reference
page 87 (Compute). For those interested:
Create mask array of unsigned byte using Compute
mask = Compute("$0 > $1 ? byte (00) : byte (01)",data_in, threshold);
Then add the mask array as "invalid positions" to data fields that have to be
masked using 'Replace':
new_field = Replace(mask,old_field,"data","invalid_positions");
That's it. All next modules will disregard the invalid positions that are
masked.
Thanks anyway
Regards,
Eelco van Vliet
On Mon, 21 Jan 2002, Eelco Van Vliet wrote:
>
> I have the following problem:
>
> I have a 3D regular scalar data field, of which I calculate the gradient
> vector field. I convert the gradient field to polar coordinates. I
> want the calculate the probability density function (pdf) of the radius,
> and both spherical angles 'theta' and 'phi' using the module 'Histogram.'
> However, I only want to take into account those gradient vectors with a
> modulus larger then a certain threshold 'r_thres'. For this, I create a
> mask array which has a value 1 for valid points (r>r_thres) and and 0 for
> invalid points (r<=_r_thresh). I want to use this array to mask the arrays
> 'radius', 'theta' and' 'phi' so that 'Histogram' only takes into account
> the proper points.
>
> Is there a module for this mask operation similar to the module 'Include',
> i.e. instead of invalidating the points outside a range min-max,
> invalidating the points corresponding to the zeros in the mask array.
> Note that I can not use the 'Include' module since for the eg. calculating
> the pdf of the angle 'theta' I must threshold with the data of 'radius'
>
> If this procedure is not possible with the existing modules, I want to
> write it myself.Should I follow
> the example Add2Invalid of the 'programmers guide'. I don't like the fact
> that then I have the assume that the field is of a certain type, e.g.
> float. I want this routine type independent, just as the module Include.
> What is the best way to approach this. Does anybody has a example routine
> to create type independ modules for setting invalid points according to a
> certain mask array?
>
> A lot of questions and a long story. Hopefully anybody can help me...
>
> Kind regards,
>
> Eelco van Vliet
>
>