MeVisLab Toolbox Reference
mlPagedImage.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_PAGED_IMAGE_H
14 #define ML_PAGED_IMAGE_H
15 
34 
35 //ML-includes
36 #include "mlInitSystemML.h"
38 #include "mlMemoryImage.h"
39 
41 #include "mlModuleInterfaces.h"
42 
43 #include <mlMemoryBlockHandle.h>
45 
46 #include <unordered_map>
47 #include <vector>
48 
49 ML_START_NAMESPACE
50 
52 class PagedImageCurrentlyUsedMemoryTracker;
53 class Module;
54 class SubImage;
55 class PageRequest;
56 class TileRequest;
58 
59 
60 //------------------------------------------------------------------------------
64 //------------------------------------------------------------------------------
65 class ML_UNIX_ONLY_EXPORT(MLEXPORT) PagedImage: public MedicalImageProperties
66 {
68  struct PageEntry
69  {
71  PageRequest* pendingRequest{};
72  };
73 
74  struct ExtendedPageEntry;
75 
76 public:
79  NO_THREAD_SUPPORT = 0,
80  MULTITHREADED = 1,
81  IO_THREAD = 4,
82  USE_MODULE_THREAD_SUPPORT = -1
83  };
84 
86  friend class Host;
87 
88  // needed for testing protected API:
89  ML_FRIEND_TEST(PagedImageDeprecationTest, NewAPI);
90  ML_FRIEND_TEST(PagedImageDeprecationTest, DeprecatedAPI);
91  ML_FRIEND_TEST(TypedHandlersTest, SetupAndVerifyProperties);
92 
93  //------------------------------------------------------
96  //------------------------------------------------------
97 
105  MLEXPORT PagedImage(Module* module=nullptr, MLint outputIndex=-1);
106 
109  MLEXPORT ~PagedImage() override;
111 
113  inline CalculateOutputImageHandler* getCalculateOutputImageHandler() const { return _calculateOutputImageHandler; }
114 
118 
120  inline bool hasExternalCalculateOutputImageHandler() const { return _isExternalCalculateOutputImageHandler; }
121 
124 
127 
129  inline MLuint32 getID() { return _id; }
130 
132  inline void updateID() { _id = getUniqueId(); }
133 
134  //-------------------------------------------------------------------
137  //-------------------------------------------------------------------
143  inline bool isValid() const { return _isValid; }
144 
147  inline void setValid(bool flag = true) { _isValid=flag; }
148 
151  inline void setInvalid() { _isValid=false; }
152 
156 
159  MLEXPORT bool updateOfImagePropertiesNeeded() const { return _updateOfImagePropertiesNeeded; }
160 
162  [[nodiscard]]
164 
166 
167  //------------------------------------------------------
170  //------------------------------------------------------
171 
173  MLEXPORT virtual void setImageExtent(const ImageVector& extent);
174 
178  inline void setImageExtent(MLint x, MLint y, MLint z = 1, MLint c = 1, MLint t = 1, MLint u = 1) {
179  setImageExtent(ImageVector(x,y,z,c,t,u));
180  }
181 
185  inline void setImageExtent(const SubImageBox &box) { setImageExtent(box.getExtent()); }
186 
191  MLEXPORT virtual void setImageProperties(const PagedImage& imageProperties);
192 
194  MLEXPORT void setPageExtent(const ImageVector& pageExtent);
195 
206  inline void setClampPagesToImageExtent(bool flag = true) { _clampPagesToImageExtent = flag; }
207 
209  inline bool getClampPagesToImageExtent() const { return _clampPagesToImageExtent; }
210 
213  inline void setPageExtent(MLint x, MLint y, MLint z = 1, MLint c = 1, MLint t = 1, MLint u = 1) {
214  setPageExtent(ImageVector(x,y,z,c,t,u));
215  }
216 
218  MLEXPORT void setDataType(MLDataType dataType) override;
219 
222 
225 
227  MLEXPORT void setPage(MLint pageID, const MLMemoryBlockHandle& page);
228 
231  MLEXPORT void removePage(MLint pageID);
232 
236  MLEXPORT void deletePageEntryFromDeletionCallback(ExtendedPageEntry* entry);
237 
242 
249 
250 
251 
252  //------------------------------------------------------
255  //------------------------------------------------------
262  MLEXPORT virtual void setStateInfo(const std::string& info, MLErrorCode errorCode);
263 
270  MLEXPORT virtual void setStateInfoErrorCode(MLErrorCode errorCode);
271 
274  MLEXPORT virtual const std::string& getStateInfoString() const;
275 
280 
281  //---------------------------------------------------------------------------
284  //---------------------------------------------------------------------------
285 
291  inline void setBypassIndex(MLint index) { _bypassIndex = index; }
292 
295  inline MLint getBypassIndex() const { return _bypassIndex; }
297 
298 
299  //------------------------------------------------------
302  //------------------------------------------------------
303 
305  inline Module* getModule() const { return _module; }
306 
308  MLEXPORT const PagedImage* getInputImage(int inputIndex) const;
309 
311  inline MLint getOutputIndex() const { return _outIndex; }
312 
314  inline ImageVector getPageSetExtent() const { return _pageSetExt; }
315 
317  inline ImageVector getPageStride() const { return _pageStride; }
318 
320  inline ImageVector getPageExtent() const { return _pageExt; }
321 
323  inline MLint getPageID(const ImageVector& voxelPosition) const { return (voxelPosition/_pageExt).dot(_pageStride); }
324 
329  inline MemoryImage& getMemoryImage() { return _memoryImg; }
330  inline const MemoryImage& getMemoryImage() const { return _memoryImg; }
332 
337  MLEXPORT void setThreadSupport(ThreadSupport support) { _threadSupport = support; }
338 
343 
347 
354 
357 
360 
364 
367  MLEXPORT void getPageIDs(std::vector <MLint>& pageIDs, const SubImageBox& subImageBox) const;
368 
372  MLEXPORT static void getPageIDs(std::vector<MLint>& pageIDs,
373  const SubImageBox& subImageBox,
374  const ImageVector& imageExtent,
375  const ImageVector& pageExtent);
376 
378  MLEXPORT std::size_t getCachedPagesSizeInBytes() const;
379 
382  MLEXPORT MLint getNumPages() const { return _pageSetSize; }
383 
385 
386 
387  //---------------------------------------------------------------------------
390  //---------------------------------------------------------------------------
391 
400  inline void setInPlaceIndex(MLint inputIndex) { _inPlaceIndex = inputIndex; }
401 
409  inline MLint getInPlaceIndex() const { return _inPlaceIndex; }
411 
412 
413  //------------------------------------------------------
421  //------------------------------------------------------
422 
428  MLEXPORT void setInputSubImageDataType(int inputIndex, MLDataType dataType);
429 
437  MLEXPORT void setInputSubImageIsReadOnly(int inputIndex, bool readOnly);
438 
441  MLEXPORT void setInputSubImagesAreReadOnly(bool readOnly = true);
442 
458  MLEXPORT void setInputSubImageUseMemoryImage(int inputIndex, bool useMemoryImage);
459 
463  MLEXPORT void setInputSubImageScaleShift(int inputIndex, const ScaleShiftData& scaleShift);
464 
468 
471 
473  MLEXPORT bool getInputSubImageIsReadOnly(int inputIndex) const;
474 
476 
477  //------------------------------------------------------
480  //------------------------------------------------------
481 
482  //---------------------------------------------------------------------------------
492  //---------------------------------------------------------------------------------
493  MLEXPORT void copyPages(const std::vector<MLint>& pageIDs,
494  SubImage* subImage,
495  const ScaleShiftData& scaleShiftData=ScaleShiftData()) const;
497 
498 
499  //-------------------------------------------------------------------
502  //-------------------------------------------------------------------
507  [[nodiscard]]
509  MLDataType dataType,
510  void** data,
511  const ScaleShiftData& scaleShiftData=ScaleShiftData(),
512  MLRequestProgressCB* progressCallback = nullptr,
513  void* progressCallbackUserData = nullptr);
514 
519  [[nodiscard]]
520  MLEXPORT MLErrorCode getTile(SubImage& subImage, const ScaleShiftData& scaleShiftData=ScaleShiftData(),
521  MLRequestProgressCB* progressCallback = nullptr,
522  void* progressCallbackUserData = nullptr);
523 
525  MLEXPORT void freeTile(void* data);
526 
532  MLEXPORT MLdouble getInterpolatedValue(const Vector3& pos, MLint c = 0, MLint t = 0, MLint u = 0, MLdouble outsideFillValue = 0);
533 
535 
538 
540  MLEXPORT static void setPageCountLimitToUsePageEntryMap(MLuint32 limit) { _pageCountLimitToUsePageEntryMap = limit; }
541 
543  MLEXPORT static MLuint32 getPageCountLimitToUsePageEntryMap() { return _pageCountLimitToUsePageEntryMap; }
544 
545 protected:
548 
551 
554 
555 private:
557  static MLuint32 getUniqueId();
558 
560  MLEXPORT bool arePropertiesLocked() const { return _propertiesLocked; }
561 
563  MLEXPORT bool setPropertiesLocked(bool locked);
564 
566  inline bool _checkPropertyWriteAccess(const char* methodName) {
567  if (_propertiesLocked) {
568  _showInvalidPropertyWriteAccessError(methodName);
569  }
570  return !_propertiesLocked;
571  }
572 
574  void _showInvalidPropertyWriteAccessError(const char* methodName);
575 
576  PagedImage(const PagedImage&) = delete;
577  PagedImage& operator=(const PagedImage&) = delete;
578 
579 
580  //------------------------------------------------------
583  //------------------------------------------------------
588  void _updateAll();
589 
590 
592  void _allocatePageList();
594 
595 
596  void static deleteMemoryBlockCallback(void* data, size_t size, void* userData);
597 
598  /*
599  * Returns \c true if the registration was successfully; otherwise, it returns \c false.
600  */
601  static bool registerDeletionCallback(const ExtendedPageEntry* entry);
602 
603  /*
604  * This returns \c true if the ownership of the entry stays within this class.
605  */
606  static bool deregisterDeletionCallback(const ExtendedPageEntry* entry);
607 
608  static ExtendedPageEntry* deletePageEntryFromMapUnsafe(std::unordered_map<MLint, ExtendedPageEntry *> &pageEntryMap,
609  MLint pageId);
610 
611  //------------------------------------------------------
614  //------------------------------------------------------
615 
617  Module* _module;
618 
620  CalculateOutputImageHandler* _calculateOutputImageHandler;
621 
623  CalculateOutputImagePropertiesCB* _calculateOutputImageProperties;
625  void* _calculateOutputImagePropertiesUserData;
626 
628  bool _isExternalCalculateOutputImageHandler;
629 
632  MLint _outIndex;
633 
635  ImageVector _pageExt;
636 
638  ImageVector _pageStride;
639 
641  ImageVector _pageSetExt;
642 
644  MLint _pageSetSize;
645 
647  std::vector<PageEntry> _pageList;
648 
650  std::unordered_map<MLint, ExtendedPageEntry*> _pageEntryMap;
651 
653  mutable Mutex _pageAccessMutex;
654 
656  bool _pageHandlesAreStoredInList;
657 
663  MLint _inPlaceIndex;
664 
666  MLint _bypassIndex;
667 
669  bool _updateOfImagePropertiesNeeded;
670 
672  bool _isValid;
673 
677  bool _propertiesLocked;
678 
681  bool _clampPagesToImageExtent;
682 
685  MemoryImage _memoryImg;
686 
688  std::string _stateInfoString;
689 
691  MLErrorCode _stateInfoErrorCode;
692 
694  MLuint32 _id;
695 
697  std::vector<InputSubImageProperties> _inSubImageProps;
698 
700  ThreadSupport _threadSupport;
701 
704  mutable PagedImageCurrentlyUsedMemoryTracker* _currentlyUsedPageMemoryTracker;
705 
707  mutable MLMetaProfilePtr _metaProfilePtr;
709 
711  static MLuint32 _staticUniqueId;
712 
714  static MLuint32 _pageCountLimitToUsePageEntryMap;
715 
716 private:
718  static const char* const _pageAllocationMemoryProfileKey;
719  static const char* const _pageCacheHitsCountProfileKey;
720  static const char* const _pageCacheMissesCountProfileKey;
721 };
722 
723 ML_END_NAMESPACE
724 
725 // Stream output for std::ostream
726 namespace std {
727 
729  MLEXPORT std::ostream& operator<<(std::ostream& s, const ML_NAMESPACE::PagedImage &pi);
730 
731 }
732 
733 #endif //of __mlPagedImage_H
734 
735 
The strong handle of a MLMemoryBlock.
The pointer is automatically reset when the metaprofile is destroyed.
The weak handle of a MLMemoryBlock.
Base class for the calculation of pages of an output image (PagedImage) of a Module.
The Host is the central image processing class in the ML.
Definition: mlHost.h:115
MLEXPORT void setImageExtent(const ImageVector &extent)
Sets the extent of the (sub)image.
Defines the class InSubImageProps, a simple container for some properties that can be defined for an ...
This class encapsulates basic medical image properties:
MedicalImageProperties & operator=(const MedicalImageProperties &medicalImageProperties)
Assignment operator from an existing edicalImageProperties object to get a copy.
A memory cache for the complete output image of an output connector.
Definition: mlMemoryImage.h:49
Base class for an image processing module of the ML.
Definition: mlModule.h:151
A PageRequest represents the request for the calculation of a single page of a PagedImage.
Definition: mlPageRequest.h:32
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Definition: mlPagedImage.h:66
MLint getInPlaceIndex() const
Returns optimization flag: returns the index of the input image whose input tile is used also as outp...
Definition: mlPagedImage.h:409
MLEXPORT void setInputSubImageDataType(int inputIndex, MLDataType dataType)
Sets the dataType for the given inputIndex.
MLEXPORT PagedImage(Module *module=nullptr, MLint outputIndex=-1)
Constructor.
MLEXPORT void setMaxVoxelValue(MLdouble maxval)
Sets the assumed maximum value to maxval. Overridden to perform access check.
MLEXPORT void clearPendingPageRequest(MLint pageID)
Clears a pending page request for the given page ID.
virtual MLEXPORT void setStateInfo(const std::string &info, MLErrorCode errorCode)
Sets the state information for this PagedImage to the string info and the MLErrorCode errorCode.
MLEXPORT MLErrorCode getTile(SubImageBox location, MLDataType dataType, void **data, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
See Host::getTile( module, outputIndex, location, dataType, data, scaleShiftData).
MLEXPORT void clearPageList()
Removes all pages of the page image and from the ML cache, and all page data chunks are freed if not ...
const MemoryImage & getMemoryImage() const
Definition: mlPagedImage.h:330
bool isValid() const
Returns whether image properties are valid and up-to-date.
Definition: mlPagedImage.h:143
MLEXPORT MLdouble getInterpolatedValue(const Vector3 &pos, MLint c=0, MLint t=0, MLint u=0, MLdouble outsideFillValue=0)
Returns the trilinearly interpolated image value at a given voxel position pos (center of a voxel is ...
MLEXPORT SubImageBox getPageBox(MLint pageID) const
Returns the rectangular region in the entire image covered by the page with ID pageID.
ImageVector getPageExtent() const
Returns the extent of a page.
Definition: mlPagedImage.h:320
MLEXPORT MLMemoryBlockHandle getPage(MLint pageID) const
Returns the pointer to the CachedBuffer containing the data of the page with the ID pageID.
void setInvalid()
Sets image properties invalid, i.e., isValid() returns false afterwards.
Definition: mlPagedImage.h:151
MLEXPORT void setPageExtent(const ImageVector &pageExtent)
Sets the extents of the pages to pageExtent.
MLEXPORT void setMinVoxelValue(MLdouble minval)
Sets the assumed minimum value to minval. Overridden to perform access check.
MLEXPORT MLDataType getInputSubImageDataType(int inputIndex) const
Returns the input subimage data type for the input image at inputIndex.
MLEXPORT ThreadSupport getThreadSupport() const
Returns the current thread support of the paged image.
virtual MLEXPORT void setStateInfoErrorCode(MLErrorCode errorCode)
Sets the state information as MLErrorCode errorCode for this instance.
MLEXPORT void setCalculateOutputImagePropertiesCB(CalculateOutputImagePropertiesCB *callback, void *userData)
Sets the callback and userdata for the calculation of the properties of this PagedImage if they need ...
void setValid(bool flag=true)
Sets image properties to valid/up-to-date, i.e., isValid() returns true afterwards.
Definition: mlPagedImage.h:147
MLEXPORT void setUpdateOfImagePropertiesNeeded(bool flag)
Sets whether the update of the image properties is needed, as the ML graph has changed since the last...
MLEXPORT PagedImage & getBypassSourceImage()
Returns the reference to the source image of a bypass chain.
MLEXPORT void setExternalCalculateOutputImageHandler(CalculateOutputImageHandler *handler)
Sets the pointer to the output image calculation interface handler, the ownership is NOT passed to th...
MLEXPORT MLMetaProfilePtr & getMetaProfile() const
Returns the MLMetaProfile for this paged image. Creates it if necessary.
ImageVector getPageStride() const
Returns the stride to get from one page to another.
Definition: mlPagedImage.h:317
MLEXPORT void removePage(MLint pageID)
This method removes a page with ID pageID from this instance.
virtual MLEXPORT const std::string & getStateInfoString() const
Returns the current state information string, which might explain the state of this instance.
static MLEXPORT void setPageCountLimitToUsePageEntryMap(MLuint32 limit)
Sets the limit of number of pages for using the page entry map instead of the page list.
Definition: mlPagedImage.h:540
MLuint32 getID()
Returns the current image ID that changes whenever the image changes and that is unique accross all i...
Definition: mlPagedImage.h:129
MLEXPORT void copyPages(const std::vector< MLint > &pageIDs, SubImage *subImage, const ScaleShiftData &scaleShiftData=ScaleShiftData()) const
Fills the subImage with contents of the Pages with the IDs pagesIDs The gray values are transformed l...
MLint getOutputIndex() const
Returns associated output index of Module instance if passed to constructor, -1 otherwise.
Definition: mlPagedImage.h:311
MLint getPageID(const ImageVector &voxelPosition) const
Returns the ID of that page that contains the image voxel position voxelPosition.
Definition: mlPagedImage.h:323
MLEXPORT void setInputSubImageIsReadOnly(int inputIndex, bool readOnly)
Sets the input subimage for the input image at inputIndex to readOnly.
MLEXPORT void setInputSubImageUseMemoryImage(int inputIndex, bool useMemoryImage)
Sets that the input subimage for the input image at inputIndex should use a memory image (this implic...
MLEXPORT void setInputSubImageScaleShift(int inputIndex, const ScaleShiftData &scaleShift)
Sets that the input subimage for the input image at inputIndex should be rescaled with the given scal...
MLEXPORT const InputSubImageProperties & getInputSubImageProperties(int inputIndex) const
Returns a const reference to the InputSubImageProperties of the given input image at inputIndex.
MLEXPORT void setThreadSupport(ThreadSupport support)
Sets the thread support of the paged image to the given value.
Definition: mlPagedImage.h:337
bool getClampPagesToImageExtent() const
See setClampPagesToImageExtent().
Definition: mlPagedImage.h:209
ML_FRIEND_TEST(PagedImageDeprecationTest, NewAPI)
MLEXPORT void setPage(MLint pageID, const MLMemoryBlockHandle &page)
Sets the given page handle as pagedata at pageID.
MLEXPORT bool updateOfImagePropertiesNeeded() const
Returns whether the update of the image properties is needed, as the ML graph has changed since the l...
Definition: mlPagedImage.h:159
void setBypassIndex(MLint index)
Sets the index of the input image whose pages should be used instead of the pages of this image.
Definition: mlPagedImage.h:291
virtual MLEXPORT void setImageProperties(const PagedImage &imageProperties)
Function to copy all associated characteristics from imageProperties.
MLint getBypassIndex() const
Returns the index of the input image whose pages should be used instead of the pages of this image or...
Definition: mlPagedImage.h:295
MLEXPORT ~PagedImage() override
Destructor.
ImageVector getPageSetExtent() const
Returns the extents of the page set covering the entire image extents.
Definition: mlPagedImage.h:314
void setImageExtent(MLint x, MLint y, MLint z=1, MLint c=1, MLint t=1, MLint u=1)
Sets the extents of the image to the extent (x,y,z,c,t,u) and clears the list of valid pages and its ...
Definition: mlPagedImage.h:178
static MLEXPORT void getPageIDs(std::vector< MLint > &pageIDs, const SubImageBox &subImageBox, const ImageVector &imageExtent, const ImageVector &pageExtent)
Clears pageIDs and inserts the IDs of all pages that need to be calculated to cover subImageBox compl...
void updateID()
Sets that the image has changed.
Definition: mlPagedImage.h:132
MLEXPORT bool getInputSubImageIsReadOnly(int inputIndex) const
Returns whether the input subimage at inputIndex is set to 'read-only'.
MLEXPORT void deletePageEntryFromDeletionCallback(ExtendedPageEntry *entry)
This method removes a page referenced by the page entry.
MemoryImage & getMemoryImage()
Allows access to a memory-cached output of the paged image.
Definition: mlPagedImage.h:329
bool hasExternalCalculateOutputImageHandler() const
Returns whether the CalculateOutputImageHandler is an external handler and should not be overwritten.
Definition: mlPagedImage.h:120
Module * getModule() const
Returns the associated Module instance if passed to the constructor, NULL otherwise.
Definition: mlPagedImage.h:305
MLEXPORT void setCalculateOutputImageHandler(CalculateOutputImageHandler *handler)
Sets the pointer to the output image calculation interface handler; the ownership is passed to the Pa...
ThreadSupport
Defines the multithreading support of the paged image.
Definition: mlPagedImage.h:78
MLEXPORT MLErrorCode getTile(SubImage &subImage, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
See Host::getTile( module, outputIndex, subImg, scaleShiftData).
static MLEXPORT MLuint32 getPageCountLimitToUsePageEntryMap()
Returns the limit of number of pages for using the page entry map instead of the page list.
Definition: mlPagedImage.h:543
ML_FRIEND_TEST(PagedImageDeprecationTest, DeprecatedAPI)
MLEXPORT void getPageIDs(std::vector< MLint > &pageIDs, const SubImageBox &subImageBox) const
Clears pageIDs and inserts the IDs of all pages that need to be calculated to cover subImageBox compl...
CalculateOutputImageHandler * getCalculateOutputImageHandler() const
Returns the pointer to the output image calculation interface.
Definition: mlPagedImage.h:113
MLEXPORT MLMemoryBlockHandle getPageOrCreatePageRequestOrAddToPendingRequest(MLint &pageID, TileRequest *tileRequest, PageRequest **newPageRequest)
Returns the valid page handle if it exists.
void setClampPagesToImageExtent(bool flag=true)
If enabled, the pages are clamped to the image extent, ensuring that pages on the border do not exten...
Definition: mlPagedImage.h:206
MLEXPORT MLint getNumPages() const
Returns the total number of pages in this output image, regardless of whether they are allocated.
Definition: mlPagedImage.h:382
void setPageExtent(MLint x, MLint y, MLint z=1, MLint c=1, MLint t=1, MLint u=1)
Sets the extents of the pages to the extent (x,y,z,c,t,u).
Definition: mlPagedImage.h:213
MLEXPORT void calculateImageProperties()
Updates the image properties via the Module::calculateOutputImageProperties or via CalculateOutputIma...
ML_FRIEND_TEST(TypedHandlersTest, SetupAndVerifyProperties)
virtual MLEXPORT MLErrorCode getStateInfoErrorCode() const
Returns the current state information as MLError code, which might explain the state of this instance...
MLEXPORT MLErrorCode updateImageProperties()
Updates the image properties of the PagedImage using the Host::updateImageProperties method.
void setInPlaceIndex(MLint inputIndex)
Sets optimization flag: when calculating a page in calculateOutputSubImage(), the output image page s...
Definition: mlPagedImage.h:400
MLEXPORT void initializeInputSubImageProperties(MLint numInputs)
Initializes the InSubImageProps for a given number of inputs; should only be called by the Host!
MLEXPORT void setDataType(MLDataType dataType) override
Sets the type of data to dataType. Overridden to perform access check.
MLEXPORT void clearPageListAndMemoryImage()
Removes all pages of the page image and from the ML cache, and all page data chunks are freed.
MLEXPORT void freeTile(void *data)
Same as corresponding Host::freeTile(void *data).
MLEXPORT const PagedImage * getInputImage(int inputIndex) const
Returns the input image at inputIndex of the associated Module.
MLEXPORT std::size_t getCachedPagesSizeInBytes() const
Returns the currently used cache size for pages in bytes.
MLEXPORT void validateInputSubImagePropertiesAfterCalculateOutputImageProperties()
Validates the properties and sets the data type where it was not set; should only be called by the Ho...
void setImageExtent(const SubImageBox &box)
Sets the extents of the image to box.getExtent() and updates all PagedImage settings.
Definition: mlPagedImage.h:185
virtual MLEXPORT void setImageExtent(const ImageVector &extent)
Sets the extents of the image to extent. The list of valid pages and its content are cleared.
MLEXPORT void setInputSubImagesAreReadOnly(bool readOnly=true)
Sets the read-only flag for all input images.
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition: mlSubImage.h:75
VectorType getExtent() const
Returns the extents of the subimage region.
A TileRequest either represents the input subimage that is needed by a PageRequest or if it is a root...
Definition: mlTileRequest.h:50
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:596
MLint32 MLErrorCode
Type of an ML Error code.
Definition: mlTypeDefs.h:716
boost::mutex Mutex
Defines a non-recursive mutex.
Definition: mlMutex.h:39
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
unsigned int MLuint32
Definition: mlTypeDefs.h:185
void MLRequestProgressCB(void *usrData, double progress)
Definition: mlTypeDefs.h:1202
double MLdouble
Definition: mlTypeDefs.h:217
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:490
void CalculateOutputImagePropertiesCB(void *userData, PagedImage *outImage)
Callback for the calculation of the output image properties for outputImage.
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.