Autodocs
Below are automatically generated documents for certain entities in PCOT. The text in them is extracted from the Python source code, usually from "docstring" comments to classes or functions.
They are generated by running the generate_autodocs.py script in the mkdocs directory.
Nodes
Nodes are the entities which make up a PCOT document's graph, taking inputs from various sources and manipulating them in various ways.
- PCT Patch Detection
- banddepth
- circle
- comment
- constant
- contrast stretch
- croproi
- crosscalib
- curve
- decorr stretch
- dqmod
- dummy
- edge
- errortest
- example
- expr
- gen
- gradient
- histequal
- histogram
- importroi
- in
- input 0
- input 1
- input 2
- input 3
- inset
- manual register
- mergetests
- multidot
- normimage
- offset
- out
- painted
- pct
- pixtest
- poly
- rect
- roidq
- roiexpr
- scalartest
- sink
- spectrum
- stitch
- stringtest
- striproi
- tvl1 autoreg
Expr functions
Below are functions which can be used in the expression evaluation node, expr.
name | params | opt. params (default in brackets) | description |
---|---|---|---|
abs | a | Calculate absolute value | |
addroi | img,r | Add an ROI to an image's ROIs | |
clamp | img | clamp all channels of an image to 0-1 | |
cos | a | Calculate cosine of an angle in radians | |
crop | img,x,y,w,h | Crop an image to a rectangle | |
curve | img | mul (1),add (0) | impose a sigmoid curve on an image, y=1/(1+e^-(m(x-0.5)+a))) where m and a are parameters. Note from that equation that x is biased, so that x=0.5 is the inflection point if c=0. |
dqset | img,bits | sets DQ bits | |
flat | val... | Turns a list of vectors, images and numbers into a single vector, by flattening each into a 1D vector and concatenating them all together. Data with any of the dq.BAD bits is removed. | |
fliph | img | Flip an image horizontally | |
flipv | img | Flip an image vertically | |
grey | img | opencv (0) | Greyscale conversion. If the optional second argument is nonzero, and the image has 3 channels, we'll use CV's conversion equation rather than just the mean. However, this loses uncertainty information. Otherwise uncertainty is calculated by adding together the channels in quadrature and then dividing the number of channels. |
interp | img,factor | w (-1) | Using trilinear interpolation, generate an image by interpolating between the bands of an existing image. If an ROI is attached, the image generated will be interpolated from the pixels in the ROI. The width of the image will be either given in an optional parameter, or will be the same as the input image. WARNING - IS VERY SLOW |
makeunc | v1,u1,v2,u2 | ||
marksat | img | mn (0),mx (1.0) | mark pixels outside a certain range as SAT or ERROR in the DQ bits. Pixels outside any ROI will be ignored, as will any pixels already marked as BAD. |
max | val | Find the maximum of a Datum. For a multiband image, returns a vector of the maximum of each band. For a single band image, a scalar, or a vector, returns a scalar. Pixels with "bad" DQ bits will be ignored. See also the | |
mean | val | Find the meanĀ±sd of a Datum. This does different things depending on what kind of Datum we are dealing with. For a scalar, it just returns the scalar. For a vector, it returns the mean and sd of the vector. For an image, it returns a vector of the means and sds of each channel. Pixels with "bad" DQ bits will be ignored. | |
merge | img1... | merge a number of images into multiple bands of a single image. If the image has multiple bands they will all become bands in the new image. | |
min | val | Find the minimum of a Datum. For a multiband image, returns a vector of the minimum value of each band. For a single band image, a scalar, or a vector, returns a scalar. Pixels with "bad" DQ bits will be ignored. See also the & (AND) operator, which will find the minimum of two values (or images, vectors etc). | |
nominal | d | If input is an image, create an image made up of the nominal (mean) pixel values for all bands - i.e. an image with no uncertainty; if input is numeric, output the nominal value. Ignores ROIs. | |
norm | img | splitchans (0) | normalize all channels of an image to 0-1, operating on all channels combined (the default) or separately |
resize | img,width,height | method (linear) | Resize an image to a new size using OpenCV's resize function. The method is one of: "nearest", "linear", "cubic", "area", "lanczos4" mapping to the OpenCV constants cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS |
rgb | img | create a 3-channel image consisting of the current RGB mapping of the input image. NOTE: changing the mapping on a node does NOT cause the downstream nodes to run - you will have to click "Run All" to make an expr node with rgb() recalculate itself. | |
roi | img | Extract a single combined ROI from all ROIs on the image. If no ROIs are present, will return a single rectangular ROI covering the entire image. | |
rotate | img,angle | Rotate an image anti-clockwise by an angle in degrees. The angle must be a multiple of 90 degrees. | |
sd | val | Find the SD of a Datum. This does different things depending on what kind of Datum we are dealing with. For a scalar, it just returns 0. For a vector or single-channel image, it returns a scalar. For an image, it returns a vector of the SDs of each channel. Because each individual value in the input set can have its own uncertainty, the uncertainty is pooled (the pooled variance is the mean of the variances plus the variance of the means). Pixels with "bad" DQ bits will be ignored. | |
setcwl | img,cwl | Given a 1-band image, create a 'fake' filter with a given centre wavelength and assign it. The transmission of the filter is 1.0, and the fwhm is 30. The image itself is unchanged. This is used in testing only. | |
sin | a | Calculate sine of an angle in radians | |
sqrt | a | Calculate square root | |
striproi | img | Strip all regions of interest from an image | |
sum | val | Find the sum of a Datum. For a multiband image, returns a vector of the sums of each band. For a single band image, a scalar, or a vector, returns a scalar. The uncertainty is pooled differently as this is a sum. The variance will be the variance of the means plus the sum of the variances. Pixels with "bad" DQ bits will be ignored. | |
tan | a | Calculate tangent of an angle in radians | |
testf | arg1,arg2 | This "docstring" is mandatory in datumfuncs, because it contains the description and argument types. The function calculates a+2*b, correctly combining sources and propagating uncertainty. | |
testf2 | a | b (2) | Calculates a+b and a-b, creating a custom object to store that data. |
testimg | index | Load a test image | |
uncertainty | d | If input is an image, create an image made up of uncertainty data for all bands; if input is numeric, output the uncertainty. Ignores ROIs. | |
v | n,u | dqbits (0) | create a new value with uncertainty by combining two values. These can be either numbers or images. " Ignores and discards ROIs. |
vec | s1... | Create a 1D numeric vector from several scalars or vectors. |
Expr properties
Below are properties which can be used in the expression evaluation node, expr. Properties are names which can be used as identifiers on the right hand side of a "." operator, such as a.w to get the width of an image a.
name | type of x | desc |
---|---|---|
x.w | img | give the width of an image in pixels (if there are ROIs, give the width of the BB of the ROI union) |
x.w | roi | give the width of an ROI in pixels |
x.h | img | give the height of an image in pixels (if there are ROIs, give the width of the BB of the ROI union) |
x.h | roi | give the width of an ROI in pixels |
x.n | img | give the area of an image in pixels (if there are ROIs, give the number of pixels in the ROI union) |
x.n | roi | give the number of pixels in an ROI |
x.n | number | give the number of items in a vector |
x.u | img | return an new image containing the uncertainties of the image's pixels |
x.u | number | return the uncertainty of the scalar or vector (if vector, individual uncertainties will be pooled). DQ is ignored. |
x.bands | img | return a vector of the centre wavelengths of each band in the image |