Author Topic: PJSR: Mac 1189 Image.multiscaleLinearTransform?  (Read 4877 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
PJSR: Mac 1189 Image.multiscaleLinearTransform?
« on: 2015 November 11 09:55:21 »
Trying to figure out how to use multiscaleLinearTransform to filter an image by removing layers. Seeing a segmentation violation sometimes,  other times seeing an array of nulls.

Thanks,
Mike

Code: [Select]
var image = new Image(ImageWindow.windowById("test").mainView.image);
console.writeln(image);

var array = image.multiscaleLinearTransform(6);

// What does array contain?
console.writeln("array.length: ", array.length);
for (var i = 0; i != array.length; ++i) {
   console.writeln("i: ", i, ", array[i]: ", array[i]);
}

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR: Mac 1189 Image.multiscaleLinearTransform?
« Reply #1 on: 2015 November 11 11:33:46 »
Array Image.starletTransform( Array kernel, int numberOfLayers[, int scalingSequence=0[, Array layerState]] )
Array Image.starletTransform( Matrix kernel, int numberOfLayers[, int scalingSequence=0[, Array layerState]] )
Array Image.starletTransform( Array rowVector, Array colVector, int numberOfLayers[, int scalingSequence=0[, Array layerState]] )
Array Image.starletTransform( Vector rowVector, Vector colVector, int numberOfLayers[, int scalingSequence=0[, Array layerState]] )
Array Image.multiscaleLinearTransform( int numberOfLayers[, int scalingSequence=0[, Array layerState]] )
Array Image.multiscaleMedianTransform( int numberOfLayers[, int scalingSequence[, Array layerState]] )
Array Image.medianWaveletTransform( int numberOfLayers[, int scalingSequence[, Array layerState[, Number threshold=5]]] )


In all of these functions the returned array contains an ordered list of Image objects. Each array element is a transform layer, and layers are stored in growing scale order. The last layer is always the transform residual. The layerState parameters are arrays of Boolean objects. If a layerState element is false, the corresponding layer image is not returned (the corresponding array element is nul). The rest of parameters are self-explanatory I think; let me know if you need more information.

void Image.inverseStarletTransform( Array layers )
void Image.inverseMultiscaleLinearTransform( Array layers )
void Image.inverseMultiscaleMedianTransform( Array layers )
void Image.inverseMedianWaveletTransform( Array layers )


The inverse transforms reconstruct an image from a list of transform layers. Of course you can modify the layers or replace a layer with nul to remove it. In this way you can perform a multiscale transformation.

See the ExtractWaveletLayers script for a practical example.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PJSR: Mac 1189 Image.multiscaleLinearTransform?
« Reply #2 on: 2015 November 11 11:56:51 »
Thank you very much Juan.

Image.multiscaleLinearTransform appears to work for smaller numberOfLayers, but I see a segmentation violation on a larger number.

Test image size is 1663x1252, monochannel.

Thanks,
Mike

Update: The scriptable object MultiscaleLinearTransform seems to work without the violation, so this is my workaround.

Code: [Select]
var image = new Image(ImageWindow.windowById("test").mainView.image);
console.writeln(image.mean());

for (var layers = 1; layers != 10; ++layers) {
   var layerState = new Array(layers + 1);
   for (var i = 0; i != layers + 1; ++i) {
      layerState[i] = true;
   }
   var array = image.multiscaleLinearTransform(layers, 0, layerState);

   // What does array contain?
   console.writeln("array.length: ", array.length);
   for (var i = 0; i != array.length; ++i) {
      console.writeln("i: ", i, ", array[i]: ", array[i]);
   }
}

Code: [Select]
*** Error [000]: /Users/Home/Documents/Astronomy/PixInsight/Scripts/MureDenoise/Development/Implementation/MLT.js, line 9: Error: Critical signal caught (11): Segmentation violation


PixInsight 01.08.04.1189 - Critical Signal Backtrace
Signal : 11
Module : 0   PixInsight                          0x00000001053cd716 curl_slist_free_all + 1709683
========================================================================================================================
8: 1   libsystem_platform.dylib            0x00007fff8f47d52a _sigtramp + 26
7: 2   ???                                 0x0000000000000000 0x0 + 0
6: 3   PixInsight                          0x000000010538e0a8 curl_slist_free_all + 1449989
5: 4   PixInsight                          0x000000010538c388 curl_slist_free_all + 1442533
4: 5   PixInsight                          0x000000010538b523 curl_slist_free_all + 1438848
3: 6   PixInsight                          0x0000000104c8daff start + 9958367
2: 7   PixInsight                          0x0000000104c8baa2 start + 9950082
1: 8   ???                                 0x000000011d3d17ed 0x0 + 4785510381
========================================================================================================================
« Last Edit: 2015 November 11 16:00:14 by mschuster »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR: Mac 1189 Image.multiscaleLinearTransform?
« Reply #3 on: 2015 November 25 05:38:57 »
Quote
Image.multiscaleLinearTransform appears to work for smaller numberOfLayers, but I see a segmentation violation on a larger number.

This bug has been a showstopper for the new release. It is now fixed in build 1193. It was related to FFT-based convolutions in PJSR, and has been very difficult to find and fix. Thank you for detecting it.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/