Core Optical, Inc.
FourierTransform SyncContext Property Industrial Strength, Scientific Grade
Get or sets the OnlineSynchronizationContext to which events raised by the current FourierTransform object will be posted.

Namespace: PrecisionImage.FrequencyDomainProcessing
Assembly: PrecisionImage (in PrecisionImage.dll) Version: (

public SynchronizationContext SyncContext { get; set; }

All events originating from PrecisionImage.NET objects are posted to the object's OnlineSynchronizationContext which by default is initialized to the OnlineSynchronizationContext of the thread in which the object is being instantiated. In the case of instantiation within a worker thread, the UI thread should retrieve it's own OnlineSynchronizationContext using Synchronization.Current and pass it to the worker thread. The worker thread can then assign this OnlineSynchronizationContext to whatever PrecisionImage.NET objects it creates. This guarantees that events are posted to - and handled by - the UI thread and not the worker thread (which can safely block until completion of the operation).

The following instantiates a FourierTransform object in a worker thread and sets its synchronization context to the UI thread for event handling:
using System.Threading;
using PrecisionImage;
using PrecisionImage.FrequencyDomainProcessing;

// Assume the following code is executed within the main (UI) thread:
SynchronizationContext UIthreadSyncContext = SynchronizationContext.Current;
// Later, in a background worker thread a FourierTransform object is instantiated: 
FourierTransform fft = new FourierTransform();

// Attach the UI thread's synchronization context (passed in to the worker thread). 
// All processing events are then posted to the UI thread for handling:
fft.SyncContext = UIthreadSyncContext;
See Also