Subsections:
[Show/Hide]- Image manipulation operations
- Auto crop image
- Get slice
- Get an arbitrarily oriented slice from an image
- Threshold an image
- Soft-threshold an image
- Soft-clip an image
- Apply a window function to an image
- Replicate an image
- Adapt an image
- Destroy image
- Copy image
- Convert an image
- Convert single 3D slice to 2D
- Convert 2D to single 3D slice
- Convert 3D to 4D
- Convert 4D to 3D
- Convert complex image to/from 2-channel stacked
- Convert complex image to/from 2-chan polar (amp/phase)
- Convert XY-Z stack to XY-T time series
- Convert XY-T time series to XY-Z stack
- Convert image dimensionality
- Copy and stretch image
- Copy part of image
- Copy a non-orthogonal line
- Add/Remove border
- Fill image border
- Extend a PSF
- Resample image
- Zoom image
- Rotate image
- Shift image in 3D
- Convert to isotropic sampling
- Mirror image
- Split a multichannel image into single channel images
- Join a two (multichannel) images into one multichannel image
- Get frame from a timeseries
- Put frame into a timeseries
- Combine two images in space or time
Image manipulation operations
Auto crop image
source autoCrop?-dataType raw | processed (raw)?.........Data type
?-crit value (1)?.........Relative criterion
?-incrLat value (0)?.........Lateral increase (%)
?-incrAx value (0)?.........Axial increase (%)
Returns: offset and span of object region.
Get slice
source slice -> destination
?-pos value (0)?.........Slice position
?-frame value (0)?.........Frame number
?-plane xy | xz | yz (xy)?.........Slice orientation
Returns: void.
This command copies a particular plane from a 3-D or 4-D image and converts it to a 2-D image.
See also: multiMIP, miniMIP and chan2rgba.
Get an arbitrarily oriented slice from an image
source freeSlice -> dest transf
?-frame value (0)?.........Frame number
?-q fast | best (fast)?.........Quality
?-roiOut image?.........Mask image
The transf argument is a tcl list of lists with a transformation matrix. See createTransfMatrix for more information.
Threshold an image
source thres -> <dest> <threshold value>?-value value (1)?.........Insert value
?-mode all | one (all)?.........Mode
?-chan value (0)?.........Selected channel
?-bin flag?.........Binary output
Returns: void.
thres assigns specified values to pixels in the destination when the corresponding pixel in the source is equal or larger than the threshold value; zero otherwise.
In case of multi channel data and -mode all the threshold for each channel is taken from the corresponding element of the threshold vector. In case of multi channel data and -mode one the threshold is taken from the first element so it is not necessary to construct a list.
Soft-threshold an image
source sthres -> <dest> <threshold vector>?-range vector (10.0 10.0 10.0 10.0)?.........Range per channel
?-shape linear | quadr | sin (sin)?.........Mode
?-mode all | one (all)?.........Mode
?-chan value (0)?.........Selected channel
Returns: void.
In case of multi channel data and -mode all the the threshold for each channel is taken from the corresponding element of the threshold vector. In case of multi channel data and -mode one the threshold is taken from the first element so it is not necessary to construct a list.
Read more on http://www.svi.nl/SoftThreshold.
Soft-clip an image
source sclip -> <dest> <threshold value>?-range value (10.0)?.........Range
?-shape linear | quadr | sin (sin)?.........Mode
?-subtract on | off (on)?.........Subtract clip level
Returns: void.
Apply a window function to an image
source window?-type gauss|hann|lanczos|block (hann)?.........Window function
?-gain value (1.0)?.........Amplitude
?-width vector (1.0 1.0 1.0 1.0)?.........Width dimension vector
?-offset vector (0.5 0.5 0.5 0.5)?.........Offset dimension vector
?-units mus|si|s|ou|im (im)?.........Units of the vector values
?-border?.........Add a border with the profile specified by 'type'
?-borderwidth vector (0.1 0.1 0.1 0.1)?.........Width of the border region
?-add?.........Additive
The window command applies a window function to the image. Type can be set using the -type option. Other options to configure the window function can be set using the -gain, -width and -offset options. In case the window function should be applied to the border of the image, use the -border option. To add the resulting image to the original image, use the -add option.
Returns: void.
Replicate an image
parent repl <name of new image>
?-c?.........Copy data
Returns: name of newly created image.
Note: There is no -> symbol in this command since the destination is not (yet) an image.
Adapt an image
parent adapt
?-type byte | int | float | complex | bin (float)?.........Basic data type
?-dim IndexVector (32 32 32 0 1)?.........Dimensions
?-chanspec stacked | packed (stacked)?.........Channel configuration
?-chan value (1)?.........Number of channels
Returns: void.
adapt adapts the datatype, dimensions, channel configuration and number of channels as specified. The contents are destroyed.
Destroy image
<image> del
Returns: void.
Copy image
source -> <dest>Returns: void.
Convert an image
image convert?-type bin | byte | int | float | complex | auto (float)?.........Basic data type
?-chanspec stacked | packed | single (stacked)?.........Channel config.
Returns: void.
The basic data types are: unsigned byte, signed integer, 32-bit float and 2 * 32-bit complex.
In auto mode the image is converted to the shortest datatype required to hold the image value range. Complex images are only converted in this mode when their imaginary part is completely zero.
Convert single 3D slice to 2D
image convert3d22dThis command enables you to convert a 3-D slice (a 3-D image with one of the dimensions having the value `1') into a 2-D image.
Returns: the dimension that is converted or -1 if no action took place since none of the dimensions has size 1.
Example: If a single z-slice (third dimension) is converted the return value is 2.
Convert 2D to single 3D slice
image convert2d23dThis command enables you to convert a 2-D image (like a single Tif) to a 3-D image with only one plane. You can find out what type of image you deal with by clicking on the down-arrow button in the thumbnail image and cycle through the image parameters. The z-size is 0 in the 2-D case and is 1 in the 3-D case.
Returns: the dimension that is converted, which is the value 2 in most of the cases since a z-plane (counting starts from 0 (x) ) is created, or -1 if no action took place since none of the dimensions has size 0.
Convert 3D to 4D
image convert3d24d?-z value (1)?.........New z dimension
Example: The original 32 x 32 x 32 x 0 (just regular 3-D) image b is converted to a time series 32 x 32 x 2 x 16 by the following command:
b convert3d24d -z 2
Returns: void.
Convert 4D to 3D
image convert4d23dReturns: void.
Stack all frames in the Z-direction.
Convert complex image to/from 2-channel stacked
image complex2stacked?-dir f | i (f)?.........Direction
Convert complex image to a 2-channel stacked image (-dir f) with the real part in channel 1 and the imaginary part in channel 1.
The inverse (-dir i) operation requires a 2-channel input image.
Returns: void.
Convert complex image to/from 2-chan polar (amp/phase)
source complex2polar -> <dest>?-dir f | i (f)?.........Direction
Convert complex image to a 2-channel stacked image (-dir f) with the amplitude in channel 1 and the phase in channel 1. The phase has range [0, 2p].
The inverse operation (-dir i) requires a 2-channel input image.
Returns: void.
Convert XY-Z stack to XY-T time series
image convertZ2TReturns: the dimension that is converted, which is the value 3 in most of the cases.
Convert XY-Z stack to XY-T time series (convert xy,z,t=1 to xy,z=0,t)
Convert XY-T time series to XY-Z stack
image convertT2ZReturns: the dimension that is converted, which is the value 3 in most of the cases.
Convert XY-T time series to XY-Z stack (convert xy,z=1,t to xyz)
Convert image dimensionality
image convertDim add|remove|z2t|t2zReturns: the dimension that is added or removed or -1 if no action took place.
Copy and stretch image
source cs -> destination
?-map normal | auto | log (auto)?.........Main mapping mode
?-negval?.........Show negative values
?-fromzero?.........Stretch from zero
?-link separate | linked (linked)?.........Link channels
Returns: void.
Copy part of image
source cp -> destination
?-srco IndexVector (0 0 0 0 0)?.........Source offset
?-desto IndexVector (0 0 0 0 0)?.........Destination offset
?-span IndexVector (1 1 1 1 1)?.........Span
?-promotion off | content | on (off)?.........Data promotion
?-noAdopt?.........Do not adopt the parameters of the parent
Returns: void.
When the source and destination have unequal data type by default the data type of the copied part is converted to that of the destination regardless of content.
To alter this behavior use the promotion option:
- off, data types unchanged; the copied block is converted to the data type of the destination regardless of content.
- on: destination data type is promoted if necessary.
- content: promotion of destination datatype depends on the value range within the copied block.
Example:
a cp -> b -span {10 10 10}
copies a 10 x 10 x 10 block at origin of image a into image b at origin.
Copy a non-orthogonal line
source cl -> destination <start vector> <end vector>
?-desto IndexVector (0 0 0 0 0)?.........Destination offset
?-dir x | y | z | t (x)?.........Direction
?-s value (1.0)?.........Sample interval (pixels)
?-q high | low | trunc (high)?.........Quality
?-promotion on | off (on)?.........Data promotion
Returns: void.
Add/Remove border
source border <index vector>?-mode manual | evenX | evenAll | optFFT (manual)?.........Mode
?-padding empty | linear | quadr | sin | gauss (empty)?.........Padding
?-scale value (1)?.........Shape scale
?-bg value (0)?.........Background
Returns: index vector of total added/removed border.
border adds or removes a border around an image. If -mode manual then a border is added or removed as specified by borderVector. borderVector specifies the total number of pixels added or removed for each dimension. If a border is added then the source image is centered in the new image. If a border is removed then the new image is the center part of the source image. The channel component of borderVector is ignored.
scale specifies the size of the selected shape relative to the size of the border in a particular dimension. Applies to shapes quadr and gauss. In the case of a quadratic border, 50% is reached a fraction scale of the border. In the case of a Gaussian border, 1/e is reached at a fraction scale of the border.
Example: Make a 30 x 20 x 70 image from an original 64 x 64 x 64 image:
imageName border {-34 -44 6 0}
Fill image border
source borderFill <index vector>?-padding bg | linear | quadr | sin | gauss (bg)?.........Padding
?-scale value (1)?.........Shape scale
?-bg vector (0 0 0 0)?.........Background
Returns: void.
borderFill provides similar filling of a border region as border, but does this in a border inside an image. The width of that border is specified with borderVector. bg is an array of background pixel values, one for each channel.
Extend a PSF
source extendpsf -> destination <index vector>
Returns: void.
Extend a PSF.
Resample image
source resample -> destination
?-zoom vector (1 1 1 1)?.........Zoom vector
?-gamma value (0)?.........Rotation angle (degrees)
?-phi value (0)?.........Axis lateral angle (degrees)
?-theta value (0)?.........Axis vertical angle (degrees)
?-pad asis | tight | full | dest (asis)?.........Resizing
?-q high | standard | low | trunc (standard)?.........Quality
?-centerMode center | origin | manual (center)?.........Centering mode
?-center vector (0 0 0 0)?.........Rotation center
?-translation vector (0 0 0 0)?.........Shift vector
Returns: void.
Zoom values > 1 increase the number of samples. The -q option has different methods on how to assign values to the newly created samples.
- standard quality: The new value is the result of linear interpolation in three dimensions.
- high quality is doing a best fit calculation based on FFT.
- low quality: a new sample adopts the value of its nearest neighbor.
- trunc: all resample tools are equipped with a smallest neighbor quality option.
The -center option is only in effect when -centerMode Manual is specified.
The voxel geometry will be adapted when a non-unity zoom is specified.
The rotation is specified as a rotation around an axis. The position and orientation of the axis is controlled through two angles and a position vector. The rotation around the axis itself is controlled with a single angle.
Example:
a resample -> b -zoom {3.3 2}
See also the simplified operations below: zoom, rotate, shift.
Zoom image
source zoom -> destination <vector>
?-q high | standard | low | trunc (standard)?.........Quality
Returns: void.
Zoom is the simplified form of 'Resample image'.
The quality factor -q is explained in resample.
Values > 1 increase the number of samples.
Example:
foo zoom -> foo {.2 .2 1} -q low
If the original dimensions of foo were {1500 1000 100}, the new foo is down-sampled to an image with dimensions {300 200 100}.
While zoom may increase or decrease the number of samples, the overall physical size of the image is unchanged because this tool will also adapt the voxel dimensions.
Rotate image
source rotate -> destination
?-axis x | y | z (z)?.........Principal axis
?-gamma value (0)?.........Rotation angle (degrees)
?-q high | standard | low | trunc (standard)?.........Quality
Returns: void.
The rotation is specified as a rotation around a principal axis. -gamma controls the rotation around the axis.
The quality factor -q is explained in resample.
Shift image in 3D
source shift -> destination <shift vector> Example: a shift -> b {3 2}
?-q high | standard | low | trunc (standard)?.........Quality
Returns: void.
Example:
a shift -> b {3 2}
In High Q mode shift remains fourier based and shows a wrap-around effect. In other quality modes there is no wrap around: out of data areas are considered zero. The quality factor -q is explained in resample.
Convert to isotropic sampling
image isosampling destination
?-q high | standard | low | trunc (standard)?.........Quality
Returns: zoom factors in all directions.
Convert image to isotropic sampling. The quality factor -q is explained in resample.
Mirror image
source mir x|y|z|tReturns: void.
Split a multichannel image into single channel images
source split?-mode all | one (all)?.........Mode
?-chan value (0)?.........channel
Returns: a list of names of the newly created images.
Join a two (multichannel) images into one multichannel image
source join <source2> -> destination
?-adaptSize query | smallest | largest (query)?.........Unequal dimensions mode
Returns: void.
The join command is able to join (stack) images of unequal dimension by either adapting to the largest or the smallest.
Note: the new image has the channels ordered with the channels of imageName1 first, then the channels of imageName2. Therefore, if you want to join three existing single channel images (chan0, chan1 and chan2) into a three-channel image (joined), the procedure is as follows (using a temporary image temp):
img create temp
img create joined
chan0 join chan1 -> temp
temp join chan2 -> joined
temp del
Get frame from a timeseries
source getframe -> <dest>?-frame value (0)?.........Frame number
?-chan value (0)?.........Channel number
?-mode all | one | oneInt | oneFloat (all)?.........Mode
Copy one frame from a multi channel time series.
If -mode is set to `one' the channel can be selected. It is also possible to convert the selected channel to a float image in one action using the `oneFloat' option.
Returns: void.
Put frame into a timeseries
source putframe -> <dest>?-frame value (0)?.........Frame number
?-chan value (0)?.........Channel number
?-mode all | one (all)?.........Mode
Put a frame into a multi-channel time series.
The first 3 dimensions of the frame must be equal to those of the time series. If the frame is multi-channel and the channel count matches the destination, all channels are copied. If the datatype of the frame is unequal to that of the series it is automatically converted using convert.
Returns: void
Combine two images in space or time
source combine <source2> -> destination
?-along x | y | z | t (x)?.........Combine along dimension
Returns: void.
Combine two images along a given spatial or temporal dimension, putting images side by side or one after the other in a time series.