Hola,
Estoy analizando 6 imágenes usando JMP con script al convertir las imágenes en una tabla de datos.
He concatenado todos los valores de las imágenes en 1 tabla de datos.
El problema es que puedo cerrar la tabla de datos de imagen anterior con Cerrar (Tabla de datos (Tablas [i]), No Guardar);
Pero no puedo cerrar las 6 imágenes.
Intenté algo como Cerrar (img) o Cerrar ("imagen") pero no se cierra.
¿Alguna idea de cómo cerrar las imágenes en el 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);
Algo como esto debería darte lo que quieres, cerrar las ventanas de imagen.
i = 1;
While( Window( i ) << get window title != "",
If( Left( Window( 1 ) << get window title, 5 ) == image,
Window( i ) << close window
);
i++;
);
Ampliando @txnelson la solución:
El mensaje que está buscando es << Cerrar ventana apuntando a su referencia de ventana. En su código, asigna estas referencias a w y w2, por lo que enviaría << Cerrar ventana a esos objetos.
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;
Además, vale la pena señalar que no necesita mostrar las imágenes en una ventana para obtener los píxeles.
Names Default To Here( 1 );
image = New Image( "$SAMPLE_IMAGES/windmap.png" );
{r, g, b} = image << getPixels("rgb");
show(r);
De manera similar, podría evitar mostrar las tablas de datos intermedios haciéndolas Privado :
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
);