Core Optical, Inc.
Utilities ApplyCircularShift Method Industrial Strength, Scientific Grade
Applies a circular (periodic) shift to the data in the specified channel.

Namespace: PrecisionImage
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public static void ApplyCircularShift(
	SourceData sourceData,
	int channel,
	int xShift,
	int yShift
)

Parameters

sourceData
Type: PrecisionImage SourceData
A SourceData object containing the data to operate on.
channel
Type: OnlineSystem Int32
An OnlineInt32 type indicating the channel to operate on.
xShift
Type: OnlineSystem Int32
The size of the shift in the X (horizontal) direction. Positive values induce a shift to the right, negative values induce a shift to the left. Values greater in magnitude than the original data dimensions are wrapped periodically.
yShift
Type: OnlineSystem Int32
The size of the shift in the Y (vertical) direction. Positive values induce a shift upward, negative values induce a shift downward. Values greater in magnitude than the original data dimensions are wrapped periodically.
Exceptions

Remarks

Use this method to perform a spatially-periodic XY shift to the data in the specified channel. The operation is applied in-place and is non-destructive in the sense that the shift can be reversed using the same method to retrieve the original data image by simply shifting in the opposite direction(s).
Examples

The following applies a circular shift equal to 175 pixels to the right and 175 pixels upward:
using PrecisionImage;

// Load the image into a SourceData object: 
Uri imageUri              = new Uri("image.tif", UriKind.Relative);
TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource sourceImage  = decoder.Frames[0];
SourceData dataSource     = new SourceData(sourceImage, GammaEncoding.None);

// Apply circular shift: 
Utilities.ApplyCircularShift(dataSource, 0, 175, 175);

// Display result:
image.Source = datasource.GetChannelImage(GrayBitDepth.EightBit, 0, GammaEncoding.None);

The above example generates the following result:

See Also