| Author |
Topic  |
|
|
ohm
Czech Republic
Posts |
Posted - 04/26/2006 : 10:44:22 PM
|
Origin Version (7.0): Operating System:xp I want to ask, if it is possible to make script in Labtalk which open new matrix, import picture in that, make a countour plot - countour color fill, use the smooth function and export picture... is it even possible to make script like this and if it is possible is it better to make it in labtalk or in originC?
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 04/27/2006 : 5:35:21 PM
|
This is possible in LabTalk and also in OriginC via LT_execute. Which is better depends on what you're more comfortable with. Here's a simple LabTalk script. Image format is not restricted to bmp (check out the image LabTalk object in the Programming Guide for details).
image.filename$=C:\Images\image1.bmp; // file path\name win -t M; // open a new matrix window image.import.matrix(%H); // import image mat.matname$ = %H; matrix -id; // convert to data mode matrix -pg DIM nc nr; // get dimensions // smooth if(nc < 32 || nr < 32) { mat.expand(2,2); mat.shrink(2,2); } else { mat.shrink(2,2); mat.expand(2,2); }; worksheet -p 226 contour; // create contour plot image.filename$=C:\Images\image2.bmp; // file path\name Image.Export.PageDPI( BMP, 96, 24, 0 ); // export image
Mike Buess Origin WebRing Member |
 |
|
|
greg
USA
1380 Posts |
Posted - 04/27/2006 : 6:05:48 PM
|
Instead of directly answering this post, I will take this opportunity to illustrate a nice feature in Origin:
- Open your Script Window. (Window : Script Window menu)
- Hold down a Shift and a Ctrl key while clicking the New Matrix tool.
That types the following to your Script Window: Menu id=34008 run.section(Standard,NewMatrix)
- Delete the line with the Menu id, position your cusrsor at the end of the run.section line and press Enter.
- Hold down a Shift and a Ctrl key while clicking the FIle : Import : Image menu option.
That types the following to your Script Window: Menu id=34040 run.section(imgfile,ImportImage)
- Delete the line with the Menu id, position your cusrsor at the end of the run.section line and press Enter. Browse to your image file.
- Hold down a Shift and a Ctrl key while clicking the Matrix : Smooth menu option.
That types the following to your Script Window: Menu id=36056 run.section(MATRIX,Smooth)
- Delete the line with the Menu id, position your cusrsor at the end of the run.section line and press Enter.
- Hold down a Shift and a Ctrl key while clicking the Plot : Contour Plot : Contour Color Fill menu option.
That types the following to your Script Window: Menu id=35581 run.section(Plot3D,ContourColor);
- Delete the line with the Menu id, position your cusrsor at the end of the run.section line and press Enter.
- Hold down a Shift and a Ctrl key while clicking the File : Export Page menu option.
That types the following to your Script Window: Menu id=34018 run.section(GraphExp,ExportPage);
- Delete the line with the Menu id, position your cusrsor at the end of the run.section line and press Enter.
What you are left with is a basic script that does what you suggested : run.section(Standard,NewMatrix); run.section(imgfile,ImportImage); run.section(MATRIX,Smooth); run.section(Plot3D,ContourColor); run.section(GraphExp,ExportPage);
You can examine the code for ideas an how you might edit it for further automation. For example, look at GraphExp.OGS and examine the code in the [ ExportPage ] section to discover how to bypass the dialog.
Not all menu options run LabTalk code, but in this case every step could be captured by this simple method.
|
 |
|
|
ohm
Czech Republic
Posts |
Posted - 04/28/2006 : 2:21:50 PM
|
Hello,
i want to thank you so much for you help, this program is part of my BC. project it has to be done in Origin Proffesional but iam totaly new with this program so again thank you very much for your help.
|
 |
|
| |
Topic  |
|
|
|