Ciao,
Sto analizzando 6 immagini utilizzando JMP con script convertendo le immagini in una tabella di dati.
Ho concatenato tutti i valori delle immagini in 1 tabella di dati.
Il problema è che posso chiudere la precedente tabella dei dati dell'immagine con Close( Data Table( Tables[i] ), No Save );
Ma non riesco a chiudere le 6 immagini.
Ho provato qualcosa come Close(img) o Close("image") ma non si chiude.
Qualche idea su come chiudere le immagini nello script?

NamesDefaultToHere(1);
// Read the image1:RED into JMP
img = NewImage("$Capillary Photo 2\RED.jpg");
w = newWindow("image", img);
// Get the pixel values as 3 distinct matrices (red, green and blue)
// RGB colors are in normalized color space (0.0-1.0)
{r, g, b} = img << getPixels("rgb");
// Convert rgb to gray-scale (intensity) matrix
i = 0.3*r + 0.59*g + 0.11*b;
// Get the pixel values as JSL colors then convert to hue, lightness and saturation
// HLS colors are in normalized color space (0.0-1.0)
jslColors = img << getPixels();
{h, l, s} = ColorToHLS(jslColors);
// Get the dimensions of the image/matrices
numRows = nrow(r);
numCols = ncol(r);
// Create a data table
dt1 = New Table("Image Data Red",
newColumn("X", set values(repeat(1::numCols, numRows))),
newColumn("Y", set values(shape(repeat(1::numRows,numCols)`,numCols,numRows))),
newColumn("r", set values(r)),
newColumn("g", set values(g)),
newColumn("b", set values(b)),
newColumn("i", set values(i)),
newColumn("h", set values(h)),
newColumn("l", set values(l)),
newColumn("s", set values(s)),
newColumn("CapillaryType", character, set each value("RED"))
);
img2 = NewImage("$\Capillary Photo 2\BLUE.jpg");
w2 = newWindow("image", img2);
//Some of other parts of script omitted (repetitive)
//Concatenation All Tables into 1
// Create your Tables list
Tables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( Tables, Data Table( i ) << get name );
);
new Table("Image Data AllColour");
// Run the concatinations table
For( i = 1, i <= N Items( Tables ), i++,
Data Table( "Image Data AllColour" ) << Concatenate(
Data Table( Tables[i] ),
append to first table(1)
);
Close( Data Table( Tables[i] ), No Save );
);
Wait(0);
//the image objects still exist
//show(img);
//show(img2,3,4,5,6);
img = empty();
img2 = empty();
img3 = empty();
img4 = empty();
img5 = empty();
img6 = empty();
show(img, img2, img3, img4, img5, img6); //see LOG: img = Empty(); img2 = Empty();
delete symbols({img, img2, img3, img4, img5, img6});
show symbols();
Close(img);
Qualcosa del genere dovrebbe darti quello che vuoi, chiudere le finestre dell'immagine.
i = 1;
While( Window( i ) << get window title != "",
If( Left( Window( 1 ) << get window title, 5 ) == image,
Window( i ) << close window
);
i++;
);
In espansione @txnelson la soluzione:
Il messaggio che stai cercando è << Chiudi finestra puntato al riferimento della tua finestra. Nel tuo codice assegni questi riferimenti a w e w2, quindi invierai << Close Window a quegli oggetti.
Names Default To Here( 1 );
// Read the image1:RED into JMP
img = New Image( "$Capillary Photo 2\RED.jpg" );
w = New Window( "image", img );
Wait( 5 );
w << close window;
Inoltre, vale la pena notare che non è necessario visualizzare le immagini in una finestra per ottenere i pixel.
Names Default To Here( 1 );
image = New Image( "$SAMPLE_IMAGES/windmap.png" );
{r, g, b} = image << getPixels("rgb");
show(r);
Allo stesso modo, potresti evitare di visualizzare le tabelle di dati intermedi creandole Privato :
dt1 = New Table("Image Data Red",
newColumn("X", set values(repeat(1::numCols, numRows))),
newColumn("Y", set values(shape(repeat(1::numRows,numCols)`,numCols,numRows))),
newColumn("r", set values(r)),
newColumn("g", set values(g)),
newColumn("b", set values(b)),
newColumn("i", set values(i)),
newColumn("h", set values(h)),
newColumn("l", set values(l)),
newColumn("s", set values(s)),
newColumn("CapillaryType", character, set each value("RED")),
Private // no display window is created; when dt1 is assigned something else the data table will be destroyed
);