Documentation for PJSR specific objects

crackout

Well-known member
Hi,

I'm currently digging into JS to write a script that performs some image operations. I had some programming courses at university, but my endeavours never took off because I was lacking real project to realize. This changed recently as I thought of making a script to automate some actions of my PI workflows.

Roberto's introduction video really helps a lot, however I'm stuck when leaving the scope of his video.

For example, I want the script to make use of masks. Looking at the source of other scripts that do so it seems a mask is not applied to a view object but a window (which makes sense, since the window incorporates previews as well, that are also masked then). My problem is, that the short info box of PJSR objects in the object viewer is not enough for me to really grasp how to manipulate such objects.

The documentation site only announces a future documentation sadly.

Any tips for references I could use?

Thanks!
 
I'm sorry to say that there is really no useful single reference source for PJSR objects - at least so far as I am aware. In the main much can be deduced by examining the object properties/methods/constructors in the Object Explorer. Where this is not sufficient, there is a host of great scripts available and examining these can often help shed light. If both these avenues fail then ask here (as you have) there is a great community of script writers who are more than happy to lend a hand where possible.

As to your specific question;

You are absolutely right that masks are ImageWindows applied to ImageWindows.
.hasMaskReferences tells you whether the ImageWIndow is being used as a mask by another ImageWindow
.mask records an ImageWindow that is being used as a mask by the current ImageWIndow (note this may not actually be enabled - see below)
.maskEnabled records whether any ImageWindow referenced by .mask as actually enabled - note that .maskEnabled can be true but .mask be a null reference, so to see if an ImageWindow is masked you need to check both.
.maskInverted true/false, obvious meaning
.maskVisible: true/false, defines if the mask is visible on the image - if it is then ...
.maskMode: defines how a mask is shown on the image - the default value corresponds to the familiar red visualisation, other values can be seen in the ImageWindow, Constants in the Object Explorer.

Also some handy methods of ImageWindow are available:
.isMaskCompatible(ImageWIndow mask) - useful to check whether the ImageWindow "mask" can be used as a mask for the current ImageWindow
.isMaskOf(ImageWindow window) - obvious meaning
.removeMask: will remove a mask from the current image
.removeMaskReferences: will stop the current ImageWindow being used as a mask by any other ImageWindows.

Hope this helps
CS, Mike
.
 
Last edited:
Back
Top