27 #include <mlMetaProfilePtr.h>
32 #define ML_ADD_FIELD(NAME_P, TYPE_P, VALUE_P) \
33 (static_cast<TYPE_P##Field*> (this->getFieldContainer()->addField(NAME_P, #TYPE_P, VALUE_P)));
45 class ProcessAllPagesHandler;
162 friend class ModuleCalculateOutputImageHandler;
169 typedef
void (*DiagnosisModuleStackCallback)(
void*);
184 public:
Module(
int numInputImages,
int numOutputImages);
191 public: virtual ~
Module();
207 protected:
void setOutputImageInplace(
MLint outputIndex=0,
MLint inputIndex=0);
212 protected:
void unsetOutputImageInplace(
MLint outputIndex=0);
218 public:
MLint getOutputImageInplace(
MLint outputIndex=0) const;
227 protected:
void setBypass(
MLint outputIndex=0,
MLint inputIndex=0);
232 public:
MLint getBypass(
MLint outputIndex=0) const;
245 CALC_OUTSUBIMAGE_ON_ALL_TYPES = PagedImage::MULTITHREADED
246 #endif // ML_DEPRECATED
251 protected:
void setThreadSupport(THREAD_SUPPORT supportMode);
255 public: THREAD_SUPPORT getThreadSupport()
const;
261 protected:
void permitRecursiveHandleNotifications(
bool enable);
265 public:
bool areRecursiveHandleNotificationsPermitted()
const;
272 public:
MLint getHandleNotificationEntryCounter()
const;
286 ONLY_STANDARD_TYPES = ONLY_SCALAR_TYPES,
287 FULLY_OPERATIONAL = ONLY_DEFAULT_TYPES,
288 MINIMUM_OPERATIONAL = ALL_REGISTERED_TYPES
306 protected:
void setVoxelDataTypeSupport(PERMITTED_TYPES permTypes);
311 public: PERMITTED_TYPES getVoxelDataTypeSupport()
const;
315 public:
bool isSupportedVoxelDataType(
MLDataType dt)
const;
328 public: std::string whoAmI(
bool withInstanceName=
true)
const;
342 CONNECTED_BUT_INVALID = 1,
343 CONNECTED_AND_VALID = 2,
344 CONNECTED_BUT_NEEDS_UPDATE = 3,
347 UNDEFINED_CLOSED = CONNECTED_BUT_INVALID
354 ALLOW_INVALID_INPUT = 2,
356 REDIRECT_TO_DUMMY_OP = 1,
396 public: INPUT_STATE getInputState(
MLint index);
402 public: INPUT_STATE getUpdatedInputState(
MLint index);
419 MLint getNumInputImages()
const;
422 MLint getNumOutputImages()
const;
454 public:
PagedImage* getInputImage(
MLint inputIndex,
bool getReal=
false)
const;
468 public:
PagedImage *getUpdatedInputImage(
MLint inputIndex,
bool getReal=
false);
505 static
void freeTile(
void* data);
508 static
void updateProgress(const
char* info1, const
char* info2);
511 static
bool shouldTerminate();
514 static
Field* getPressedNotifyField();
526 static
void adaptPageExtent (
ImageVector& pageExtent,
531 const ImageVector& minPageExtent = ImageVector(0),
532 const ImageVector& maxPageExtent = ImageVector(0));
548 const ImageVector& position,
550 const
std::
string& errorResult="");
621 return outputSubImageBox;
638 protected:
virtual void calculateOutputSubImage(
SubImage *outputSubImage,
int outputIndex,
SubImage *inputSubImages);
698 public:
MLErrorCode processAllPages(
int outputIndex = -1,
711 public:
MLErrorCode processMissingPages(
int outputIndex = 0,
723 public:
void clearOutputImage(
MLint i=0);
727 public: MLMetaProfilePtr& getMetaProfile() const;
732 static
void setCallbacksForDiagnosisModuleStack(DiagnosisModuleStackCallback pushCallback, DiagnosisModuleStackCallback popCallback)
734 pushModuleForDiagnosis = pushCallback;
735 popModuleForDiagnosis = popCallback;
744 protected:
void handleNotificationOff();
748 protected:
void handleNotificationOn();
751 protected:
bool isHandleNotificationOn();
761 public:
bool isInputImageField(
Field* field)
const;
764 public:
void touchOutputImageFields()
const;
813 public:
static size_t getNumModules();
816 public:
static Module* getModule(
size_t index);
819 public:
static MLint findModuleIndex(
Module& module);
823 public:
static void destroyModule();
830 private:
void setWasVisited(
bool flag) { _visitedFlag = flag; }
833 private:
bool wasVisited() {
return _visitedFlag; }
842 bool _addBaseOp(Module& module);
847 MLint _removeBaseOp(Module& module);
852 std::vector <OutputConnectorField*> _outputConnectorFields;
855 std::vector <InputConnectorField*> _inputConnectorFields;
858 THREAD_SUPPORT _threadSupport;
866 MLint _handleNotificationEntryCounter;
871 bool _permitRecursiveHandleNotifications;
877 PERMITTED_TYPES _permittedTypes;
883 MLint _handleNotificationBlockCounter;
886 mutable MLMetaProfilePtr _metaProfilePtr;
889 static std::vector<Module*> _instantiatedModules;
891 static DiagnosisModuleStackCallback pushModuleForDiagnosis;
892 static DiagnosisModuleStackCallback popModuleForDiagnosis;
905 virtual InputConnectorField* addInputConnector(const
char* name, Module* module,
MLint i);
911 virtual OutputConnectorField* addOutputConnector(const
char* name, Module* module,
MLint i);
924 protected:
void setMemoryOutputControl(
MLint outputIndex,
bool manually);
928 public:
bool getMemoryOutputControl(
MLint outputIndex)
const;
937 const std::string &errResult=
"")
939 return getVoxelValueAsString(op.
getOutputImage(outIdx), pos, errCode, errResult);
976 bool *isValidInputRet,
979 MLint *inOpIndexRet);
1018 adaptPageExtent(pageExt, imgType, newImgExt, oldImgExt, pageUnit, minPageExt, maxPageExt);
1057 #endif // ML_DEPRECATED
1061 #ifdef ML_DEPRECATED
1064 #define calcOutImageProps calculateOutputImageProperties
1067 #define calcInSubImageBox calculateInputSubImageBox
1070 #define calcOutSubImage calculateOutputSubImage
1073 #define typedCalcOutSubImage typedCalculateOutputSubImage
1077 #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
1078 #pragma deprecated("calcOutImageProps", "calcInSubImageBox", "calcOutSubImage", "typedCalcOutSubImage")
1081 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1088 template<
typename CauseAnErrorIfNotSpecified>
1089 class calcInSubImageProps_has_been_removed_from_the_ML {
1093 #define calcInSubImageProps(a,b,c) calcInSubImageProps() { calcInSubImageProps_has_been_removed_from_the_ML; };
1099 #pragma warning(push)
1100 #pragma warning(disable : 4996 )
1108 BaseOp(
int numInputImages,
int numOutputImages):
Module(numInputImages, numOutputImages)
1116 #pragma warning(pop)
1121 #endif // ML_DEPRECATED
1126 #endif //of __mlModule_H
INPUT_HANDLE
See documentation of handleInput.
MLint32 MLDataType
MLDataType.
virtual void beginSaveFields()
Called before all fields data contents of this modules are saved.
Base class for the calculation of pages of an output image (PagedImage) of a Module.
static std::string getVoxelValueAsString(Module &op, MLint outIdx, const ImageVector &pos, MLErrorCode *errCode=NULL, const std::string &errResult="")
INPUT_STATE
See documentation of handleInput.
Class representing general ML objects that support import/export via strings (setPersistentState() an...
virtual SubImageBox calculateInputSubImageBox(int, const SubImageBox &outputSubImageBox, int)
Called by the Host to determine which input image region (tile) of input inputIndex is required to ca...
Classic ML host used internally to calculate getTile and processAllPages requests.
virtual void endSaveFields()
Called after saving all field contents of this module.
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
The Host is the central image processing class in the ML.
OutputConnectorField * getOutField(MLint i=0) const
Strength
Enumeration type describing the strength of notifications.
Derives a set of classes from the class Field, like StringField, IntField (and many more) for unified...
void clearOutImg(MLint i=0)
Defines the class FieldContainer to encapsulate a vector of fields for (see class Field)...
BaseOp(int numInputImages, int numOutputImages)
Class which represents an image, which manages properties of an image and image data which is located...
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
Macro to make a copy constructor and assignment private, to avoid copying and assigning of macros...
const FieldContainer * getConstFieldContainer() const
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
PagedImage * getUpdatedInImg(MLint i, bool getReal=false)
static size_t getNumBaseOps()
FieldContainer * getFieldContainer()
Returns a pointer to the container of all the module's fields.
MLint32 MLErrorCode
Type of an ML Error code.
PagedImage * getOutputImage(MLint outputIndex=0) const
Returns output image outputIndex. The index needs to be in the range [0, getNumOutputImages()-1].
Base class for handlers that are used for the Module::processAllPages facility.
Defines system-specific macros for this project/DLL.
virtual void calculateOutputImageProperties(int)
void unsetOutImgInplace(MLint outIndex=0)
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol...
MLint getInputNum() const
< The image can only be calculated from the main thread
< The calculation of the image data can be called from multiple threads
static void destroyBaseOp()
The strong handle of a MLMemoryBlock.
Defines the class ProcessAllPagesHandler.
A TileRequest either represents the input sub image that is needed by a PageRequest or if it is a roo...
const FieldContainer * getFieldContainer() const
Returns a constant pointer to the container of all the module's fields.
Base class for all fields used in the ML.
PagedImage * getOutImg(MLint i=0) const
THREAD_SUPPORT
Enumerator deciding whether and which type of multithreading is supported by this module...
PERMITTED_TYPES
See documentation of setVoxelDataTypeSupport.
void setOutImgInplace(MLint outIndex=0, MLint inIndex=0)
static MLint findBaseOpIndex(Module &op)
MLint getOutputNum() const
InputConnectorField * getInField(MLint i) const
virtual void handleNotification(Field *)
Called when any field data in the field container of this module is modified.
This file defines macros, which are inserted in classes to declare and implement additional class mem...
virtual void provideCustomPage(int, const SubImageBox &, MLMemoryBlockHandle &)
This method allows a Module to provide its own pages to the Host for the outputIndex output image...
Defines the class FieldContainer to encapsulate a vector of fields for (see class Field)...
ML_LINEAR_ALGEBRA_EXPORT typedef TImageVector< MLint > ImageVector
Defines the standard ImageVector type which is used by the ML for indexing and coordinates.
static void adaptPageExt(ImageVector &pageExt, MLDataType imgType, const ImageVector &newImgExt, const ImageVector &oldImgExt, const ImageVector &pageUnit=ImageVector(0), const ImageVector &minPageExt=ImageVector(0), const ImageVector &maxPageExt=ImageVector(0))
TSubImageBox< MLint > SubImageBox
Define the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
Field to encapsulate a pointer to an output connector which represents a module output.
Base class for an image processing module of the ML.
PagedImage * getInImg(MLint i, bool getReal=false) const
#define ML_ABSTRACT_CLASS_HEADER(className)
Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.
Contains the class PagedImage which represents an fragmented image which manages properties of an ima...
< The calculation of the image data can be called from a designated IO thread
Includes the basic ML stuff, like Vectors a small message output macro and singleton for the MLLinear...
virtual INPUT_HANDLE handleInput(int, INPUT_STATE) const
This method may be reimplemented to enable support for invalid input images on the module...
virtual void handleNotificationInternal(Field *, FieldSensor::Strength)
Called when field has changed.
virtual void calculateOutputImageProperties(int outputIndex, PagedImage *)
Set properties of output image outputImage with output index outputIndex.
This class manages/represents a rectangular 6d image region which is organized linearly in memory...