40class ProcessAllPagesHandler;
42class PageRequestProcessorBase;
43class PageRequestProcessor;
44class ProcessingTimeLine;
49#define ML_HOST_UPDATE_PROGRESS_INTERVAL 0.3
253 void* progressCallbackUserData =
nullptr);
287 void* progressCallbackUserData =
nullptr);
307 void* progressCallbackUserData =
nullptr);
319 void* progressCallbackUserData =
nullptr);
328 void* progressCallbackUserData =
nullptr);
341 void* progressCallbackUserData =
nullptr);
353 void* progressCallbackUserData =
nullptr);
419 bool clearPages =
true,
421 void* progressCallbackUserData =
nullptr);
452 bool _insideUpdateProgress;
458 void* _breakCheckUserData;
467 MLint32 _restrictMaxNumThreads;
474 static unsigned int _memoryManagerId;
477 static Host* _instance;
485 bool _useClassicMLHost;
Classic ML host used internally to calculate getTile and processAllPages requests.
Base class for all fields used in the ML.
Base class for TileRequest based jobs.
The Host is the central image processing class in the ML.
MLErrorCode processAllPages(Module &module, ProcessAllPagesHandler &handler, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Processes input images with a ProcessAllPagesHandler on a temporary output image (which allocates no ...
void setMaxNumThreads(MLint32 numThreads)
Sets maximum number of permitted worker threads to numThreads.
MLErrorCode getTile(PagedImage &outputImage, SubImage &subImage, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Requests the image region subImage.getBox() from output image outputImage.
ProcessingTimeLine & getProcessingTimeLine()
Get access to the processing time line.
static void registerWithMemoryManager()
Registers the Host as library using the memory manager and initializes the memory manager id.
Field * getPressedNotifyField()
Checks if a notify button was pressed (outside of normal notification) It returns the notify field or...
bool shouldTerminate() const
Checks if current calculation should be terminated.
MLErrorCode processAllPagesWithInputImage(PagedImage &inputImage, ProcessAllPagesHandler &handler, const SubImageBox ®ion=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Processes all pages as specified by the handler using inputImage as single input.
void * getProgressCBUserData() const
Returns user data of current callback for progress/busy cursor updates.
MLint32 getMaxNumThreads() const
Returns maximum number of permitted worker threads.
void * getBreakCheckCBUserData() const
Returns user data of current callback for break checking.
bool getUseClassicHost() const
Returns if classic ML host is used.
MLHostProgressCB * getProgressCB() const
Returns current callback for progress/busy cursor updates.
MLHostBreakCheckCB * getBreakCheckCB() const
Returns current callback for break checking.
void _unsetProcessingActive()
Disables the flag that indicates active image processing.
void _setProcessingActive()
Enables the flag that indicates active image processing.
void enableTimeLineProfiling(bool flag)
Enable/disable time line profiling.
void freeTile(void *data)
Frees (image) memory which has been allocated with any getTile() function of the Host class.
MLErrorCode updateImageProperties(Module &module, MLint outputIndex)
/deprecated Updates the module graph under module and including the output image at outputIndex of mo...
void setUseClassicHost(bool flag)
Enable/disable usage of classic ML host.
static unsigned int getMemoryManagerId()
Returns the memory manager id that is used for allocation of memory by the ML.
MLErrorCode processMissingPages(Module &module, MLint outputIndex, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
See Module::processMissingPages() for details on this method.
ClassicHost * getClassicHostDebug()
Get access to classic ML host (for debugging purposes only!)
void updateProgress(const char *info1, const char *info2)
Calls the busy cursor/progress callback if it is set.
static SubImageBox calculateInputSubImageBoxDebug(Module &module, int inIndex, const SubImageBox &outputSubImageBox, int outputIndex)
This is a method that allows access to the (otherwise protected) calculateInputSubImageBox of a modul...
MLErrorCode processAllPagesWithInputImages(const std::vector< PagedImage * > &inputImages, ProcessAllPagesHandler &handler, const SubImageBox ®ion=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Processes all pages as specified by the handler using inputImages as inputs.
void setBreakCheckCB(void *userData, MLHostBreakCheckCB *callback)
Sets callback for break checking.
PageRequestProcessor * getPageRequestProcessor()
Get the currently responsible page request processor.
static Host & getDefaultHost()
Return a reference to the Host singleton.
void setProgressCB(void *userData, MLHostProgressCB *callback)
Sets callback for progress/busy cursor updates.
static void destroyDefaultHost()
Destroys and cleans up allocated memory of default Host.
MLErrorCode getTile(PagedImage &outputImage, SubImageBox location, MLDataType dataType, void **data, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Requests the image region location from the image outputImage.
virtual ~Host()
Destructor.
void setRestrictMaxNumThreads(MLint32 numThreads)
Restricts the maximum number of permitted worker threads to be lower or equal to numThreads.
MLint32 getRestrictMaxNumThreads() const
Get the restriction for setMaxNumThreads().
MLuint32 isProcessingActive() const
Non-zero return values mean that (image) processing is currently active.
MLErrorCode updateImageProperties(PagedImage &outputImage)
Updates the module graph under outputImage->getModule() and including outputImage.
MLErrorCode processAllPages(Module &module, MLint outputIndex, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
See Module::processAllPages() for details on this method.
Base class for an image processing module of the ML.
Class which represents an image, which manages properties of an image and image data which is located...
Base class for handlers that are used for the Module::processAllPages facility.
Stores a processing time line for multiple threads.
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
Defines basic macros.
MLint32 MLDataType
MLDataType.
MLint32 MLErrorCode
Type of an ML Error code.
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
MLint32 MLHostBreakCheckCB(void *usrData, void **hitField)
void MLRequestProgressCB(void *usrData, double progress)
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
void MLHostProgressCB(void *usrData, const char *info1, const char *info2)
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator "<<" for stream output of Field objects.