Layer Module Use

Notes from users, documentation addendums.

Layer Module Use

Postby Guy » Tue Feb 28, 2017 12:06 pm

Here are some notes relating to using this module. It is not the only way to use the module and experimentation is encouraged.
Please let me know if anyone sees any errors or has any additional advice they think helpful.
I will update this post as needed.
For an index of similar notes on the other StarTools modules see StarTools Main Window Use.

Layer Module

Purpose:
  • To allow pixel manipulation in a very versatile but straightforward manner
Description:
For a general overview see Layer: Versatile Pixel Workbench
The Layer module performs Pixel math by means of graphical user interface. A huge range of operations is selectable, while multiple operations can be chained by means of a buffer.
The effects of using this module can range from very simple to highly complex - and the effective use of the full range of this module requires a great deal of knowledge about the effects of these transformations and their combination.
It is possible to cause clipping and artefacts with this module - which can negatively impact the image and subsequent processing.
However, it is possible to make effective use of some of its power with a little basic knowledge.

Useful Sources
The Unofficial guide is also a good source of help. It relates to version 1.3.5 so there may have been some changes. The notes below relate to StarTools version 1.4.
The Processing video M8 in Color with modest data shows use of the Layer module between 13m18s and 14m36s.
The processing tutorial video StarTools: M42 H-alpha High Dynamic Range composite shows the use of the Layer module between 8m16s and 9m27s.

When to use:
  • Usually it is best to use the Layer module towards the end of the workflow after Tracking has been turned off and denoise has been done.
  • Anything that causes artefacts (whether visible or not) like ringing, sharp edges, clipping, etc. will impact Tracking's ability to keep track of noise - so it is safest to use it after you have switched Tracking off.
  • If you know that what you are doing with the Layer module will not cause artefacts as described above then you can use it with Tracking on - and also the SMI and PIP techniques described below can be used safely with Tracking on.
Example Workflow:
AutoDev-{Band/Lens}-Bin-Crop-Wipe-AutoDev(or Develop)-{Decon/Sharp/Contrast/HDR/Flux/Life}-Color-{Filter}-Denoise-{Layer/Magic/Heal/Repair/Synth}
Key: {...} optional modules

Method:
There are so many ways of using the Layer module with so many different aims and no single method stands out - See the Special Techniques section for some of the more common uses.
The general process is:
  1. If multiple images are to be combined make sure they are the same size and aligned the same as described in the Background Notes.
  2. Start the Layer module - the current image gets loaded into both foreground (centre) and background (left) fields.
  3. Load another image - this will replace the image in the foreground.
  4. Swap the images if necessary to put the right image in the foreground.
  5. Create a mask if needed to protect certain parts from being altered.
  6. Select the desired Layer Mode.
  7. Select Filter Type or Brightness Mask Mode as required.
  8. Adjust other settings as required.
  9. 'Keep' the desired result.
What result to look for:
  • Ensure that image layers are properly aligned.
Special Techniques:

Combining images of different exposure lengths
This is useful when you have a subject with a high dynamic range and you can't, in a single image, get the exposure right which gives you the detail you want in the fainter portions without saturating the brighter portions.
This Technique is shown in video StarTools: M42 H-alpha High Dynamic Range composite
  1. Make sure the images are the same size and aligned the same as described in the Background Notes.
  2. Process each image separately - Use Develop instead of AutoDev - save each result.
  3. Restart StarTools.
  4. Load both images into Layer Module - with the longer exposure in the foreground (centre).
  5. Set the Layer Mode to 'Blend'.
  6. Use the Filter Type 'Max Contrast' or 'Max Distance to 1/2 Unity'.
  7. You can combine the two by copying the result (Copy) of one filter, pasting to the Foreground (Paste>Fg), and then apply the other filter.
  8. Adjust the Blend Amount (to 50% or 100% perhaps).
  9. Increase the Filter Kernel Radius until a smooth blend is achieved (can be near max. of 51 pixels).
  10. You can repeat the process by copying the result and Paste to the Foreground (Paste>Fg) (or Background).
  11. Keep the result.
Combining Luminance and RGB images
This is a generic method to combine (synthetic) luminance and colour data as described in Mel 15. It is an alternative to the method 'Processing Ha,R,G,B using a synthetic luminance frame' described in LRGB Module Use.
  1. Make sure the images are the same size and aligned the same as described in the Background Notes.
  2. Process luminance data as normal - trying to tease out the detail - and save it.
  3. Process the R+G+B colour stack, making sure the noise is minimal - make sure there is a good continuum of colours - then save it.
  4. Restart StarTools.
  5. Load the luminance data.
  6. Start the Layer module - the current image gets loaded into both foreground and background.
  7. Load the colour data - this will replace the image in the foreground.
  8. Select Layer Mode 'Color Extract fg' to extract the luminance independent (normalised) colours from the colour image.
  9. Click Copy to store the composite output in the buffer.
  10. Click Paste>Fg to paste the extracted colours into the foreground layer.
  11. Select the Layer Mode 'Color Of fg' (or 'Multiply') to use the luminance information from the background and the colour of the foreground.
  12. If darker parts of the background are too bright - select Brightness Mask Mode 'Where fg is dark, use bg' or 'Where composite is dark, use bg'.
  13. Use the Brightness Mask Power to subdue the colouring of the background.
  14. Use the Blend Amount to increase/decrease saturation.
  15. 'Keep' the desired result.
Creating a synthetic luminance frame
To create the synthetic luminance frame we combine all the data we have into a weighted average - weighting according to the exposure time collected in each channel.
Example: R:G:B:Ha 30m:30m:30m:110m T1:T2:T3:T4
See also the description: Ha,R,G,B ->synthetic luminance
We load one file and then add the other channels one by one using the Layer module.
  1. Make sure the images are the same size and aligned the same as described in the Background Notes.
  2. Start StarTools.
  3. Open R file - indicate the data is not linear (even though it is) by selecting 'Modified and not linear' - This turns Tracking off.
  4. Open the Layer module.
  5. Open G - Set blend to T2/(T1+T2)% - which is 30/60=50% in the example.
  6. Copy, then Paste>Bg
  7. Open B - Set blend to T3/(T1+T2+T3)% - which is 30/90=33% in the example.
  8. Copy, then Paste>Bg
  9. Open Ha - Set blend to T4/(T1+T2+T3+T4)% - which is 110/200=55% in the example.
  10. Either:- Save the image to a file and open as a linear file later - or turn Track on.
We now have our weighted average synthetic luminance frame.

Hubble Palette synthetic luminance frame Example:
Example Ha:SII:OIII 110m:40m:40m T1:T2:T3
  1. Make sure the images are the same size and aligned the same as described in the Background Notes.
  2. Start StarTools.
  3. Open the Ha File - indicate the data is not linear.
  4. Open the Layer module.
  5. Open the SII file - Set blend to T2/(T1+T2)%=40/150=27%.
  6. Copy, then Paste>Bg
  7. Open the OIII file - Set blend to T3/(T1+T2+T3)%=40/190=21%.
  8. Either:- Save the image to a file and open as a linear file later - or turn Track on.
Colour balancing of data that was captured using a light pollution filter
In this technique the colour data is captured without a light pollution filter. The luminance data is a longer exposure using a light pollution filter. The method described here uses the Layer Mode and a Brightness Mask to combine the two data sets.
See also Colour balancing of data that was filtered with a light pollution filter.
  1. Make sure the images are the same size and aligned the same as described in the Background Notes.
  2. Load the colour data.
  3. Launch the Layer module.
  4. Select Layer Mode 'Color Extract fg' to extract the colours from the colour image.
  5. Click Copy to store the output in the buffer.
  6. Open the luminance image.
  7. Click Swap - swaps background and foreground (putting luminance in the background).
  8. Click Paste->Fg to paste the extracted colours into the foreground layer.
  9. Select Layer Mode 'Color Of fg' to use the luminance information from the background and the colour of the foreground.
  10. Select the Brightness Mask Mode 'Where fg is dark use bg'.
  11. Use the Brightness Mask Power to subdue the colouring of the background.
  12. Use the Blend Amount to increase/decrease saturation.
  13. Use the Filter Kernel Radius (with Gaussian filter) to mitigate colour noise.
  14. Keep the result.
Creating Bi-Colour images using Steve Cannistras method
This is a description of a method proposed by Steve Cannistra Modified Bicolor Technique for combining Ha and OIII images.
You may get better results if you preprocess the images separately and then combine them as described here.
  1. Create Synthetic Green Image:
    - Make sure the Ha and OIII images are aligned and the same size in pixels.
    - Load Ha data - indicate the data is not linear (even though it is) by selecting 'Modified and not linear' - This turns Tracking off.
    - Open the Layer Module.
    - Load OIII data into foreground.
    - Set Layer Mode to 'Multiply'.
    - Set Blend Amount to 100%.
    - Keep.
    - Save as a Tiff file.
  2. Re-start StarTools.
  3. Load the LRGB Module.
  4. Load the Ha data into the Red Channel.
  5. Load the saved Synthetic Green image into the Green Channel.
  6. Load the OIII data into the Blue Channel.
  7. Increase the Green Ratio to about 1.50 - or as you prefer - this increases the influence of the Synthetic Green data.
  8. Keep.
  9. When prompted for Type of Data select 'Linear, was not bayered or is whitebalanced'.
  10. Process with other modules as normal - Crop, wipe etc.
  11. When using the Color Module with narrow-band data the automatic colour balance that happens on loading may produce odd results. Set the Bias Sliders back to 1.00 and then adjust from there until you get the result you want. Adjust the Saturation Amount if you want.
Splitting into Luminance and RGB before Processing
The technique was described by Kevin Bisher and based on Scott Rosens LLRGB method for DSLR image processing - which used PhotoShop.
  1. Load the image.
  2. Bin and Crop the Image as needed.
  3. Save the image - this is the RGB version.
  4. Create a Luminance (monochrome) version of the image (one way is: Layer -> Layer Mode=Desaturate fg (Luminance) -> Keep) and save it.
  5. Load and Process the RGB version using heavy denoise - save it.
  6. Load and Process the Luminance image - concentrating on bringing out the detail.
  7. Merge images using the Layer module:
    • Make sure the images are the same size and aligned the same as described in the Background Notes.
    • Load the Layer module - Luminance image will be loaded into centre (foreground) and left (background) panel.
    • Load the RGB image - this puts the RGB image in foreground (Luminance stays in background).
    • Set the Layer Mode to 'Blend'.
    • Set the Blend Amount - reduce from 100% as needed.
  8. Do any further processing needed to the combined image.
  9. You can repeat this process with the result to further improve it.
  10. Keep the result.
Screen Mask Invert (SMI)
This is an old method used by PhotoShop/PixInsight users to increase contrast in the shadows. See this external reference for more details.
Normally other StarTools functions are better but, if needed, StarTools can achieve this as described in SMI
  1. It is best run just before the Color Module (while Tracking is still on!)
  2. Launch the Layer module.
  3. Set 'Layer Mode' to 'Screen'.
  4. Set 'Brightness Mask Mode' to 'Where foreground is light, use background'.
  5. Keep the result.
Power of Inversed Pixel (PIP)
This is an old method used by PhotoShop/PixInsight users to increase contrast in the shadows. See this external reference for more details.
Normally other StarTools functions are better but, if needed, StarTools can achieve this as described in PIP
  1. It is best run just before the Color Module (while Tracking is still on!).
  2. Launch the Layer module.
  3. Set 'Layer Mode' to 'Power of Inverse'.
  4. Set 'Brightness Mask Mode' to 'Where foreground is light, use background'.
  5. Keep the result.
Description of Controls:

Mask
For general instructions on using masks see Mask
  • The mask is applied to the foreground.
  • Non-green parts appear in the result on the right as they are in the foreground image, unchanged.
Buffer Actions:
The following Buffer Action buttons are at the top of the screen:
Note: Fg=Foreground, Bg=background
  • Open - Opens an image and loads it into the Foreground (centre image)
  • Paste>Fg - Pastes Copy Buffer (i.e. the Image last Copied to the Copy Buffer) to the Foreground - greyed out if nothing in the Copy Buffer.
  • Paste>Bg - Pastes Copy Buffer (i.e. the Image last Copied to the Copy Buffer) to the Background - greyed out if nothing in the Copy Buffer.
  • Undo>Fg - Copies Undo Buffer (i.e. the old Image - as it was at the start of the previous module) to the Foreground
  • Undo>Bg - Copies Undo Buffer (i.e. the old Image - as it was at the start of the previous module) to the Background
  • Copy - Copies the Layered composite result (right hand image) to the Copy buffer - if there is not an image in the right hand side StarTools may crash.
  • Swap - Swaps the Foreground and Background images
Layer Mode
Defines how the foreground image should be layered on top of the background image.
This layering is applied after the Filter has been applied to the Foreground.
  • Blend - Copies the foreground over the background. Change the Blend Amount to change the Fg vs Bg
  • Lighten - Copies the pixels that are the lighter of the foreground and the background
  • Darken - Copies the pixels that are the darker of the foreground and the background
  • Multiply - Multiplies the background image by the foreground image
  • Add - Adds the foreground image to the background image
  • Subtract - Subtracts the foreground image from the background image.
  • Difference - Calculates the difference (positive or negative) between the foreground image and the background image
  • HardLight - Dark pixels are darker, light pixels are lighter.
  • Divide - Divides the background image by the foreground image
  • Brightness of fg - Applies the luminance ('brightness') information of the foreground to the background.
  • Color of fg - Applies the chroma ('colour') information of the foreground to the background channel.
  • Screen - Works like having two slide projectors projecting foreground and background images on top of each other.
  • Power of Inverse - The blending algorithm used in the PIP algorithm
  • Desaturate fg (Average) - Projects a desaturated (i.e. black and white) version of the foreground over the background. The foreground is desaturated by using the average value of the combined red, green and blue channels.
  • Desaturate fg (Luminance) - Projects a desaturated (i.e. black and white) version of the foreground over the background. The foreground is desaturated by using the weighted values for the red, green and blue channels corresponding to human-perceived luminance values (0.299, 0.587 and 0.114 respectively).
  • Invert fg - Projects a negative version of the foreground on top of the background.
  • Color Extract fg - Generates an image devoid of luminance information (luminance information is set to unity), leaving only the (normalised) colour information.
  • Multiply Luminance - Multiplies the luminance info of the foreground image by the background image. Using this mode in conjunction with the Color Extract fg mode allows us to recombine luminance and colour information into one image again.
  • Multiply Compensate Gamma - Multiplies the foreground and the background and then takes the square root.
  • Distance - Calculates the magnitude as if the foreground and background were two vectors.
  • Distance, MCG Hybrid - A hybrid of the Distance and Multiply Compensate Gamma modes.
  • Overlay - Overlays the foreground image on top of the background image. It darkens the image but not as much as the Multiply mode.
  • SoftLight - Dark pixels are darker, light pixels are lighter, edges softened and colors desaturated a bit
  • Multiply Foreground Only - takes the (filtered) foreground image and uses the Blend Amount as a multiplier - allows under- or over- exposing an image - Over-exposing may clip.
  • Default is 'Blend'
Blend Amount
Controls the relative intensity of the foreground image to the background image.
  • Default is 100%. Range is 0% to 500%.
  • For synthetic luminance - normally set so that the foreground is the same relative proportion as the components of the background
  • Examples of how to calculate the correct blend amount are shown in the Special Techniques section above.
Cap Mode
Defines how negative and over-unity values should be treated:
  • Clip - Truncates the negative values to 0 and over-unity values to unity.
  • Normalize - stretches levels to span the whole available dynamic range.
  • Soft Clip
  • Default is 'Clip'
Offset X
Specifies the horizontal offset (in pixels) of the foreground relative to the background
  • Default is 0.0 pixels. Range is -50.0 pixels to 950.0 pixels.
Offset Y
Specifies the vertical offset (in pixels) of the foreground relative to the background
  • Default is 0.0 pixels. Range is -50.0 pixels to 950.0 pixels.
Brightness Mask Mode
Specifies an optional masking using the brightness information contained in both the foreground and background mode. This feature allows you to blend an image based on brightness. The available modes are:
  • Off
  • Where fg is dark, use bg
  • Where fg is light, use bg
  • Where fg is light & dark, use bg
  • Where fg is grey, use bg
  • Where composite is dark, use bg
  • Where composite is light, use bg
  • Where composite is light & dark, use bg
  • Where composite is grey, use bg
  • Default is Off
Brightness Mask Power
Sets the power that should be applied to a pixel in the brightness mask, giving you control over the range of very brightest (or darkest) pixels that will still impact the brightness mask blending procedure.
  • Default is 1.00. Range is 0.00 to 5.00 in 0.1 increments.
Filter Type
Specifies the type of filter to be applied to the foreground layer before layering:
  • Gaussian (Fg) - Applies a Gaussian filter with a kernel size as specified in Filter Kernel Radius
  • Median (Fg) - Applies a median filter with a window size of (1+ [Filter Kernel Radius]x2)
  • Mean of Medium Half (Fg) - Applies a 'mean of median half' filter with window size of (1+ [Filter Kernel Radius]x2)
  • Minimum (Fg) - Applies a minimum filter with window size of (1+ [Filter Kernel Radius]x2)
  • Maximum (Fg) - Applies a maximum filter with window size of (1+ [Filter Kernel Radius]x2)
  • Lightness (Fg) - Applies a maximum and minimum filter with window size of (1+ [Filter Kernel Radius]x2) to the foreground layer. It then takes the mean of the minimum and maximum.
  • Differential Adaptive Noise - Suppresses any noise increase in the foreground due to brightening.
  • Min Distance to 1/2 Unity - chooses between foreground and background values based on which value is closest to 1/2 unity (gray). Filter Kernel Radius controls the smoothness of the blend between the two.
  • Max Contrast - chooses between foreground and background values based on which adds most contrast to the image. Filter Kernel Radius controls the smoothness of the blend between the two.
  • Sobel - Performs a Sobel edge detection operation on the foreground image.
  • Median Horizontal (Fg) - Performs a horizontal median filter with a horizontal kernel size of (1+ [Filter Kernel Radius]x2) pixels.
  • Fractional Differentiation - Applies Fractional Differentiation Filtering on the foreground image. The Filter Kernel Radius governs the v parameter, while alpha is fixed at 0.5. For some images this can show additional structural detail which otherwise would be hidden.
  • Mode Approx. - Uses a fast method to approximate the Statistical Mode of a patch of pixels.
  • Localized Histogram Equalize - performs Histogram Equalisation one patch at a time.
  • Localized Histogram Optimize - calculate a non-linear transformation curve for each patch in such a way that the patch's histogram shape resembles a bell curve - This gives a much more natural look, rather than histogram equalisation, and is very effective.
  • Mean of Medium Half Distance Weighted - performs the same type of filtering as Mean of Medium Half - but weighted by distance.
  • Local Maximum Entropy RGB Selection -
  • Default is 'Gaussian (Fg)'
Filter Kernel Radius
Controls a parameter of the selected filter:
  • Kernel size for Filter Types of: Gaussian (Fg), Median Horizontal (Fg)
  • Window Size for Filter Types of: Median (Fg), Mean of Medium Half (Fg), Minimum (Fg), Maximum (Fg), Lightness (Fg)
  • Smoothness of the blend for Filter Types of: Min Distance of 1/2 Unity, Max Contrast
  • v Parameter for Filter Types of: Fractional Differentiation
  • Default is 1.0 pixels. Range is 1.0 to 51.0 pixels
Mask Fuzz
If a mask is used the Mask Fuzz parameter will ensure smooth, undetectable, transitions between the background and foreground images.
  • This parameter specifies the kernel radius of an optional Gaussian blur, to be applied to the mask.
  • Default is 1.0 pixels. Range is 1.0 to 101.0 pixels.
Background Notes:

Aligning two or more Images
In cases where multiple images are combined it is important that the images are exactly the same size.
If they are not you will get the error message: 'Dimension differ from already loaded file'. If you do, check the dimensions of individual data files by loading them in StarTools individually. The dimensions are listed to the right of the file name at the top of the screen.
Also, in most cases it is important to ensure all the images are aligned the same.
To ensure multiple stacked images are aligned you can use one of the sub-frames as a reference frame.
This is described for Deep Sky Stacker (DSS) and Regim in the Background Notes in LRGB Module Use notes
When processing the images in StarTools before combining, make sure you Bin and Crop each image the same amount.

Pixel Maths
In the Layer module the resulting pixel value depends on three functions:
  • Filter(mode,blend amount, Fg,Bg) - calculated first.
  • Layer Combination(mode, kernel radius, Fg,Bg) - calculated using the result of the filter.
  • Brightness mask(mode, power, Fg,Bg) - overall mask applied to result.
This result can be used as the input and processed again.

Filter Types
See the 'Filter Type' parameter for a large selection of different filters.
The Filter Types in StarTools are similar to some of the Filter Types in Photoshop and GIMP or the Filters in PixInsight. They fall into three broad groups:
  • Noise reduction - Gaussian, Median, Mean of Medium Half, Differential Adaptive Noise, Mean of Medium Half Distance Weighted.
  • Bring out detail - Minimum, Maximum, Lightness, Local Histogram Equalize, Local Maximum Entropy RGB Selection, Sobel, Fractional Differentiation,
  • Blending Foreground and Background - Min Distance to 1/2 Unity, Max Contrast - these can be used to create High Dynamic Range composites from 2 images with different exposure lengths.
Layer Modes
The Layer Modes in StarTools specify how the background and foreground are combined. They are similar in effect to some of the GIMP Layer Modes or the Photoshop Blending Modes or PixInsight Blending Modes. See also the Wikipedia article on Blend Modes.

Layer Modes can be split into the following general groups:
  • Lightening - Lighten, Screen, Add, Power of Inverse
  • Darkening - Darken, Multiply, Multiply Luminance
  • Making Dark Darker, Light Lighter - Overlay, SoftLight, HardLight,
  • Increasing Saturation - Color Extract fg
  • Desaturation (Black and White) - Desaturate fg (Average), Desaturate fg (Luminance)
  • Combining L and RGB - Brightness of fg, Color Of fg
  • More Extreme Darkening - Subtract, Difference, Divide
Guy
 
Posts: 70
Joined: Thu Feb 19, 2015 8:35 am

Return to User Notes

Who is online

Users browsing this forum: No registered users and 2 guests