30#include <mlMetaProfilePtr.h>
35#define ML_ADD_FIELD(NAME_P, TYPE_P, VALUE_P) \
36(static_cast<TYPE_P##Field*> (this->addField(NAME_P, #TYPE_P, VALUE_P)));
47class ProcessAllPagesHandler;
179public:
Module(
int numInputImages,
int numOutputImages);
453 void* progressCallbackUserData =
nullptr);
463 void* progressCallbackUserData =
nullptr);
515 const std::string& errorResult=
"");
584 return outputSubImageBox;
667 void* progressCallbackUserData =
nullptr);
679 void* progressCallbackUserData =
nullptr);
690 void* progressCallbackUserData =
nullptr);
793private:
void setWasVisited(
bool flag) { _visitedFlag = flag; }
796private:
bool wasVisited() {
return _visitedFlag; }
805 bool _addBaseOp(Module& module);
810 MLint _removeBaseOp(Module& module);
815 std::vector <OutputConnectorField*> _outputConnectorFields;
818 std::vector <InputConnectorField*> _inputConnectorFields;
821 THREAD_SUPPORT _threadSupport;
829 MLint _handleNotificationEntryCounter;
834 bool _permitRecursiveHandleNotifications;
840 PERMITTED_TYPES _permittedTypes;
846 MLint _handleNotificationBlockCounter;
849 mutable MLMetaProfilePtr _metaProfilePtr;
852 static std::vector<Module*> _instantiatedModules;
865 const char*
getTypeNameFast()
const {
return getTypeId() ? getTypeId()->getName() :
"<unregistered_module>"; }
880 pushModuleForDiagnosis = pushCallback;
881 popModuleForDiagnosis = popCallback;
885 static DiagnosisModuleStackCallback pushModuleForDiagnosis;
886 static DiagnosisModuleStackCallback popModuleForDiagnosis;
FieldContainer()
Constructor.
Strength
Enumeration type describing the strength of notifications.
~ModuleDiagnosisStackScope()
ModuleDiagnosisStackScope(Module *module)
void(* DiagnosisModuleStackCallback)(void *)
static void setCallbacksForDiagnosisModuleStack(DiagnosisModuleStackCallback pushCallback, DiagnosisModuleStackCallback popCallback)
static void adaptPageExtent(ImageVector &pageExtent, MLDataType imageType, const ImageVector &newImgExtent, const ImageVector &oldImgExtent, const ImageVector &pageUnit=ImageVector(0), const ImageVector &minPageExtent=ImageVector(0), const ImageVector &maxPageExtent=ImageVector(0))
PagedImage * getOutputImage(MLint outputIndex=0) const
Returns the output image outputIndex. The index needs to be in the range [0, getNumOutputImages()-1].
static void updateProgress(const char *info1, const char *info2)
For documentation see Host::updateProgress().
const char * getTypeNameFast() const
InputConnectorField * getInputImageField(MLint i) const
Returns the field representing input image i. i must be a valid index.
void handleNotificationOff()
bool isHandleNotificationOn()
Returns true if handleNotification calls are permitted; otherwise, it returns false.
bool isSupportedVoxelDataType(MLDataType dt) const
MLint getOutputImageInplace(MLint outputIndex=0) const
OutputConnectorField * addOutputImage(const char *name=nullptr)
virtual void calculateOutputImageProperties(int outputIndex, PagedImage *outputImage)
MLErrorCode processAllPages(ProcessAllPagesHandler &handler, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
void setOutputImageInplace(MLint outputIndex=0, MLint inputIndex=0)
InputConnectorField * addInputImage(const char *name=nullptr)
void touchOutputImageFields() const
Touches all output image fields to indicate that the images have changed.
INPUT_HANDLE
See documentation of handleInput.
Module(int numInputImages, int numOutputImages)
MLErrorCode processMissingPages(int outputIndex=0, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
virtual void beginSaveFields()
static std::string getVoxelValueAsString(PagedImage *image, const ImageVector &position, MLErrorCode *errorCode=nullptr, const std::string &errorResult="")
void setClampPagesToImageExtent(bool flag=true)
void permitRecursiveHandleNotifications(bool enable)
INPUT_STATE
See documentation of handleInput.
@ CONNECTED_BUT_NEEDS_UPDATE
INPUT_STATE getInputState(MLint index)
void setBypass(MLint outputIndex=0, MLint inputIndex=0)
void setThreadSupport(THREAD_SUPPORT supportMode)
bool isInputImageField(Field *field) const
static bool shouldTerminate()
For documentation see Host::shouldTerminate().
void handleNotificationOn()
MLint getHandleNotificationEntryCounter() const
bool areRecursiveHandleNotificationsPermitted() const
void setVoxelDataTypeSupport(PERMITTED_TYPES permTypes)
virtual CalculateOutputImageHandler * createCalculateOutputImageHandler(PagedImage *outputImage)
PERMITTED_TYPES
See documentation of setVoxelDataTypeSupport.
MLint getNumInputImages() const
Returns the number of input images of this module.
friend class ModuleCalculateOutputImageHandler
friend class Host
Permit other classes access to protected methods.
MLint getNumOutputImages() const
Returns the number of output images of this module.
static Module * getModule(size_t index)
Returns a pointer to instantiated module index.
@ IO_THREAD
The calculation of the image data can be called from a designated I/O thread.
@ NO_THREAD_SUPPORT
The module is not thread-safe at all.
@ MULTITHREADED
The calculation of the image data can be called from multiple threads.
static Field * getPressedNotifyField()
For documentation see Host::getPressedNotifyField().
static MLErrorCode getTile(PagedImage *image, SubImageBox loc, MLDataType datatype, void **data, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
PagedImage * getUpdatedInputImage(MLint inputIndex, bool getReal=false) const
virtual void endSaveFields()
MLint getBypass(MLint outputIndex=0) const
virtual void calculateOutputSubImage(SubImage *outputSubImage, int outputIndex, SubImage *inputSubImages)
static void freeTile(void *data)
For documentation see Host::freeTile().
void unsetOutputImageInplace(MLint outputIndex=0)
static void destroyModule()
THREAD_SUPPORT getThreadSupport() const
static MLErrorCode getTile(PagedImage *image, SubImage &subimg, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
static MLint findModuleIndex(Module &module)
Returns the index of Module module. If not found, -1 is returned.
void clearOutputImage(MLint i=0)
Clears cached output image pages of output image i.
static MLErrorCode updateImageProperties(PagedImage *image)
void handleNotificationInternal(Field *field, FieldSensor::Strength strength) override
OutputConnectorField * getOutputImageField(MLint i=0) const
Returns the field representing output image i. i must be a valid index.
virtual SubImageBox calculateInputSubImageBox(int, const SubImageBox &outputSubImageBox, int)
MLErrorCode processAllPages(int outputIndex=-1, SubImageBox region=SubImageBox(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
static size_t getNumModules()
Returns the number of instantiated modules.
virtual void provideCustomPage(int, const SubImageBox &, MLMemoryBlockHandle &)
PagedImage * getInputImage(MLint inputIndex, bool getReal=false) const
virtual void handleNotification(Field *)
PERMITTED_TYPES getVoxelDataTypeSupport() const
MLMetaProfilePtr & getMetaProfile() const
Returns the metaprofile for the base operator.
INPUT_STATE getUpdatedInputState(MLint index)
virtual INPUT_HANDLE handleInput(int, INPUT_STATE) const
@ MULTITHREADED
< The calculation of the image data can be called from multiple threads.
@ IO_THREAD
< The calculation of the image data can be called from a designated I/O thread.
@ NO_THREAD_SUPPORT
< The image can only be calculated from the main thread.
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
Defines basic macros.
#define ML_ABSTRACT_CLASS_HEADER(className)
MLint32 MLErrorCode
Type of an ML Error code.
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
void MLRequestProgressCB(void *usrData, double progress)
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.