This page describes the built-in functions available in ImageMath scripts.
Solar Image Reconstruction
IMG
Returns the reconstructed image at the specified pixel offset.
Argument |
Required? |
Description |
Default value |
|
Pixel shift |
||
Examples
img(0)
img(ps: 1)
img(ps: a2px(1)) // 1 Å pixel shift
RANGE
Returns the reconstructed image at the pixel offsets represented by the interval.
Argument |
Required? |
Description |
Default value |
|
|||
|
End of the interval (inclusive) |
||
|
Step of the interval |
1 |
|
Examples
range(-1;1)
range(-1;1;0.5))
range(from: -10; to: 10; step: 2)
Math functions
AVG
Computes the average of its arguments. If the arguments are images, the average is computed pixel-wise.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
Examples
avg(range(-1;1))
avg(img(0); img(1))
AVG2
Computes the average of its arguments with sigma clipping. If the arguments are images, the average is computed pixel-wise excluding outliers.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Multiplication factor for standard deviation defining the clipping threshold |
||
Examples
avg2(range(-1;1); 2.0)
avg2(img(0); img(1); sigma: 2.5)
CONCAT
Concatenates argument lists.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
Examples
concat(list(img(0));range(-1;1))
EXP
Computes an exponential
Argument |
Required? |
Description |
Default value |
|
Value |
||
Examples
exp(img(0))
exp(2)
exp(v:2)
IMG_AVG
Computes the average of all pixels in each image. Unlike AVG which computes a pixel-by-pixel average across multiple images to produce a new image, IMG_AVG returns the average value of all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
Examples
img_avg(img(0))
img_avg(img(0); img(1); img(2))
IMG_AVG2
Computes the sigma-clipped average of all pixels in each image. Unlike AVG2 which computes a pixel-by-pixel average across multiple images, IMG_AVG2 returns the sigma-clipped average value of all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Multiplication factor for standard deviation defining the clipping threshold |
||
Examples
img_avg2(img(0); 2.0)
img_avg2(img(0); img(1); sigma: 2.5)
IMG_MAX
Returns the maximum value of all pixels in each image. Unlike MAX which computes a pixel-by-pixel maximum across multiple images to produce a new image, IMG_MAX returns the maximum value among all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
Examples
img_max(img(0))
img_max(img(0); img(1); img(2))
IMG_MEDIAN
Computes the median of all pixels in each image. Unlike MEDIAN which computes a pixel-by-pixel median across multiple images to produce a new image, IMG_MEDIAN returns the median value of all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
Examples
img_median(img(0))
img_median(img(0); img(1); img(2))
IMG_MEDIAN2
Computes the sigma-clipped median of all pixels in each image. Unlike MEDIAN2 which computes a pixel-by-pixel median across multiple images, IMG_MEDIAN2 returns the sigma-clipped median value of all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Multiplication factor for standard deviation defining the clipping threshold |
||
Examples
img_median2(img(0); 2.0)
img_median2(img(0); img(1); sigma: 2.5)
IMG_MIN
Returns the minimum value of all pixels in each image. Unlike MIN which computes a pixel-by-pixel minimum across multiple images to produce a new image, IMG_MIN returns the minimum value among all pixels within an image. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
Examples
img_min(img(0))
img_min(img(0); img(1); img(2))
IMG_PERCENTILE
Returns the requested percentile of all pixels in each image. Generalizes IMG_MIN, IMG_MEDIAN and IMG_MAX, which correspond to percentiles 0, 50 and 100. When the percentile falls between two pixels, the value is linearly interpolated between them. Combined with a mask, this is the way to measure a reference level over a given region without a handful of aberrant pixels throwing it off. If multiple images are passed, returns a list of values. If a single image is passed, returns a number.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Percentile to compute, between 0 and 100. |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
Examples
img_percentile(img(0); 2)
img_percentile(list: img(0); p: 2; mask: annulus_mask(1.05; 1.2))
LOG
Computes a logarithm
Argument |
Required? |
Description |
Default value |
|
Value |
||
|
Exponent |
||
Examples
log(img(0); 1.5)
log(v:img(0), exp: 2)
log(2, 3)
log(v:2, exp: 3)
LOG_STATS
Writes the statistics of an image to the log, then returns the image unchanged. Useful to understand how a value evolves from one image to the next in a batch, by wrapping an expression without changing its result.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Mask restricting the pixels taken into account (created with annulus_mask or range_mask). |
||
|
Text added to each log line, to tell several measurements apart. |
||
Examples
log_stats(img: some_images; mask: annulus_mask(1.05; 1.2))
log_stats(img: some_images; mask: stats; label: "before")
MAX
Computes the maximum of its arguments. If the arguments are images, the maximum is computed pixel-wise.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
Examples
max(range(-1;1))
max(img(0); img(1))
MEDIAN
Computes the median of its arguments. If the arguments are images, the median is computed pixel-wise.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
Examples
median(range(-1;1))
median(img(0); img(1))
MEDIAN2
Computes the median of its arguments with sigma clipping. If the arguments are images, the median is computed pixel-wise excluding outliers.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
|
Multiplication factor for standard deviation defining the clipping threshold |
||
Examples
median2(range(-1;1); 2.0)
median2(img(0); img(1); sigma: 2.5)
MIN
Computes the minimum of its arguments. If the arguments are images, the minimum is computed pixel-wise.
Argument |
Required? |
Description |
Default value |
|
Arguments |
||
Examples
min(range(-1;1))
min(img(0); img(1))
NOISE_SIGMA
Estimates the standard deviation of the noise of an image, by measuring the response of a Laplacian high pass filter. Smooth structures do not contribute to the measurement, unlike a percentile span, and the value remains reliable in the presence of a few aberrant pixels. Clipped or saturated areas, as well as defective pixels, are excluded from the measurement. Useful to assess the quality of each image of a batch, or to weight images before combining them. If multiple images are passed, returns a list of values.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Mask restricting the pixels used for the measurement (created with annulus_mask or range_mask). |
||
Examples
noise_sigma(img(0))
noise_sigma(img: img(0); mask: annulus_mask(1.05; 1.2))
POLY_FIT_2D
Fits a 2D polynomial surface to a mono image within the solar disk.
Argument |
Required? |
Description |
Default value |
|
Mono image |
||
|
Polynomial degree |
3 |
|
Examples
poly_fit_2d(signed_diff(img(0); img(1)))
poly_fit_2d(signed_diff(img(0); img(1)); 3)
poly_fit_2d(image: signed_diff(img(0); img(1)); degree: 3)
POW
Computes a power
Argument |
Required? |
Description |
Default value |
|
Value |
||
|
Exponent |
||
Examples
pow(img(0); 1.5)
pow(v:img(0), exp: 2)
pow(2, 3)
pow(v:2, exp: 3)
SCALE_FROM_UNIT
Rescales the pixel values of an image by multiplying each pixel by 65535, so that an image whose values are in the [0;1] range gets its values mapped to [0;65535]. Inverse of scale_to_unit.
Argument |
Required? |
Description |
Default value |
|
Image(s) or value |
||
|
If 1 (default), values are clamped to the [0;65535] range. If 0, out-of-range values are kept as-is. |
1 |
|
Examples
scale_from_unit(img(0))
scale_from_unit(img(0); 0)
scale_from_unit(img: img(0); clamp: 0)
SCALE_TO_UNIT
Rescales the pixel values of an image by dividing each pixel by 65535, so that an image whose values are in the [0;65535] range gets its values mapped to [0;1]. Useful for floating-point computations or interoperability with other tools.
Argument |
Required? |
Description |
Default value |
|
Image(s) or value |
||
|
If 1 (default), values are clamped to the [0;1] range. If 0, out-of-range values are kept as-is. |
1 |
|
Examples
scale_to_unit(img(0))
scale_to_unit(img(0); 0)
scale_to_unit(img: img(0); clamp: 0)
SIGNED_DIFF
Deprecated: use the a - b subtraction, which now does exactly the same. Computes the signed difference between two images or scalars (a - b), without normalization.
Argument |
Required? |
Description |
Default value |
|
First operand |
||
|
Second operand |
||
Examples
signed_diff(img(0); img(1))
signed_diff(a: img(0); b: img(1))
WEIGHTED_AVG
Computes a weighted average of images
Argument |
Required? |
Description |
Default value |
|
Images |
||
|
Weights |
||
Examples
weighted_avg(range(-1;1);list(.5;1;.5))
weighted_avg(images: range(-1;1); weights: list(.5;1;.5)))
WEIGHTED_AVG2
Computes a weighted average of images with sigma clipping. Combines the outlier rejection of AVG2 with the weighting of WEIGHTED_AVG: better images can be given a higher weight while aberrant pixels are still excluded. The result is not clamped, so that images normalized before stacking keep their full dynamic range.
Argument |
Required? |
Description |
Default value |
|
Images |
||
|
Weights |
||
|
Multiplication factor for standard deviation defining the clipping threshold (default: 2.5) |
||
Examples
weighted_avg2(images: my_list; weights: my_weights)
weighted_avg2(images: my_list; weights: my_weights; sigma: 3)
Utilities
AR_OVERLAY
Generates an overlay of the detected active regions. This feature will only work if active region image generation has been selected.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
0 : do not display 1 : display the regions and the labels 2 : display only the labels |
1 |
|
Examples
ar_overlay(continuum())
ar_overlay(img: img(0); labels: 2)
BINNING
Returns the binning defined in the process parameters.
Argument |
Required? |
Description |
Default value |
Examples
binning()
CHOOSE_FILE
Opens a dialog box to choose an image file.
Argument |
Required? |
Description |
Default value |
|
An ID for the file chooser. The next time the function is called with the same ID, the directory where the file chooser was opened will be used as the starting point. |
||
|
Title of the dialog box |
||
Examples
choose_file("my_id", "Choose a file")
choose_file(id: "my_id", title: "Choose a file")
CHOOSE_FILES
Opens a dialog box to choose multiple image files.
Argument |
Required? |
Description |
Default value |
|
An ID for the file chooser. The next time the function is called with the same ID, the directory where the file chooser was opened will be used as the starting point. |
||
|
Title of the dialog box |
||
Examples
choose_files("my_id", "Choose a file")
choose_files(id: "my_id", title: "Choose a file")
COLLAGE
Creates an image collage based on a text pattern. Use 'X' for images, '.' for empty cells, and '/' to separate rows. Spaces are ignored.
Argument |
Required? |
Description |
Default value |
|
Text pattern defining the layout. 'X' = image, '.' = empty cell, '/' = new row. |
||
|
List of images to place in the collage. |
||
|
Spacing between cells in pixels. |
10 |
|
|
Background color (0-65535 for mono, or list [r,g,b]). |
0 |
|
Examples
collage("XXX"; list(a;b;c))
collage("X X X / X X X"; images)
collage(".X. / X.X"; list(a;b;c))
collage(pattern: "X.X / .X.", images: list(a;b;c;d), padding: 15, bg: 1000)
COPY_METADATA
Copies the metadata (observation date, observer, ray, process parameters, etc.) from from onto to and returns the resulting image. Useful when arithmetic operations merge metadata in an unwanted way, for example when subtracting a shared image overwrites each frame’s own observation date in a batch. Pixel values are not modified. If to and from are lists of the same length, the copy is done element-wise. If from is a single image and to is a list, every image in the list gets the same metadata.
Argument |
Required? |
Description |
Default value |
|
Image(s) that will receive the metadata |
||
|
Source image(s) for the metadata |
||
Examples
copy_metadata(to: enhanced; from: original)
copy_metadata(to: enhanced_list; from: original_list)
ELLIPSE_FIT
Triggers a new detection of the shape of the solar disk.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
ellipse_fit(img(0))
ellipse_fit(img:range(0;1))
FILTER
The filter function can be used on a list of images to keep these which match a particular criteria. This can be particularly useful in batch mode. For example, you may want to perform a vertical and horizontal flip to images after a certain time, because of meridian flip.
Argument |
Required? |
Description |
Default value |
||||||||||||||||||||||||||||
|
List of images to filter. |
||||||||||||||||||||||||||||||
|
Sbject of the filter ( |
||||||||||||||||||||||||||||||
|
Operator to apply to filter the images. |
||||||||||||||||||||||||||||||
|
Value for comparison |
||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
Examples
filter(images, "file-name", "contains", "2021-06-01")
filter(img: images, subject:"file-name", function:"contains", value:"2021-06-01")
filter(images, "dir-name", "contains", "2021-06-01")
filter(imgimages, subject:"dir-name", function:"contains", value:"2021-06-01")
filter(images, "pixel-shift", ">", 0)
filter(images, "time", ">", "12:00:00")
filter(images, "datetime", ">", "2021-06-01 12:00:00")
GET_AT
Returns the value of an element in a list at the specified position.
Argument |
Required? |
Description |
Default value |
|
List |
||
|
Index |
||
Examples
get_at(list; 0)
get_at(list: some_list; index: 1)
GET_B
Extracts the blue channel from an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
get_b(some_image)
get_b(img: some_image)
GET_G
Extracts the green channel from an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
get_g(some_image)
get_g(img: some_image)
GET_R
Extracts the red channel from an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
get_r(some_image)
get_r(img: some_image)
LIST
Creates a list from the parameters.
Argument |
Required? |
Description |
Default value |
|
List |
||
Examples
list(img(-3), img(3))
list(list: img(-3), img(3))
LOAD
Loads an image from a file.
Argument |
Required? |
Description |
Default value |
|
File path |
||
Examples
load('image.fits')
load(file: '/path/to/image.fits')
LOAD_MANY
Loads many images from a directory.
Argument |
Required? |
Description |
Default value |
|
Directory path |
||
|
Regular expression to filter files |
.* |
|
Examples
load_many("/chemin/vers/dossier")
load_many(dir: "/chemin/vers/dossier", pattern:".*cropped.*")
LOAD_SDO
Downloads an image from the Solar Dynamics Observatory (SDO) taken as close as possible to a given date, in order to compare an observation with a space based image of the same moment. The image is cached on disk, so that it is only downloaded once. The solar disk is filled in automatically, so that the functions which rely on it can be used directly (autocrop2, disk_fill, annulus_mask, radius_rescale2, …). SDO images are oriented with solar north up: remember to rotate your own image by the P angle (rotate_rad(img; angleP)) before comparing them.
Argument |
Required? |
Description |
Default value |
|
Size of the image, in pixels: 512, 1024, 2048 or 4096 |
||
|
Channel: 0094, 0131, 0171, 0193, 0211, 0304, 0335, 1600, 1700, 4500, the HMIB, HMIBC, HMII, HMIIC, HMIIF, HMID magnetograms, or the HMI171, 211193171, 304211171, 094335193 composites |
0094 |
|
|
Requested date, either in ISO format (for example 2026-07-25T10:30:00), or an image whose capture date will be used. Defaults to the date of the current observation. |
date of the observation |
|
Examples
load_sdo(1024)
load_sdo(resolution: 2048, channel: "0193")
load_sdo(resolution: 1024, channel: "HMIIC", date: "2026-07-25T10:30:00")
load_sdo(resolution: 1024, channel: "0171", date: img(0))
MONO
Converts a color image to grayscale.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
mono(some_image)
mono(img: some_image)
PYTHON
Executes inline Python code and returns the result. The script can use 'import jsolex' or 'from jsolex import …' to access ImageMath functions.
Argument |
Required? |
Description |
Default value |
|
Python code to execute (string) |
||
The Python script has access to all ImageMath functions and variables: Variable access (Pythonic): - jsolex.vars.name - read a variable - jsolex.vars.name = value - write a variable (must be declared first in ImageMath) Function calls (Pythonic): - jsolex.funcs.FUNC_NAME(arg1, arg2, …) - call any ImageMath builtin function - jsolex.user_funcs.func_name(…) - call user-defined ImageMath functions Alternative syntax: - jsolex.getVariable('name'), jsolex.setVariable('name', value) - jsolex.call('FUNC_NAME', {'arg': value}) Convenience functions: - jsolex.load(path), jsolex.save(img, path) - jsolex.width(img), jsolex.height(img) - jsolex.getPixel(img, x, y), jsolex.setPixel(img, x, y, value) To return a value, assign it to the 'result' variable: result = jsolex.funcs.SHARPEN(img=img, amount=1.5) |
|||
Examples
python('''
img = jsolex.vars.continuum
result = jsolex.funcs.SHARPEN(img=img, amount=1.5)
''')
PYTHON_FILE
Executes a Python file (.py) and returns the result. The script can use 'import jsolex' or 'from jsolex import …' to access ImageMath functions.
Argument |
Required? |
Description |
Default value |
|
Path to the Python file to execute |
||
The Python script has access to all ImageMath functions and variables: Variable access (Pythonic): - jsolex.vars.name - read a variable - jsolex.vars.name = value - write a variable (must be declared first in ImageMath) Function calls (Pythonic): - jsolex.funcs.FUNC_NAME(arg1, arg2, …) - call any ImageMath builtin function - jsolex.user_funcs.func_name(…) - call user-defined ImageMath functions Alternative syntax: - jsolex.getVariable('name'), jsolex.setVariable('name', value) - jsolex.call('FUNC_NAME', {'arg': value}) Convenience functions: - jsolex.load(path), jsolex.save(img, path) - jsolex.width(img), jsolex.height(img) - jsolex.getPixel(img, x, y), jsolex.setPixel(img, x, y, value) To return a value, assign it to the 'result' variable: result = jsolex.funcs.SHARPEN(img=img, amount=1.5) |
|||
Examples
python_file('scripts/process.py')
python_file('/absolute/path/to/enhance.py')
REMOTE_SCRIPTGEN
Experimental, advanced function which is described specifically in this section.
Argument |
Required? |
Description |
Default value |
|
URL of the service to invoke |
||
Examples
remote_scriptgen("http://localhost:8080/jsolex/remote")
remote_scriptgen(url: "http://localhost:8080/jsolex/remote")
RGB
Creates an RGB image from three mono images.
Argument |
Required? |
Description |
Default value |
|
Red image |
||
|
Green image |
||
|
Blue image |
||
Examples
rgb(img(-1);img(0);img(1))
rgb(r: redWing; g: avg(redWing;blueWing); b: blueWing)
SAVE_RAW
Saves an image and its metadata as raw (float) data, without any conversion to the displayable range. Unlike formats such as FITS or PNG, which requantize the pixels to 16 bits, the exact values are kept, so the image can be reloaded with load to debug a processing step in isolation. The image is returned unchanged, so the call can be inserted in a processing chain. If a list of images is given, each one is saved with its index appended to the file name.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Destination file, relative to the working directory. The |
||
Examples
save_raw(someImage; "/tmp/debug/stacked")
save_raw(img: someImage; file: "stacked.jraw")
save_raw(img: someImages; file: "frames")
SIDE_BY_SIDE
Combines two images side by side (left and right).
Argument |
Required? |
Description |
Default value |
|
Left image(s) |
||
|
Right image(s) |
||
Examples
side_by_side(img1; img2)
side_by_side(left: img1, right: img2)
side_by_side(list1; list2)
SORT
Sorts a list of images
Argument |
Required? |
Description |
Default value |
|
Images |
||
|
Sort order. One of |
shift |
|
Examples
sort(images, 'date')
sort(images, 'date asc')
sort(images: images, order: 'date desc')
TOP_BOTTOM
Combines two images vertically (top and bottom).
Argument |
Required? |
Description |
Default value |
|
Top image(s) |
||
|
Bottom image(s) |
||
Examples
top_bottom(img1; img2)
top_bottom(top: img1, bottom: img2)
top_bottom(list1; list2)
VIDEO_DATETIME
Returns the datetime when a video was recorded.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Date format. |
||
Examples
video_datetime(img(0))
video_datetime(img: img(0), format:"yyyy-MM-dd HH:mm:ss")
WAVELEN
Returns the wavelength of an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
wavelen(img(0))
wavelen(img: img(0))
WORKDIR
Changes the working directory in which images are loaded by the LOAD and LOAD_MANY functions.
Argument |
Required? |
Description |
Default value |
|
Working directory |
||
Examples
workdir('/path/to/dir')
workdir(dir: '/path/to/dir')
Image Enhancement
ADJUST_CONTRAST
Applies simple contrast adjustment by clipping values under the minimal value or above the maximal value.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Minimum value |
||
|
Maximum value |
||
Examples
adjust_contrast(img: img(0), min: 10, max: 200)
adjust_contrast(img(0), 10, 200)
ADJUST_GAMMA
Applies a gamma correction to an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Gamma |
||
Examples
adjust_gamma(img: img(0), gamma: 2.2)
adjust_gamma(img(0), 1.5)
ASINH_STRETCH
Applies the inverse arcsin hyperbolic transformation to increase contrast.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Black point |
||
|
Stretch factor |
||
Examples
asinh_stretch(img: img(0), bp: 500, stretch: 2.5)
asinh_stretch(img(0), 0, 10)
AUTO_CONTRAST
This function is a contrast enhancement function specifically designed for spectroheliograph images.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Gamma |
||
|
Background correction aggressiveness between 0 and 1. 1 = no correction, 0 = maximum correction. |
0.25 |
|
|
Prominences enhancement. 0 means no enhancement. |
0 |
|
Examples
auto_contrast(img: img(0), gamma: 1.5)
auto_contrast(img(0), 1.5)
BLUR
Applies a Gaussian blur to an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Kernel size |
3 |
|
Examples
blur(img(0))
blur(img(0), 7)
blur(img: img(0), kernel:7)
CLAHE
Applies CLAHE (Contrast Limited Adaptive Histogram Equalization) transformation to an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Tile size |
||
|
Bin count |
||
|
Clip limit |
||
Examples
clahe(img: img(0), ts: 16, bins: 128, clip: 1.1)
clahe(img(0), 16, 128, 1.1)
CLAHE2
Adaptive variant of CLAHE that averages several CLAHE passes at different tile sizes, derived automatically from the solar disk diameter. This multi-scale approach strongly reduces the bright limb ring that classic CLAHE produces.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Clip limit |
1.5 |
|
Examples
clahe2(img(0))
clahe2(img: img(0), clip: 2.0)
CLAMP
Limits the values of an image to a range. Values below the minimum are set to the minimum, values above the maximum are set to the maximum. Operations between images preserve out of range values, for example the negative values produced by a subtraction: this function brings them back into the displayable range when that is what you want.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Minimum value (default: 0) |
||
|
Maximum value (default: 65535) |
||
Examples
clamp(img(0))
clamp(img: some_image; lo: 0; hi: 65535)
COLORIZE
Applies a colorization to an image using a color profile related to the wavelength.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Color profile (see spectral lines editor) |
||
Examples
colorize(img: img(0), profile: "H-alpha")
colorize(range(-1, 1), "Calcium (K)")
COLORIZE2
Applies a colorization to an image using curve modeling. The curves are defined by 2 control points: the input value and the output value.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Input value for red (0-255) |
||
|
Output value for red (0-255) |
||
|
Input value for green (0-255) |
||
|
Output value for green (0-255) |
||
|
Input value for blue (0-255) |
||
|
Output value for blue (0-255) |
||
Examples
colorize2(img: img(0), rIn: 50, rOut: 200, gIn: 50, gOut: 200, bIn: 50, bOut: 200)
colorize2(img(0), 50, 200, 50, 200, 50, 200)
CURVE_TRANSFORM
Applies a curve transformation to an image. The transformation interpolates a polynomial of degree 2 passing through three points: the origin point (0,0), the curve point (in, out), and the extreme point (255,255).
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Input value of the curve (0-255) |
||
|
Output value of the curve (0-255) |
||
|
Low protection value (0-255) |
||
|
High protection value (0-255) |
||
Examples
curve_transform(img(0), 100, 120)
curve_transform(img: img(0), in:50, out: 200)
DEGHOST
Attenuates reflections (ghosts) of the solar disk, including several at once, by subtracting a smooth estimate of their excess brightness, without removing the underlying detail. Everything is derived from the image, with no position parameter.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Attenuation strength (0 disables). |
1.0 |
|
|
Number of passes; more passes attenuate the reflection further. |
1 |
|
|
Shows the estimated reflection that would be removed instead of subtracting it (for tuning). |
0 |
|
Examples
deghost(img(0))
deghost(img: some_image, strength: 0.8, iterations: 3)
DESTRIPE
Removes horizontal banding (stripes) from an image. With ellipseMode 2, an additional fine stage also removes localized streaks from the sky, such as the short trails drawn next to the limb by the halo of a bright region, while preserving prominences and coronal structures, which are taller.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Coarsest scale, in pixels, of the vertical smoothing, or -1 to derive it from the image height. Vertical structures wider than bs are preserved; increase the value to remove broader banding. |
-1 |
|
|
Number of passes, or -1 to repeat the correction until it converges. |
-1 |
|
|
Number of vertical strips corrected independently, or 0 to derive it from the width. Use 1 to apply a constant correction over the whole line: the correction no longer follows the horizontal variations of the banding, but it has no visible transition, which is preferable when the image contains a large unusable area such as the solar disk. |
0 |
|
|
Solar disk usage: 0 = ignored (all pixels in the line), 1 = pixels inside the disk (default), 2 = pixels outside the disk only. |
1 |
|
Examples
destripe(img(0))
destripe(img: someImage; bs: 192; passes: 2; ellipseMode: 2)
destripe(img: someImage; bs: 192; strips: 1; ellipseMode: 2)
DISK_FILL
Fills the detected solar disk with a given value (default is the value of the detected black point).
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Fill value |
detected black point value |
|
Examples
disk_fill(img(0))
disk_fill(img: img(0), fill: 200)
EQUALIZE
Equalizes the histogram of the images in parameter so that they all have about the same brightness.
Argument |
Required? |
Description |
Default value |
|
List of images to equalize. |
||
Examples
equalize(range(-1;1))
equalize(list: some_images)
FIX_BANDING
Applies a banding correction to the image
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Band size |
||
|
Number of passes |
||
|
Solar disk usage: 0 = ignored (all pixels in the line), 1 = pixels inside the disk (default), 2 = pixels outside the disk only. |
1 |
|
Examples
fix_banding(img(0), 64, 3)
fix_banding(img: img(0), bs: 48, passes: 10, ellipseMode: 2)
FIX_GEOMETRY
Applies geometric correction to the image based on the calculated ellipse
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
fix_geometry(img(0))
fix_geometry(img: img(0))
FLAT_CORRECTION
Computes an artificial flat field image to correct the image then applies the correction.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Low percentile value |
0.1 |
|
|
High percentile value |
0.95 |
|
|
Polynomial order |
2 |
|
[NOTE] .Experimental ==== The artificial flat correction allows to correct a possible vignetting. It computes a model from the disk pixels. The pixels considered are those whose value is between a low and a high percentile. For example, if you enter 0.1 and 0.9, the pixels whose value is between the 10th and 90th percentile will be used to compute the model. Finally, a polynomial of the specified order is adjusted on the model values to correct the image. ==== |
|||
Examples
flat_correction(img(0))
flat_correction(img: img(0), order: 3)
INVERT
Inverts the colors of an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
invert(img(0))
invert(img: img(0))
LIFT
Shifts the image up so that it no longer contains negative values, by adding the same amount to every pixel. An image which contains no negative value is left unchanged. Useful after a subtraction, which preserves negative values, when you want to keep them rather than discard them with CLAMP.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
lift(img(0))
lift(img(0) - continuum())
LINEAR_STRETCH
Stretches the histogram of an image to occupy the entire range of possible values. This function can also be used to compress the values of an image into the range of possible values (for example after an exponential calculation).
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Minimum value of the histogram to stretch. |
0 |
|
|
Maximum value of the histogram to stretch. |
65535 |
|
Examples
linear_stretch(img(0))
linear_stretch(img(0), 10000, 48000)
linear_stretch(img: img(0), hi: 48000)
MTF
Applies a Midtone Transfer Function (MTF) with configurable parameters for shadows, midtones and highlights. Allows precise control over tonal transformation.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Shadow clipping point (8-bit value: 0-255) |
0 |
|
|
Midtones parameter (value > 0) |
1.0 |
|
|
Highlight clipping point (8-bit value: 0-255) |
255 |
|
Examples
mtf(img: img(0))
mtf(img(0))
mtf(img: img(0), shadows: 10, midtones: 1.5, highlights: 240)
mtf(img(0), 20, 0.8, 220)
MTF_AUTOSTRETCH
Applies an autostretch algorithm using Midtone Transfer Function (MTF) that automatically adjusts contrast based on histogram analysis. Uses sigma-based shadow clipping and target background level.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Shadow clipping point measured in sigma units from histogram peak |
-2.8 |
|
|
Target background brightness level (range [0, 1]) |
0.25 |
|
|
Mask restricting the pixels used for statistics computation (created with annulus_mask or range_mask). For example, an annulus mask around the disk makes the stretch independent of the cropping. The stretch is still applied to the whole image. |
||
Examples
mtf_autostretch(img: img(0))
mtf_autostretch(img(0))
mtf_autostretch(img: img(0), shadows_clip: -3.0, target_bg: 0.3)
mtf_autostretch(img(0), -2.5, 0.2)
mtf_autostretch(img: img(0), mask: annulus_mask(1.05, 1.4))
PERCENTILE_STRETCH
Stretches histogram by mapping specified percentiles to black and white points.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Low percentile (0-100), values below become black (default: 0.1) |
||
|
High percentile (0-100), values above become white (default: 99.9) |
||
|
Mask restricting the pixels used for percentile computation (created with annulus_mask or range_mask). The stretch is still applied to the whole image. |
||
|
Clipping strategy (default: 1). 0: no clipping, pure affine transformation whose gain only depends on the percentiles, pixels outside the range may end up outside the displayable range — suitable for normalizing images before stacking. 1: pixels below the low percentile become black, those above the high percentile become white. 2: the white point is extended to the brightest pixel of the image, which avoids clipping bright regions located outside of the mask. |
||
Examples
percentile_stretch(img(0))
percentile_stretch(img: img(0), lo: 0.5, hi: 99.5)
percentile_stretch(img(0), 1, 99)
percentile_stretch(img: img(0), mask: annulus_mask(1.05, 1.4), clip: 0)
RL_DECON
Applies the Richardson-Lucy deconvolution algorithm to the image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Gaussian radius |
2.5 |
|
|
Sigma |
2.5 |
|
|
Number of iterations |
5 |
|
Examples
rl_decon(img(0))
SATURATE
Saturates the colors of an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Saturation |
||
Examples
saturate(img(0);1.5)
saturate(img: img(0); factor: 1.5)
SHARPEN
Applies a sharpening filter to an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Kernel size |
3 |
|
Examples
sharpen(img(0))
sharpen(img(0), 7)
sharpen(img: img(0), kernel:7)
SIGMOID_STRETCH
Applies a sigmoid (S-curve) transformation for smooth contrast enhancement.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Center of the sigmoid curve (0-1) (default: 0.5) |
||
|
Steepness of transition, higher values create more contrast (default: 10) |
||
Examples
sigmoid_stretch(img(0))
sigmoid_stretch(img: img(0), midpoint: 0.5, steepness: 10)
sigmoid_stretch(img(0), 0.4, 8)
UNSHARP_MASK
Applies an unsharp mask to an image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Strength of the mask |
1.0 |
|
|
Kernel size |
3 |
|
Examples
unsharp_mask(img(0))
unsharp_mask(img(0), 1.5)
unsharp_mask(img: img(0), kernel:7, strength: 1.5)
Cropping
AUTOCROP
Automatically crops an image around the solar disk. The dimensions of the cropping area are determined by the ellipse but also by the dimensions of the image. It is better to use the autocrop2 function which guarantees a centered and square crop.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
autocrop(img: img(0))
autocrop(img(0))
AUTOCROP2
Crops an image to a centered and square area around the solar disk.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
The width of the image will be the diameter of the solar disk multiplied by this factor. |
1.1 |
|
|
The width of the image will be rounded to this multiple. Must be a multiple of 2. |
16 |
|
Examples
autocrop2(img: img(0))
autocrop2(img(0))
CROP
Crops an image to the specified coordinates and dimensions.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate of the top left corner of the cropping area. |
||
|
Y coordinate of the top left corner of the cropping area. |
||
|
Width of the cropping area. |
||
|
Height of the cropping area. |
||
Examples
crop(img(0), 10, 20, 100, 200)
crop(img: img(0), left: 10, top: 20, width: 100, height: 200)
CROP_AR
Generates a list of images corresponding to the detected sunspots. Each image is named after the NOAA active region it shows, when it can be identified, and the separate parts of a single region are grouped into a single image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Minimum size of the spot. |
32 |
|
|
Margin around the spot (in %). |
10 |
|
Examples
crop_ar(continuum))
crop_ar(img:img(0), margin: 15)
CROP_RECT
Reduces the image to the specified dimensions, ensuring that the center of the solar disk will be at the center of the image. There is no scaling: if the solar disk does not fit within the target dimensions, it will be cropped.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Width of the cropping area. |
||
|
Height of the cropping area. |
||
Examples
crop_rect(img(0), 1024, 1024)
crop_rect(img: img(0), width: 200, height: 200)
Background Extraction
BG_MODEL
Creates a BACKGROUND model from an image, which can be used to subtract the BACKGROUND from the original image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Polynomial order. A value higher than 3 is not recommended. |
2 |
|
|
Number of sigmas for sample selection. |
2.5 |
|
|
Mask restricting the pixels the model is computed from (created with annulus_mask or range_mask). Without a mask the model is computed from everything surrounding the solar disk, so it follows whatever signal is there. |
||
Examples
bg_model(img(0); 2.5; 3)
bg_model(img: img(0); sigma: 3)
bg_model(img: img(0); order: 1; mask: annulus_mask(1.3; 1.45))
COLUMN_BG_MODEL
Creates the column illumination model of an image: a background level which changes from one column to the next but stays constant along a column. In spectroheliography one column of the image comes from one frame of the video, so the light scattered inside the instrument while the slit crosses the solar disk raises the background of all those columns, which produces a dome of excess background peaking at the middle of the disk and falling steeply just past its edges. No line by line correction, such as destripe, can see it. The level of each column is the median of its sky pixels, lightly smoothed along the image: no shape is imposed, so the steep fall at the edges of the disk is followed faithfully instead of being rounded off. The model can then be subtracted from the image, or used as a divisor after normalization.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Mask restricting the pixels the model is computed from (created with annulus_mask or range_mask). Without a mask the model is computed from everything surrounding the solar disk. |
||
|
Horizontal smoothing of the model, in pixels. Increase it if the model follows the noise, decrease it if the edges of the dome are rounded off. |
8 |
|
|
Number of sigmas beyond which a column is discarded from the fit, so that a prominence or a coronal streamer does not bend the model. |
2.5 |
|
|
With 1, the model is scaled so that the columns beside the disk sit at 1: it can then divide an image without changing its scale, only the columns under the dome being reduced. |
0 |
|
Examples
column_bg_model(img(0))
someImage - column_bg_model(someImage)
column_bg_model(img: someImage; smoothing: 12; mask: annulus_mask(1.1; 1.45))
destripe(img: someImage/column_bg_model(img: cont; normalize: 1); ellipseMode: 2)
DESCATTER
Removes the background veil around the solar disk, caused by light scattered inside the instrument. It shows up as a bright band extending above and below the disk, and stopping to its left and right. The disk itself is not modified, and prominences and corona are preserved. Also works on images which have already been stretched.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Fraction of the estimated background which is removed. Use a value below 1 for a partial correction, 0 to apply no correction at all. |
1 |
|
|
Number of passes. A second pass only removes what the first one left behind. With 0, the image is left untouched. |
1 |
|
Examples
descatter(img(0))
descatter(img: someImage; strength: 0.8)
autocrop2(descatter(img(0)); 1.5)
NEUTRALIZE_BG
This is a function similar to remove_bg that uses a polynomial modeling of the background to remove gradients. This function can be used on images without ellipse information (solar disk).
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Number of iterations of the algorithm. |
1 |
|
Examples
neutralize_bg(some_image)
neutralize_bg(img: img(0), iterations: 5)
REMOVE_BG
Performs background removal on an image. This can be used when the contrast is very low (e.g in helium processing) and that stretching the image also stretches the background. This process computes the average value of pixels outside the disk, then uses that to perform an adaptative suppression depending on the distance from the limb, in order to preserve light structures around the limb.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Tolerance |
0.9 |
|
Examples
remove_bg(some_image)
remove_bg(img: img(0), tolerance: .5)
Rotation and Rescaling
FIT_CANVAS
Adjusts the canvas size of images so they all have the same dimensions, without rescaling the solar disk. Unlike radius_rescale, this function does not modify the disk size, which avoids adding distortion. It uses the detected ellipses to center each solar disk in a common canvas. The final canvas size is computed automatically to contain all disks.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
fit_canvas(some_image)
fit_canvas(images: my_list)
HFLIP
Flips an image horizontally.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
hflip(some_image)
hflip(img: img(0))
RADIUS_RESCALE
Relative scaling method which can facilitate mosaic composition. It will therefore most likely be used in batch mode. It allows rescaling a set of images so that they all have the same solar disk radius (in pixels). In order to do so, it will perform an ellipse regression against each image to compute their solar disk, then will rescale all images to match the radius of the largest one.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
radius_rescale(some_image)
radius_rescale(images: my_list)
RADIUS_RESCALE2
Rescales an image to have a specific solar radius (in pixels) while maintaining the specified final dimensions. The solar disk is centered in the resulting image. Instead of giving these values, you can supply a reference image with ref: the image will then be rescaled to have the same solar radius and the same dimensions as it, leaving the reference image untouched.
Argument |
Required? |
Description |
Default value |
|
Image to rescale |
||
|
Target radius in pixels |
radius of the reference image |
|
|
Final image width |
width of the reference image |
|
|
Final image height |
height of the reference image |
|
|
Reference image whose solar radius and dimensions must be matched |
||
Examples
radius_rescale2(img, 500, 1024, 1024)
radius_rescale2(img: my_image, radius: 400, width: 800, height: 600)
radius_rescale2(img: sdo_image, ref: my_image)
RESCALE_ABS
Rescales an image to the specified absolute dimensions.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Width of the image |
||
|
Height of the image |
||
Examples
rescale_abs(img(0), 100, 100)
rescale_abs(img: img(0), width: 100, height: 100)
RESCALE_REL
Rescales an image by applying a rescaling factor.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Horizontal rescaling factor |
||
|
Vertical rescaling factor |
||
Examples
rescale_rel(img(0), .5, .5)
rescale_rel(img: img(0), sx: 0.5, sy: 0.5)
ROTATE_DEG
Applies a rotation to an image, in degrees.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Angle |
||
|
Fill value for pixels outside of the image. By default the background level of the image is used, so that the corners created by the rotation blend into the background. |
||
|
Resize the image to fit the rotation. |
||
Examples
rotate_deg(img(0); 30)
rotate_deg(img: img(0); angle: 30)
ROTATE_LEFT
Applies a left rotation to an image
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
rotate_left(img(0))
rotate_left(img: img(0))
ROTATE_RAD
Applies a rotation to an image, in radians.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Angle |
||
|
Fill value for pixels outside of the image. By default the background level of the image is used, so that the corners created by the rotation blend into the background. |
||
|
Resize the image to fit the rotation. |
||
Examples
rotate_rad(img(0); 2.1)
rotate_rad(img: img(0); angle: 2.1)
ROTATE_RIGHT
Applies a right rotation to an image
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
rotate_right(img(0))
rotate_right(img: img(0))
VFLIP
Flips an image vertically.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
Examples
vflip(some_image)
vflip(img: img(0))
Analysis
A2PX
Computes the number of pixels corresponding to a distance in Angstroms. The distance is determined by calculating the dispersion, which will only be correct if you have correctly specified the pixel size of the camera, as well as your spectroheliograph.
Argument |
Required? |
Description |
Default value |
|
Angstroms |
||
|
Reference wavelength in Angstroms |
||
Examples
a2px(1.2)
a2px(a: 1.2, ref: 6328)
AVERAGE_IMAGE
Returns the average image computed from the SER file frames. If the corrected parameter is set to 1, the image is corrected for distortion (polynomial curve straightened).
Argument |
Required? |
Description |
Default value |
|
If set to 1, applies the polynomial distortion correction. |
0 |
|
Examples
average_image()
average_image(corrected: 1)
CONTINUUM
Generates a continuum image around the studied line. This function differs from the classic continuum image in that it is not a single image calculated by the difference of fixed pixels of 15 pixels, but an image calculated from the median of a set of images.
Argument |
Required? |
Description |
Default value |
Examples
continuum()
FIND_SHIFT
Computes a pixel offset relative to the detected line. The distance is determined by calculating the dispersion, which will only be correct if you have correctly specified the pixel size of the camera, as well as your spectroheliograph.
Argument |
Required? |
Description |
Default value |
|
Wavelength to search for in Angstroms or line name |
||
|
Reference wavelength in Angstroms |
||
Examples
find_shift(5875.62)
find_shift(wl: 5875.62, ref: 5895.92)
PX2A
Computes the number of angstroms corresponding to a distance in pixels. The distance is determined by calculating the dispersion, which will only be correct if you have correctly specified the pixel size of the camera, as well as your spectroheliograph.
Argument |
Required? |
Description |
Default value |
|
pixels |
||
|
Reference wavelength in Angstroms |
||
Examples
px2a(24)
px2a(px: 24, ref: 6328)
Drawing
DRAW_ARROW
Draws an arrow on the image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Start of the arrow (X coordinate) |
||
|
Start of the arrow (Y coordinate) |
||
|
End of the arrow (X coordinate) |
||
|
End of the arrow (Y coordinate) |
||
|
Thickness of the arrow |
1 |
|
|
Color of the arrow |
||
Examples
draw_arrow(img(0), 100, 100, 200, 200, 2, "ff0000")
draw_arrow(img:img(0), x1:100, y1:100, x2:200, y2:200, color: "ff0000")
DRAW_CIRCLE
Draws a circle on the image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate of the center of the circle |
||
|
Y coordinate of the center of the circle |
||
|
Thickness of the arrow |
1 |
|
|
Color of the arrow |
||
Examples
draw_circle(img(0), 100, 100, 2)
draw_circle(img:img(0), cx:100, cy:100, color: "ff0000")
DRAW_EARTH
Draws the Earth on the image, to the scale of the solar disk
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate of the center of the Earth |
||
|
Y coordinate of the center of the Earth |
||
Examples
draw_earth(img(0), 100, 100)
draw_earth(img:img(0), x:100, y:100)
DRAW_GLOBE
Draws a globe whose orientation and diameter correspond to the detected solar parameters.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
P angle |
angle P |
|
|
b0 angle |
b0 |
|
|
Globe style. Possible values: equatorial_coords (N/S E/W corresponding to celestial N/S), solar_coords (N/S E/W corresponding to solar axes) |
equatorial_coords |
|
|
1 to correct the P angle (the axis passing through point P is vertical), 0 otherwise |
0 |
|
|
1 to draw the prominences measurement scale, 0 otherwise |
0 |
|
|
Angle, in degrees, at which the distance scale labels are placed |
45 |
|
Examples
draw_globe(img(0))
draw_globe(img:img(0), angleP: 0)
DRAW_OBS_DETAILS
Displays observation details on the image
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate |
50 |
|
|
Y coordinate |
50 |
|
|
Font size (-1 for auto) |
-1 |
|
Examples
draw_obs_details(img(0), 100, 100)
draw_obs_details(img:img(0), x:100, y:100)
DRAW_RECT
Draws a rectangle on the image.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate of the top left corner of the rectangle |
||
|
Y coordinate of the top left corner of the rectangle |
||
|
Width of the rectangle |
||
|
Height of the rectangle |
||
|
Thickness of the line |
1 |
|
|
Color of the line |
||
Examples
draw_rect(img(0), 100, 100, 300, 200)
draw_rect(img:img(0), left:100, top:100, color: "ff0000")
DRAW_SOLAR_PARAMS
Displays solar parameters on the image
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate |
top right |
|
|
Y coordinate |
top right |
|
Examples
draw_solar_params(img(0), 100, 100)
draw_solar_params(img:img(0), x:100, y:100)
DRAW_TEXT
Draws text on the image. The text can include the following variables:
-
%WAVELEN%: wavelength of the image in Angström (includes the shift from the reference wavelength) -
%PIXELSHIFT%: pixel shift applied -
%SHIFT%: shift applied (in Angström) -
%RAY%: name of the observed reference line -
%OBSERVER%: name of the observer -
%INSTRUMENT%: name of the instrument -
%TELESCOPE%: name of the telescope -
%DATE%: observation date (YYYY-MM-DD) -
%TIME%: observation time (HH:mm:ss UTC) -
%DATETIME%: observation date and time -
%CAMERA%: camera name -
%FOCAL_LEN%: focal length -
%APERTURE%: aperture -
%MOUNT%: mount name -
%ERF%: energy rejection filter -
%P_ANGLE%: P angle in degrees -
%B0_ANGLE%: B0 angle in degrees -
%L0_ANGLE%: L0 angle in degrees -
%CARRINGTON_ROT%: Carrington rotation number -
%FILENAME%: source SER file name -
%INPUT_FILES%: the number of processed files -
%KEPT_FILES%: the number of files kept after the image review -
%VAR_xxx%: the value of the script variablexxx, for example%VAR_inputFilesCount%
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
X coordinate, from the left. A negative value is counted from the right edge, and the text is right aligned. |
||
|
Y coordinate, from the top. A negative value is counted from the bottom edge, and the text is aligned to the bottom. |
||
|
Text to write |
||
|
Font size |
auto |
|
|
Color of the text |
||
Examples
draw_text(img(0), 100, 100, "Hello %OBSERVER%!")
draw_text(img:img(0), x:100, y:100, text:"Hello %OBSERVER%!", fs: 20)
draw_text(img:img(0), x:20, y:-20, text:"%DATE%", fs: 24)
draw_text(img:img(0), x:-20, y:-20, text:"%OBSERVER%", fs: 24)
Animations
ANIM
Creates an animation from a series of images.
Argument |
Required? |
Description |
Default value |
|
The list of images |
||
|
Delay between each frame (in ms) |
250 |
|
Examples
anim(range(0,10))
anim(images: range(0,10), delay: 100)
TRANSITION
Interpolates images between them. By default, the interpolation is linear and it will create exactly the specified number of images. However, if a unit is specified, then the behavior will be different: the number of steps corresponds to the number of images to create, for a given time unit, for the time elapsed between the two images. For example, if one image was taken at 10:00 and the other at 10:02, and the unit is ipm, that the number of steps is 10, then 20 images will be created. This allows creating smoother transitions when SER files were not recorded at regular intervals.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Number of intermediate images to generate. |
||
|
Interpolation type: |
linear |
|
|
Interpolation unit: |
||
Examples
transition(list(img(0), img(1)), 10)
transition(images: my_imges, steps: 10, type: ease_in, unit: 'ipm')
Stacking and mosaic composition
DEDISTORT
Allows to correct the distortion of an image. It has 2 distinct modes of use. In the first mode, it takes a reference image and an image to correct, as well as 3 optional parameters: the tile size, the sampling, and the sky background value. The returned image will be corrected as closely as possible to the reference image, making it usable for stacking, for example. In the second mode, it takes a list of images to correct and a list of already corrected images, in which case the correction parameters for each image are taken using the same index image in the list of already corrected images. This can be useful, for example, when calculating the distortion at the center of the line (shift 0) and wanting to apply the same corrections to images with different shifts. For best results, use consensus reference mode (stack_ref with select='consensus') combined with sparse=1.
Argument |
Required? |
Description |
Default value |
|
Reference image(s) |
||
|
Images to correct. |
||
|
Tile size |
32 |
|
|
Sampling. A value of 0.5 for a tile size of 32 pixels means that there will be a sample every 16 pixels. |
0.5 |
|
|
Sky background value. |
||
|
Number of distortion correction iterations. Each iteration applies an additional correction by comparing the result to the original reference image. |
1 |
|
|
Enables sparse interest-point based sampling (1=enabled, 0=disabled). Interest points are automatically selected based on image gradient. When this parameter is active, the 'sampling' parameter is ignored. |
0 |
|
|
Enables multi-scale mode (1=enabled, 0=disabled). When enabled, tiles of different sizes are used: large tiles in low-gradient areas, small tiles in high-gradient areas. Requires sparse > 0. |
0 |
|
|
Enables per-tile adaptive convergence in consensus mode (1=enabled, 0=disabled). When enabled, tiles that have already converged are frozen and skipped in subsequent iterations, significantly speeding up multi-iteration runs without quality loss. |
1 |
|
|
Super-resolution (drizzle) factor. Any value between 1 and 4 is accepted (e.g. 1.5, 2, 2.5, 3). Actual resolution gain only materializes under excellent seeing and with sufficient undersampling. Memory usage scales as factor² — at 4× the output uses 16× the memory of a native-resolution result. |
1.0 |
|
Examples
crop_rect(img(0), 1024, 1024)
crop_rect(img: img(0), width: 200, height: 200)
MOSAIC
Creates a mosaic of images.
Argument |
Required? |
Description |
Default value |
|
Images to be assembled. |
||
|
Tile size |
64 |
|
|
Sampling factor |
0.25 |
|
Examples
mosaic(some_images)
mosaic(images: some_images, ts: 128)
STACK
Stacks multiple images.
Argument |
Required? |
Description |
Default value |
|
Images to be stacked. |
||
|
Tile size |
32 |
|
|
Sampling factor |
0.5 |
|
|
Method for selecting the best image. Can be |
sharpness |
|
Examples
stack(some_images)
stack(some_images, 64; .5; "eccentricity")
stack(images: some_images, ts: 128, sampling: 0.5, select: "sharpness")
STACK_DEDIS
Stacks de-distorted images by applying a weight to each image. The weight is calculated based on the de-distortion error: images requiring strong distortion correction will have a lower weight.
Argument |
Required? |
Description |
Default value |
|
Images to be stacked. |
||
|
Fraction of the best images to be stacked. |
1 |
|
|
Enables local distortion analysis (1=enabled, 0=disabled). If enabled, the images to be considered and their weight are calculated pixel by pixel based on the local distortion error. This method can yield better results, but they are not guaranteed. It may be wise not to keep 100% of the images for this method. |
0 |
|
Examples
stack_dedis(some_images)
stack_dedis(images: some_images)
stack_dedis(images: some_images, local: 1)
STACK_REF
Selects a reference image for stacking. For best results, use consensus mode combined with sparse=1 in the dedistort function.
Argument |
Required? |
Description |
Default value |
|
Images to be stacked. |
||
|
Method for selecting the best image. Can be |
sharpness |
|
Examples
stack_ref(some_images)
stack_ref(some_images, "eccentricity")
stack_Ref(images: some_images, select: "sharpness")
Masking
ANNULUS_MASK
Creates an annulus-shaped mask around the solar disk, with radii expressed in solar radii. The mask can be passed to the functions which accept a mask parameter (percentile_stretch, mtf_autostretch, …) to restrict the pixels taken into account when computing their statistics, while still transforming the entire image. Use rmin=0 for a disk mask. Requires a detected solar disk.
Argument |
Required? |
Description |
Default value |
|
Inner radius of the annulus, in solar radii (default: 0) |
||
|
Outer radius of the annulus, in solar radii (default: infinite) |
||
Examples
annulus_mask(rmin: 1.05, rmax: 1.2)
annulus_mask(0, 1)
DISK_MASK
Creates a mask of the solar disk, where pixels inside the disk will have the value 1, against 0 for those outside the disk. It is possible to invert (0 inside, 1 outside) by passing 1 as the 2nd parameter of the function.
Argument |
Required? |
Description |
Default value |
|
Image(s) |
||
|
Inversion of the mask (1 means value 0 inside, 1 outside) |
0 |
|
Examples
disk_mask(img(0))
disk_mask(img: img(0), invert: 1)
INVERT_MASK
Inverts a mask created by annulus_mask or range_mask: excluded pixels become included and conversely. Inverting twice returns the original mask.
Argument |
Required? |
Description |
Default value |
|
Mask to invert |
||
Examples
invert_mask(annulus_mask(0, 1))
RANGE_MASK
Creates a mask selecting the pixels whose value lies between lo and hi (bounds included). The mask can be passed to the functions which accept a mask parameter (percentile_stretch, mtf_autostretch, …) to restrict the pixels taken into account when computing their statistics, while still transforming the entire image.
Argument |
Required? |
Description |
Default value |
|
Lowest selected pixel value (default: 0) |
||
|
Highest selected pixel value (default: infinite) |
||
Examples
range_mask(lo: 1000, hi: 30000)
range_mask(0, 5000)
Control Structures
IFEQ
Returns 'then' if 'subject' equals 'value', otherwise returns 'else'. Supports comparisons of numbers, strings, and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number, string, or image) |
||
|
Comparison value (number, string, or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
ifeq(1; 1; img(0); img(1))
ifeq(subject:x, value:0, then:img(0), else:img(1))
ifeq(img(0); 0; 100; img(0))
IFGT
Returns 'then' if 'subject' is greater than 'value', otherwise returns 'else'. Supports comparisons of numbers and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number or image) |
||
|
Comparison value (number or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
ifgt(5; 3; img(0); img(1))
ifgt(subject:x, value:0, then:img(0), else:img(1))
ifgt(img(0); 1000; img(0); 0)
IFGTE
Returns 'then' if 'subject' is greater than or equal to 'value', otherwise returns 'else'. Supports comparisons of numbers and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number or image) |
||
|
Comparison value (number or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
ifgte(5; 5; img(0); img(1))
ifgte(subject:x, value:0, then:img(0), else:img(1))
ifgte(img(0); 1000; img(0); 0)
IFLT
Returns 'then' if 'subject' is less than 'value', otherwise returns 'else'. Supports comparisons of numbers and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number or image) |
||
|
Comparison value (number or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
iflt(3; 5; img(0); img(1))
iflt(subject:x, value:0, then:img(0), else:img(1))
iflt(img(0); 100; 0; img(0))
IFLTE
Returns 'then' if 'subject' is less than or equal to 'value', otherwise returns 'else'. Supports comparisons of numbers and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number or image) |
||
|
Comparison value (number or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
iflte(3; 5; img(0); img(1))
iflte(subject:x, value:0, then:img(0), else:img(1))
iflte(img(0); 100; 0; img(0))
IFNEQ
Returns 'then' if 'subject' is not equal to 'value', otherwise returns 'else'. Supports comparisons of numbers, strings, and images. For images, the condition must be true for all pixels. Both 'then' and 'else' values are always computed, regardless of the comparison result.
Argument |
Required? |
Description |
Default value |
|
Value to compare (number, string, or image) |
||
|
Comparison value (number, string, or image) |
||
|
Value returned if the condition is true |
||
|
Value returned if the condition is false |
||
Examples
ifneq(1; 0; img(0); img(1))
ifneq(subject:x, value:0, then:img(0), else:img(1))
ifneq(img(0); 0; img(0); 100)