Build a picture from a data table the apply filters on itHi,
I work a lot with X/Y/metric data tables which are similar to images and on which I would like to apply JMP filters ("despeckle", "reduce noise",... I was very interested in this presentation by Julia Gong: "Using JMP® Image Analysis Capabilities to Extract Skin Lesion Characteristics") then transform back to data table. It seems easier to use that kind of filter after transforming my data to picture than perform some tricky matrix calculations.
Like:

to get for example just the bottom right cluster with noise reduction

But I don't understand how to create JMP image matrix from my data.
For example if I start from a table with X, Y and a metric below and as an attachment

Then:
dt =current data table();
// the X,Y, metric matrix
mat = (:X << getvalues) || (:Y << getvalues) || (:metric << getvalues);
Neither this command:
img = New Image( "r",{mat});nor this one:
img << Set pixels ("r",{mat});...seems to works.
How can I transform this table into an image matrix and apply JMP filters to it?
Thanks!
Franck
GraphicsScriptingRe: Build a picture from a data table then apply jsl filters on itYou will need to do something like this:
NamesDefaultToHere(1);
dt = Data table("data_table.jmp");
// The values of the metric need to be rescaled to [0, 1]
metric = Column(dt, 3) << getValues;
maxMetric = Max(metric);
minMetric = Min(metric);
metric = (metric - minMetric) :\</img> (maxMetric - minMetric);
// Column vector to hold the pixel values for the image
pixVals = J(NRow(metric), 1, .);
for (p=1, p<=NRow(pixVals), p++,
pixVals[p] = RGB Color(metric[p], metric[p], metric[p]);
);
// Reshape 'pixVals' to be a rectangular matrix (assumes 'X' and 'Y' both start at 1)
xMax = Max(Column(dt, "X") << getValues);
yMax = Max(Column(dt, "Y") << getValues);
pixVals = Shape(pixVals, xMax, yMax);
// Make an image, make it a bit bigger, and put it in a window
im = New Image();
im << setPixels( pixVals );
im << setSize({10*xMax, 8*yMax});
NewWindow("My Image", im);
Use 'Help > Scripting Index' to clarify how the code works.

Re: Build a picture from a data table then apply jsl filters on itGreat! Thanks for your help!