Author Topic: scripting: prevent image windows from being shown?  (Read 2006 times)

Offline vogelito

  • Newcomer
  • Posts: 10
scripting: prevent image windows from being shown?
« on: 2017 November 07 16:54:32 »

Hello, I'm trying to learn more about scripting, mostly by taking bits and pieces from existing scripts to see how they work.  I'm new to PI and JavaScript.

One thing I'm stuck on: how can I prevent intermediate image windows from being shown?  Specifically, I'm playing with ImageIntegration, and the resulting image always pops up long enough for me to save the image and then close that image window.  But in most scripts (like BatchPreprocessing) we don't see image windows flashing open and closed while the scripts run.  I've tried going through the BatchPreprocessing code, but I can't find that one detail (looking for things like ImageWindow.visible(false), or a way to prevent ImageWindow.show ...). 

Any help would be appreciated.  Code below is an example of what I'm trying to do.
Mike

Code: [Select]
   var II = new ImageIntegration;

   II.images =  [
     [true, "C:/DSC_4091_crop.fit"],
     [true, "C:/DSC_4092_crop.fit"],
     [true, "C:/DSC_4093_crop.fit"]
     ]
   II.rangeClipLow = false;
   II.rangeClipHigh = false;

   var ok = II.executeGlobal();

   var window = ImageWindow.windowById( II.integrationImageId );

   // Save the image; I still need the image window to exist in order to save the file
   let F = new FileFormat( ".xisf", false/*toRead*/, true/*toWrite*/ );
   let f = new FileFormatInstance( F );
   f.create( "C:/Int_crop.xisf" )
   f.writeImage( window.mainView.image )
   f.close();

   window.forceClose();