The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Memory leak processing multiple images
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

LW-HH

Germany
4 Posts

Posted - 06/13/2013 :  08:08:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Edited by - LW-HH on 06/13/2013 08:27:49 AM

LW-HH

Germany
4 Posts

Posted - 06/18/2013 :  06:40:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear all,

in the meantime our IT department set up a virtual machine with Origin 9 on it. With the newer version the script is doing what it should. The memory usage is constant at 150 Mb and there is no error message.

Seems to be a Origin 8.5.1 related bug.

Regards

LW

Windows 7 32bit
Origin Pro 8.5.1
Go to Top of Page

easwar

USA
1964 Posts

Posted - 06/20/2013 :  12:38:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear LW,

Thank you for the information, and glad to hear the problem is solved in the latest version!

Easwar
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000