Author Topic: PJSR StarMask Scale Parameter  (Read 4260 times)

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
PJSR StarMask Scale Parameter
« on: 2014 November 30 01:52:31 »
I am writing a script, my first one, and it creates a StarMask as part of its process, a snippet of which is shown below. The problem I am having is that there doesn't seem to be any way to set the Scale parameter as it doesn't appear in the object property list in Object Explorer.

Does anybody know how to set the Scale parameter, or can I be pointed in the right direction.

Thanks in anticipation.......

Regards,
    Dave

   // *****************************************
   // Generate Star Mask
   // *****************************************
   // *** Create Star Mask
   var starmask = new StarMask;
   with ( starmask ) {
      aggregateStructures = false;
      binarizeStructures = true;
      growthCompensation = 2;
      highlightsClipping = 1;
      invert = false;
      largeScaleGrowth = 2;
      limit = 1;
      midtonesBalance = 0.9;
      mode = StarMask;
      noiseThreshold = data.SMThreshold;
      shadowsClipping = 0.9;
      smallScaleGrowth = 0;
      smoothness = data.SMSmoothness;
      structureContours = false;
      truncation = 1;
    }
    SSView.mainView.beginProcess(UndoFlag_NoSwapFile);
    starmask.executeOn(SSView.mainView);
    SSView.mainView.endProcess();

Dave

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR StarMask Scale Parameter
« Reply #1 on: 2014 November 30 12:22:29 »
Hi Dave,

The parameter you are looking for is:

   int StarMask.waveletLayers

which is the number of wavelet layers used for structure detection.

You don't have to call (shouldn't call, actually) View.beginProcess() and View.endProcess() to execute a process instance. These methods are only required to modify image data by calling pure JavaScript objects, properties and methods. For instance execution, just call executeOn(), which takes care of all the necessary history management.

If you want to execute an instance without generating swap files, use the second parameter of executeOn:

   Boolean ProcessInstance.executeOn( View view[, Boolean swapFile=true] )

For example:

    starmask.executeOn( SSView.mainView, false/*swapFile*/ );

Let me know if this helps.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
Re: PJSR StarMask Scale Parameter
« Reply #2 on: 2014 November 30 13:42:47 »
Thanks Juan, that solves the problem perfectly.

Best Regards,
Dave

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
Re: PJSR StarMask Scale Parameter
« Reply #3 on: 2014 November 30 13:45:57 »
Sorry Juan, I sent the reply before I have finished typing LOL

With regard to the following:

You don't have to call (shouldn't call, actually) View.beginProcess() and View.endProcess() to execute a process instance. These methods are only required to modify image data by calling pure JavaScript objects, properties and methods. For instance execution, just call executeOn(), which takes care of all the necessary history management.


I copied this technique from other scripts, however, on checking further I now realise that some scripts do it the correct way and some don't.

Thanks again.

Best Regards,
       Dave
Dave