Multiscale Median Transform and issues with recombining layers due to loss of information


Jan 10, 2016

I have been experimenting with the Multiscale Median Transform process to isolate large-scale structure related to artifacts that were not adequately corrected by flat field calibration. When the MMT process is run while discarding the residual layer to isolate small scale structure (SS) and it is run retaining only the residual layer to isolate large scale structure (LS) adding together SS and LS in PixelMath does not reproduce the original image.

Here is an example using a linear image of NGC891 where flat fielding over-corrected the image at the top right:


Apply MMT to isolate small scale structure:



Apply MMT to isolate large scale structure:



Add the two images in PixelMath and apply auto STF:



Visually, comparison of the recombined image to the original (after applying auto STF to both) shows a change in the image contrast.

Image statistics on the original and recombined image show that although the median values are the same the variance is significantly reduced in the recombined image as shown by the much lower average deviation and MAD values. In addition, although the maximum values are the same the minimum value is much larger in the recombined image than in the original. Therefore, information is being lost here.


Why is MMT discarding this information?

My ultimate goal is to correct the image artifacts in this series of images that resulted from poor flat field correction using the large scale image. However, because of the issue noted above the recombined images do not perform correctly after alignment and integration.

Thank you.



New member
Jul 27, 2020
I do something similar except I use ATrousWaveletTransform and PixelMath twice:

1, Name the original image 'orig'
2. Clone the original image
3. Apply ATrous by double-clicking the Residual layer only
4. Rename this resulting image 'ss'
5. Use PixelMath with the following: orig-ss (create new image)
6. Rename this image 'ls'
7. Edit the ls and ss images as desired
8. Use PixelMath as follows; ls+ss (rescale result + create new image)

The statistics are pretty similar - in my case just 1 pixel off by the counts


Jan 10, 2016
Thank you for the excellent suggestion. I tried something similar here using MMT and it works. This seems to be a relatively quick solution to correction of poor flat fielding.


1. Clone the linear image and name the result "O" for "original".
2. Run MMT while retaining everything but the residual layer. Name this "S" for "small scale".
3. Use PixelMath to compute O-S.
4. Run CloneStamp on the O-S image and correct any artifacts from poor flat fielding to create (O-S)corrected.
5. Use PixelMath to compute S + (O-S)corrected. This represents the original image with the artifacts removed.

As shown in the table below, the restored image statistics closely resemble the original image.


It is notable that the O-S image differs significantly from the image that results from running MMT while retaining only the residual layer (L) as shown in the table below for this image. MMT seems to discard a good deal of the noise from the image as described in my original post, such that
O ≠ S + L.


Thanks again.