dip::Framework::ProjectionFunction class

Prototype line filter for dip::Framework::Projection.

An object of a class derived from ProjectionFunction must be passed to the projection framework. The derived class can be a template class, such that the line filter is overloaded for each possible pixel data type.

A derived class can have data members that hold parameters to the projection function, that hold output values, or that hold intermediate buffers. The SetNumberOfThreads method is called once before any processing starts. This is a good place to allocate space for temporary buffers, such that each threads has its own buffers to write in. Note that this function is called even if dip::Framework::ProjectionOption::NoMultiThreading is given, or if the library is compiled without multi-threading.

The GetNumberOfOperations method is called to determine if it is worthwhile to start worker threads and perform the computation in parallel. This function should not perform any other tasks, as it is not guaranteed to be called. It is not important that the function be very precise, see Multithreading.

Constructors, destructors, assignment and conversion operators

~ProjectionFunction() defaulted virtual
A virtual destructor guarantees that we can destroy a derived class by a pointer to base

Functions

void Project(dip::Image const& in, dip::Image const& mask, dip::Image::Sample& out, dip::uint thread) pure virtual
The filter to be applied to each sub-image, which fills out a single sample in out. The out sample is of the outImageType type requested in the call to Projection.
void SetNumberOfThreads(dip::uint ) virtual
The derived class can define this function if it needs this information ahead of time.
auto GetNumberOfOperations(dip::uint nPixels) -> dip::uint virtual
The derived class can define this function for helping to determine whether to compute in parallel or not. It must return the number of clock cycles per sub-image. The default is valid for a trivial projection operation such as max or mean.