Page 1 of 1

Mask Module Use

Posted: Tue Feb 28, 2017 12:37 pm
by Guy
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.
To easily access similar notes on the other StarTools modules see StarTools Main Window Use.

Mask Module

Purpose:
  • To help in the setting of a mask that can be used by modules in StarTools to allow them to sample only the selected parts of an image. Examples include: Color, Wipe,
  • To help in the setting of a mask that can be used by some modules in StarTools to allow them to act on only the selected parts of an image. Examples include: Decon, Filter, Flux, Heal, Layer, Life, Super Structure, Shrink (Magic), Repair, Sharp, Synth,
Description:
For a general overview see Masks.
  • Pixels that are set in the mask are shown in green. These pixels will be processed by the module.
  • Pixels that are not set in the mask are left in their original colour. These pixels will not be processed.
  • If a selective mask is set the Mask will flash three times when you load a module.
Useful Sources
There are good general instructions for the use of the Mask module here.
The processing video 'StarTools simple image processing workflow tutorial with real-world, imperfect data' shows the use of the Mask in the Decon module. This shows v1.4 but is still relevant for this module.

The notes below relate to StarTools version 1.5, 1.6, 1.7, and 1.8

When to use:
Masks can be used in the following Modules:
Color, Decon, Filter, Flux, Heal, Layer, Life, Shrink (Magic), Repair, Sharp, Super Structure, Synth, Wipe,

Note: if you want to retain the documentary value of the image (you want to document what is there - not create art) then you should use masks carefully. Using masks that have been manually created can destroy data that was in the image, or create some that wasn't. In this case a useful rule might be to only use a mask created from the image itself - i.e use only Auto generated masks - and then very selectively.

Method:
There are many different methods for creating a star mask - based on what you want to mask.
See 'Special Techniques' section for a selection of the more common ones.
Here is the general method.
  1. Optionally use a Preset as the starting point:
    • Press 'Auto' button
    • Press 'Stars' or 'FatStars'
    • Press 'Do'
  2. If needed:
    • Select 'Brush Mode' - see below for a description of brush action options.
    • Use pointer to highlight areas as needed
  3. Click 'Shrink' or 'Grow' as needed - affects all green areas.
  4. Use 'Invert' if needed - inverts all green areas to black and black areas to green.
  5. Repeat with other brush modes to add more areas.
  6. Use 'Undo' to undo the last action.
  7. Use 'Grow Blob' and 'Shrink Blob' brush modes to grow and shrink individual blobs.
  8. Keep (or Save if needed)
What result to look for:
  • The mask set should ensure that only the selected pixels are modified.
  • If parts of a DSO are wrongly included in a star mask try excluding the predominant colors of the DSO from the mask selection by using the 'Exclude Color' setting.
After Use:
Continue with normal workflow. Keep or Clear the mask as required.

Special Techniques:

To revert to a module processing all pixels
Return to the default mask for any module - all pixels selected.
  1. Clear
  2. Invert
  3. Keep
Create a Star Mask
Create a star mask based on the Auto 'Star' button preset values.
  1. Auto
  2. Star
  3. Do
Creating a complex mask using multiple Brush Modes and Auto Star Masks
  1. You can load a previously saved mask using the 'Open' button. The mask must have the same dimensions as the current image.
  2. Add mask elements using Brush Modes:
    1. Define any lines using the 'Line Toggle' brush mode. 'Grow' or 'Shrink' as needed' - this can't be done individually on lines later.
    2. Select each brush mode needed - choose from: 'Single Pixel Toggle (Freehand)', 'Single Pixel Off (Freehand)', 'Similar Color', 'Similar Brightness', 'Lasso', 'Circle (Click Center & Drag)'
  3. Use 'Undo' to undo last action
  4. Add Auto Masks:
    1. Click 'Auto'
    2. Select preset and adjust settings as needed
    3. Set 'Old Mask' to 'Add New to Old' (or 'Subtract New from Old') - this overlays the star mask on the other mask elements.
    4. Do
    5. Repeat with other Auto Star masks if needed
  5. Use 'Grow Blob' and 'Shrink Blob' brush modes to grow and shrink individual groups of adjacent green pixels.
  6. Use 'Grow ' and 'Shrink' buttons to grow and shrink all groups of adjacent green pixels.
  7. You can mix Auto star masks and Brush Mode actions as you want.
  8. You can save these results and use them as a basis for a more complex mask by using the 'Save' and 'Open' buttons.
  9. Keep
Star Mask when there is a lot of noise in the image.
The above procedure can show false 'stars' When the image is noisy. This procedure may eliminate this problem
  1. Auto
  2. Star
  3. Set Selection Mode to 'Highlights>Threshold'
  4. Set Threshold to say 60%
  5. Press 'Do'
  6. If there are too few stars detected, reduce the threshold and press 'Do'. If noise is being selected increase the threshold. Repeat until you get the result you want.
  7. Keep the result.
Creating an Inverse Star mask for Decon use - AutoMask equivalent.
This creates an inverse star mask with stars and their halos masked out. This gets the same results as the AutoMask button in Decon. This is only possible to do when Tracking is on.
  1. Auto
  2. FatStars
  3. Grow x4
  4. Invert
Selecting background only
To select the background only:
  1. Press 'Auto'.
  2. Select 'Stars' preset.
  3. Reduce Threshold until only the background shows - usually to about 10-20% .
  4. Press 'Do'.
  5. Repeat until only the background is visible.
  6. Press 'Invert' to select the background.
  7. Keep
Selecting Faint Stars Only
There are a number of cases when you only want to select the fainter stars.
  1. First select all stars including small ones:
    • Use Auto->Stars preset
    • Set Feature Size to 1 - to select the smaller features only.
    • Increase the Filter Sensitivity value to show fewer stars if needed.
    • Press 'Do'
  2. Then select the brightest stars and subtract them:
    • Auto
    • Set Selection Mode to 'Highlights>Threshold'
    • Set Threshold to say 75%
    • Set Old Mask to 'Subtract New From Old'
    • Press 'Do'
  3. Keep the result.
Making Luminance Mask of a DSO
  1. Set Brush Mode to 'Flood Fill Lighter Pixels'
  2. Click on edge of DSO - any neighbouring pixels which are the same as or lighter will be selected. It may take a few tries to get the right coverage.
  3. Click on the edge of any other areas of the DSO that have not been selected.
Making Luminance Mask of DSO excluding stars
Sets the mask of a DSO based on a brightness threshold - but excluding stars.
  1. First make a mask based on brightness:
  2. Auto
  3. Set Selection Mode to 'Highlights>Threshold'
  4. Set Source to 'Stretched'
  5. Set Threshold to, say 30.00% - to select as much of the DSO as you want.
  6. All other settings should be OK at their default values. Adjust if you want.
  7. Press 'Do'
  8. Next select all stars including small ones:
  9. Auto
  10. Use 'Stars' preset
  11. Set Old Mask to 'Subtract New from Old'
  12. Press 'Do'
  13. 'Keep' the result.
Masking out long thin wisps
For masking long thin wisps (e.g. the veil nebula).
  • Press the 'Clear' button to start with no selected pixels.
  • Create a trail of individual green pixels over the detail you want to mask (using the 'Single Pixel Toggle' Brush Mode)
  • Use the 'Grow' button until they merge.
  • If needed, Invert the mask - depending on its intended use.
  • 'Keep' the desired result.
Description of Controls:

Open
The 'Open' button allows you to import a Mask that was previously saved by using the 'Save' button. Note that the image that is being opened to become the new Mask, needs to have the same dimensions as the image the Mask is intended for. Loading an image that has values between black and white will designate any shades of gray closest to white as 'on', and any shades of gray closest to black as 'off'.
It works for any TIFF file so you can create masks using other programs like PhotoShop or GIMP.

Save
The 'Save' button allows you to save the current mask to a standard TIFF file that shows 'on' pixels in pure white and 'off' pixels in pure black.

Auto
The 'Auto' button is a very powerful feature that allows you to automatically isolate features.
  • See detailed description below
Clear
The 'Clear' button turns off all green pixels (i.e. it deselects all pixels in the image).

Invert
The 'Invert' button turns on all pixels that are off, and turns off all pixels that were on.

Shrink
The 'Shrink' button turns off all the green pixels that have a non-green neighbour, effectively 'shrinking' any selected regions.

Grow
The 'Grow' button turns on any non-green pixel that has a green neighbour, effectively 'growing' any selected regions.

Undo
The 'Undo' button allows you to undo the last operation that was performed.

Brush Mode
Specifies how clicking on the image affects the toggling on or off of pixels in the mask.
For a description of the different brush modes see Brush Modes.
  • Flood Fill Lighter Pixels - Performs a flood fill, starting at the clicked pixel and filling neighbouring pixels until it can no longer find neighbouring pixels that are lighter than the clicked pixel.
    • This selection method is very effective in selecting stars.
    • Rather than clicking on an object (or part of an object) such as a star, try clicking on the edge of a star to select the whole star.
  • Flood Fill Darker Pixels - Performs a flood fill, starting at the clicked pixel and filling neighbouring pixels until it can no longer find neighbouring pixels that are darker than the clicked pixel.
    • This selection method is very effective in selecting the darker parts of an image.
  • Single Pixel Toggle - Toggles individual pixels on and off.
  • Similar Color - Selects nearby pixels that are of a similar colour to the clicked pixel.
  • Similar Brightness - Selects nearby pixels that are of a similar brightness to the clicked pixel.
  • Line Toggle - Draws a line between the point where you press the mouse button and the point where you release it. You can enlarge the line by using the 'Grow' button. Press 'Grow' once to be able to use the 'Grow Blob' brush mode.
    • This can be useful in masking out satellite trails.
    • Can also be used to deselect columns of sensors. Click and drag from one end to the other to deselect the column. Repeat if a number of columns are involved. Then press 'Shrink' to shrink the green area (grow the deselected area) until the deselected lines merge.
  • Lasso - Selects all the pixels that lie within any convex shape that you draw. Use it to quickly select or deselect large blobs.
  • Grow Blob - when a blob is clicked on - grows the selected green blob of touching pixels. Use it to make any individually selected areas bigger (for example a star) without modifying others. One limitation is that it doesn't work well on lines.
  • Shrink Blob - when a blob is clicked on - shrinks the selected green blob of touching pixels. Use it to make any individually selected areas smaller (for example a star), without modifying others.
  • Circle (Click Start & Drag) (v1.8) - Creates a circle filled with green - Click where you want the centre to be and drag to where you want the edge to be.
Auto button description

Stars Preset
Creates a star mask where all the stars are selected (green).

FatStars Preset
Creates a star mask where a larger area around a star is selected (green) for all the stars.
  • FatStars requires Tracking to be on as it requires a 'Linear' Source type. The preset is greyed out when Tracking is off.
AltStars Preset (v1.8)
Enables the new Star Mask Generator functionality.

Star Mask Generator (v1.8)
  • Controls the use of the Star Mask Generator (v1.8) which has:
  • Dedicated star detector and mask generator
  • Specialises in detecting smaller and fainter stars, including full stellar profile and halos.
  • Default value is 'Off'. Range is 'Off' or 'On'.
Star Aberrations (v1.8)
Defines the quality of the stars.
  • Used only but the Star Mask Generator.
  • Increase this value if data quality is poor or stars undersampled.
  • Helps the Star Mask Generator differentiate between stars and other elements.
  • Default is 1. Range is 0 to 20.
Star Size (v1.8)
Defines how large the average star is across the image.
  • Used only but the Star Mask Generator.
  • Helps the Star Mask Generator differentiate between stars and nebulosity or structural detail.
  • Default is 5. Range is 0 to 30.
Source
Sets which data the mask generator should derive the mask from.
  • Linear - The mask generator should use the data when it is linear and has not been stretched.
    • This is particularly suited for detecting bright elements such as stars and over exposed elements.
    • This is perfect for creating star masks for deconvolution.
  • Stretched - The mask generator should use the data that has been stretched to the current extent.
    • Use this if you need to select the detail as it is now.
  • Default is Stretched [Stars], Linear [FatStars]
  • The Linear setting is only available when Tracking is on.
Selection Mode
Specifies which type of features are to be isolated by the Auto algorithm.
For a description of the different Selection Modes see Selection Modes.
Below is a summary of the range:
  • Light Features + Highlights>Threshold - Isolates light features of a maximum size of Feature Size that are not coloured as specified in Exclude Color.
    • It also isolates any pixels whose brightness is above a certain Threshold.
    • This setting is perfect for isolating stars.
  • Light Features - Isolates light features which are high frequency (rapidly changing) components - based on a maximum size of Feature Size and that are not coloured as specified in Exclude Color. Good for selecting stars, gas knots and nebula edges.
  • Highlights>Threshold - Isolates any pixels whose brightness is above a certain Threshold.
  • Dead Pixels Color<Threshold - Attempts to isolate dead pixels - based on high frequency components whose brightness is below a certain Threshold, whose size is below a certain Feature Size, depending on the Filter Sensitivity, and that are not coloured as specified in Exclude Color.
  • Dead Pixels Mono<Threshold - Attempts to isolate dead pixels - based on high frequency components whose brightness is below a certain Threshold, whose size is below a certain Feature Size, and depending on the Filter Sensitivity.
  • Hot Pixels Color>Threshold - Attempts to isolate hot and warm pixels - based on whose brightness is above a certain Threshold, whose size is below a certain Feature Size, depending on the Filter Sensitivity, and that are not coloured as specified in Exclude Color.
  • Hot Pixels Mono>Threshold - Attempts to isolate hot and warm pixels - based on whose brightness is above a certain Threshold, whose size is below a certain Feature Size, and depending on the Filter Sensitivity.
  • Dust & Scratches - Tries to identify dust and scratches based on Threshold value.
  • Noise - Isolates pixels that are deemed noisy. Use the Feature Size and Threshold to define the noise grain and sensitivity.
  • Edges >Threshold - Selects areas with a steep brightness transition controlled by the Threshold value.
  • Horizontal Artifacts - Selects horizontal features greater than Threshold brightness which are 1 pixel wide with length of at least Feature Size.
  • Vertical Artifacts - Selects vertical features greater than Threshold brightness which are 1 pixel wide with length of at least Feature Size.
  • Radius (use Threshold) - Selects pixels within a circle about the centre. The radius is defined by the Threshold parameter (50%=full width circle).
  • Default is 'Light Features + Highlights>Threshold' (v1.8)
Feature Size
Sets the maximum feature size Auto algorithm should attempt to isolate.
  • The appropriate setting depends largely on the image size versus angular size of the object image.
  • Increasing this setting may help in the correct detection of bigger stars.
  • Used by Selection Modes: 'Light Features + Highlights', 'Light Features', 'Horizontal Artifacts', 'Vertical Artifacts' and 'Noise'.
  • Default is 8. Range is 0 to 20.
Threshold
Sets a brightness threshold as a percentage of 'full brightness' to be used by the Selection Mode to decide which pixels to select.
  • Used by 'Light Features + Highlights', 'Highlights', 'Dead Pixels', 'Hot Pixels', 'Dust & Scratches', 'Noise', 'Edges', 'Horizontal Artifacts', 'Vertical Artifacts' and 'Radius'
  • Default is 100.00. Range is 0.00 to 100.00
Old Mask
Specifies what to do with any mask that already exists. New and old masks can be added in a number of ways - allowing complex masking:
  • Clear - Clears the old mask - only uses the new mask.
  • Add New To Old - Adds to the old mask any new pixels that are selected. The new mask is overlayed over the old mask.
  • Subtract New From Old - Any pixels that are selected in the new mask will be unselected in the resulting mask. This is useful for deselecting stars in a specific part of an image.
  • Add New Where Old Is Set - Only selects a pixel if both the old and the new mask have that pixel selected. You could use this to create a star mask in only a part of the image.
  • Default is 'Clear'.
Filter Sensitivity
Sets how sensitive the feature detector should be when detecting features.
  • Lower values increase the number of features detected (more sensitive), while bigger values reduce the number of features detected (less sensitive) - this may be counter-intuitive.
  • For hot or dead pixel detection a higher sensitivity is appropriate.
  • Default is 5 [Stars], 0 [FatStars]. Range is 0 to 30.
Exclude Color
Sets which colour channels to ignore when detecting features.
  • This is particularly useful when detecting stars by minimising false positives caused by, for example, bright gas knots in DSO's.
  • Used by Selection Modes: 'Light Features + Highlights' and 'Light Features'
  • Range is: None, Red, Blue, Yellow (Red + Green), Purple (Red + Blue)
  • Default is None.
Associated Controls
Sometimes there are other controls in a module which are associated with using a mask.

Grow Mask
If a mask is used, sets the amount to temporarily grow the mask by.
  • This allows a common mask to be used amongst several modules (e.g. a star mask) making small temporary adjustments to suit individual modules
Mask Fuzz
If a mask is used, Mask Fuzz controls the blending of the transition between masked and non-masked parts of the image.
  • Increase this value to make a more gradual transition
Background Notes:

Mask Blink control
  • To stop the Mask blinking three times as a reminder it is set, put a file called 'noblink' in the StarTools executables folder. Instead of blinking it will just show the mask once for a few seconds.
Creating a mask in GIMP 2
You can create a mask in another program and import it into StarTools as a Tiff file.
So you can use brushes and other tools in PhotoShop or GIMP to create the mask, save it as a tiff, and then Open it in StarTools.
Here are some instructions for creating a Mask in GIMP 2 (These instructions have been tested on version 2.8):
  • Load a saved version of the image into GIMP 2.
  • In the Layer menu - select 'New Layer' - Fill Type: 'Transparency' - this creates a new Layer.
  • If the 'Layers' dialog is not visible open it using Ctrl-L.
  • If the 'Tools Options' dialog is not visible - open it using the Windows menu - Dockable Dialogs - 'Tool Options'.
  • From the Tools menu select 'Paint Tools' - then select Paintbrush (or perhaps another tool e.g Airbrush).
  • In the 'Tool Options' dialog adjust the 'Brush' settings - such as Size and other settings as needed.
  • In the 'Layers' dialog select the new Layer.
  • Select (in black) the elements of the image you want masked using the brush - or do the opposite and invert it later.
  • When done, select the original image layer - right-click and select 'Delete layer'. This leaves the mask layer.
  • In the Image menu select 'Flatten Image'
  • In File menu - select 'Export As..' - Select 'File Type (by extension)' - 'TIFF Image', name the image, then press 'Export'.
  • In StarTools, click the 'Mask' button at the top of the main screen.
  • Click 'Open' and select the newly created mask. The mask should open with the black parts now the inactive (transparent) parts. Invert if needed.