Author Topic: Critical bug detected: Some combinations of ProcessContainer+PixelMath  (Read 3038 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Yesterday Vicent Peris discovered a critical bug related to the PixelMath and ProcessContainer tools.

When two PixelMath instances are children of a ProcessContainer, and one of the instances uses three expressions that contain references to specific channels of the target image, the second PixelMath instance is executed but does not modify the target image. Yes, I know, this sounds like a big mess :) This is an example:

1st PixelMath instance:

Code: [Select]
var p1 = new PixelMath;
with ( p1 )
{
   expression = "$T-Med($T)+.05";
   expression1 = "";
   expression2 = "";
   expression3 = "";
   useSingleExpression = true;
   symbols = "";
   rescale = false;
   truncate = true;
}

2nd PixelMath instance:

Code: [Select]
var p2 = new PixelMath;
with ( p2 )
{
   expression = "$T";
   expression1 = "($T[1]-.05)*((Avg($T[0])-.05)/(Avg($T[1])-.05))+.05";
   expression2 = "($T[2]-.05)*((Avg($T[0])-.05)/(Avg($T[2])-.05))+.05";
   expression3 = "";
   useSingleExpression = false;
   symbols = "";
   rescale = false;
   truncate = true;
}

Container:

Code: [Select]
var p = new ProcessContainer;
p.add( p1 );
p.add( p2 );

Now if the container p is executed on any RGB image, the second PixelMath expression has no effect (as if it were disabled). Unfortunately, this bug will be present in PixInsight 1.6.0. This is an extremely obscure bug, related to internal optimizations of the core PixInsight application and the PixelMath process. After an initial "approach" to the problem, it is clear that trying to fix this bug now would delay the release of version 1.6 too much. So it will be fixed in 1.6.1.

Workaround: Execute the two PixelMath instances independently (not through a ProcessContainer).

Sorry for the inconvenience.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/