Hi all,
I am a software developer (but mainly on databases and other languages).
Nevertheless I like to experiment with PI in order to develop a script, which will give me in future a greater
variety of well-known convolution matrices, that I want to select from a list.
But first - I tried to write this small script (from reading and learning from the examples round here).
It's very basic and it executes without error.
But I cannot do "undo" function in order to restore the image before execution, so I think I made something wrong.
Unfortunately there is not enough documentation so that I can try to find the error myself.
Thanks in advance for any help ....
Christoph
----------------------------------
#include <pjsr/UndoFlag.jsh>
function main()
{
var window = ImageWindow.activeWindow;
if ( window.isNull )
throw new Error( "No active image" );
var vw = ImageWindow.activeWindow.mainView;
var img = vw.image;
console.show();
console.writeln( "<end><cbr><br><b>" + window.currentView.fullId + "</b>" );
console.writeln( "Running FreeConvolve code." );
console.flush();
console.abortEnabled = false;
vw.beginProcess( UndoFlag_NoSwapFile );
console.writeln( "Executing FreeConvolve code." );
console.flush();
img.convolve([ 0,0,1,0,0,
0,0,0,0,0,
0,0,2,0,0,
0,0,0,2,0,
1,0,1,0,0 ]);
vw.endProcess();
}
main();