Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1 SR2
Operating System: Win7 32-bit
Dear all,
after solving my problem with the "copy -a" command my Labtalk script is working perfectly.
What I am currently doing is to
- open a list of images one-by-one
- extract the edge data from the image (with binary, median and edge function)
- convert the matrix in a XYZ workbook and delete all rows with empty values
- delete the image matrix
- merge and append the data in one worksheet
- and delete the workbook containing the image edge data.
To delete the workbooks and matrix windows I use the "win -cd Name" command.
I have a total number of 1000 grayscale images to analyze, which have a size of 1000x1000 pixel. The resulting edge pixel count is about 10.000 rows of XYZ data.
When I start my script there seems to be a magic barrier around 200 images, at which Origin cannot allocate more memory. I checked in Task Manager and the max RAM consumption at that point is around 600 MB. Thus I am not limited by my 32bit operating system.
Additionally, I can save the data of the 200 analyzed images and close Origin. When I open the OPJ file again, which has got 40mb on my disk, Origin does consume only 160 Mb in total.
I guess there is some kind of memory leak, but I don't know where to look at.
Does anybody have a clue what to test/debug?
Here is the code:
int j;
j=0;
getn ("Image index to start from: ") j;
//Worksheet for graph
if (exist("A3Ddata"))
{
win -a "A3Ddata";
}
else
{
win -t d data 3Ddata;
wks.addCol();
wks.col1.format=1;
wks.col2.format=1;
wks.col3.format=1;
wks.col1.numerictype=9;
wks.col2.numerictype=9;
wks.col3.numerictype=9;
wks.col3.type=6;
}
wname2$=page.name$;
range A1=[%(wname2$)]Sheet1!Col(A);
range B1=[%(wname2$)]Sheet1!Col(B);
range C1=[%(wname2$)]Sheet1!Col(C);
//String Array of Filenames
getfile -m *.bmp;
for (ii = 1; ii <= count ; ii++)
{
//Get name of ii-th file
getfile -g ii;
fname$=%A;
type -a fname$;
win -t m;
//Import all selected BMP images into new matrix workbook
impImage;
wname$=page.name$;
//cell$ = %h;
//specify the lowest and highest intensity to be convert to binary 0 or 1.
imgBinary t1:=70 t2:=255;
// the dimensions of median filter is 18
imgMedian d:=18;
//Edge detection
// the threshold value 8 used to determine edge pixels,
// and shv(Sobel horizontal & vertical) Edge detection filter is applied.
imgEdge t:=8 f:=shv;
imgMedian d:=5;
//Second edge detection to reduce number of datapoint but do not open fine structures
imgEdge t:=70 f:=shv;
//Convert to XYZ Workbook
m2w method:=xyz;
//Replace zeros with empty
wreplace rng:=col(3) find_value:=255 replace_value:=j set_missing:=1;
//Delte rows with empty values
wdelrows m:=1 r:=col(1:3);
copy -a Col(A) A1;
copy -a Col(B) B1;
copy -a Col(C) C1;
win -cd %(page.name$);
j=j+1;
win -cd %(wname$);
}
Kind regards
Windows 7 32bit
Origin Pro 8.5.1