Author Topic: A few ProcessContainer and Scripting questions  (Read 679 times)

Offline macnmotion

  • Member
  • *
  • Posts: 61
A few ProcessContainer and Scripting questions
« on: 2019 January 17 20:37:58 »
Hi. I'm trying to automate/simplify the following process.

1) I have an initial image open in PI workspace
2) Apply pixelmath to the original image - create result in new image
3) Change imageIdentifier of this new image
4) Save this new image to disk (ideally with the imageIdentifier name)
5) Close this new image

So far I have done this:

1) Process icon with PixelMath settings
2) Process icon with imageIdentifier settings

When I run the first process on the original file, it creates the new image and the new image is now the image window in focus. I can then run the second process on the new image. So far so good.

3) ProcessContainer containing the Pixelmath process and the imageIdentifier process

When I run the ProcessContainer on the original image, it creates a new image (PixelMath), but it doesn't switch focus to that new image. The imageIdentifier process is applied to the original image, not the new image.

4) I can not find any way to save a file automatically using the current imageIdentifier name.

Questions:

1) In the ProcessContainer, how can I switch focus to the new image before running the imageIdentifier process?
2) How can I save the new image as part of this automated process (using the imageIdentifier as the file name; saving in the same directory as the original image is fine)?
3) How can I close this image as part of this automated process?

Ultimately, I would daisy chain within the ProcessContainer so that I am running a series of incremental PixelMath instances on the original image, and saving each one so I can blink through the results later.

Any input would be appreciated. Thanks. Andy

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: A few ProcessContainer and Scripting questions
« Reply #1 on: 2019 January 18 06:46:30 »
Andy,
Have you tried the Script:
VaryParams
?
It can vary the parameters for PixelMath and write the result to disk. (and adds a suffix tothe file name)

Gerald
P.S.: if you dont need writing the files to disk you can achieve the calculation to the last active image
simply by exchanging the view name in the PixelMath expression by  "$T"  and checking "Create new image"
This creates a new image and does the next PixelMath to this one.

Gerald
« Last Edit: 2019 January 18 08:08:56 by oldwexi »

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: A few ProcessContainer and Scripting questions
« Reply #2 on: 2019 January 18 06:53:53 »
This is how the input looks like if you have a PixelMath Process on the workspace


Gerald

Offline macnmotion

  • Member
  • *
  • Posts: 61
Re: A few ProcessContainer and Scripting questions
« Reply #3 on: 2019 January 19 02:19:54 »
Thank you Gerald. I was unfamiliar with that script. It is great, does much of what I want. Unfortunately it doesn't allow me to select how it names the output files, I was hoping I could use the file name as an indicator of the incremental value in the formula for that image.