MeVisLab Toolbox Reference
|
The class PagedImage, representing a fragmented image that manages properties and data of an image located in pages. More...
#include <mlPagedImage.h>
Public Types | |
enum | ThreadSupport { NO_THREAD_SUPPORT = 0 , MULTITHREADED = 1 , IO_THREAD = 4 , USE_MODULE_THREAD_SUPPORT = -1 } |
Defines the multithreading support of the paged image. More... | |
Public Member Functions | |
ML_FRIEND_TEST (PagedImageDeprecationTest, NewAPI) | |
ML_FRIEND_TEST (PagedImageDeprecationTest, DeprecatedAPI) | |
ML_FRIEND_TEST (TypedHandlersTest, SetupAndVerifyProperties) | |
CalculateOutputImageHandler * | getCalculateOutputImageHandler () const |
Returns the pointer to the output image calculation interface. More... | |
MLEXPORT void | setExternalCalculateOutputImageHandler (CalculateOutputImageHandler *handler) |
Sets the pointer to the output image calculation interface handler , the ownership is NOT passed to the PagedImage and it is not overwritten by Host::updateImageProperties(). More... | |
bool | hasExternalCalculateOutputImageHandler () const |
Returns whether the CalculateOutputImageHandler is an external handler and should not be overwritten. More... | |
MLEXPORT void | setCalculateOutputImageHandler (CalculateOutputImageHandler *handler) |
Sets the pointer to the output image calculation interface handler ; the ownership is passed to the PagedImage. More... | |
MLEXPORT void | setCalculateOutputImagePropertiesCB (CalculateOutputImagePropertiesCB *callback, void *userData) |
Sets the callback and userdata for the calculation of the properties of this PagedImage if they need to be updated. More... | |
MLuint32 | getID () |
Returns the current image ID that changes whenever the image changes and that is unique accross all images. More... | |
void | updateID () |
Sets that the image has changed. More... | |
MLEXPORT void | setThreadSupport (ThreadSupport support) |
Sets the thread support of the paged image to the given value. More... | |
MLEXPORT ThreadSupport | getThreadSupport () const |
Returns the current thread support of the paged image. More... | |
MLEXPORT MLMemoryBlockHandle | getPage (MLint pageID) const |
Returns the pointer to the CachedBuffer containing the data of the page with the ID pageID . More... | |
MLEXPORT MLMemoryBlockHandle | getPageOrCreatePageRequestOrAddToPendingRequest (MLint &pageID, TileRequest *tileRequest, PageRequest **newPageRequest) |
Returns the valid page handle if it exists. More... | |
MLEXPORT void | clearPendingPageRequest (MLint pageID) |
Clears a pending page request for the given page ID. More... | |
MLEXPORT PagedImage & | getBypassSourceImage () |
Returns the reference to the source image of a bypass chain. More... | |
MLEXPORT SubImageBox | getPageBox (MLint pageID) const |
Returns the rectangular region in the entire image covered by the page with ID pageID . More... | |
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 completely. More... | |
MLEXPORT std::size_t | getCachedPagesSizeInBytes () const |
Returns the currently used cache size for pages in bytes. More... | |
MLEXPORT MLint | getNumPages () const |
Returns the total number of pages in this output image, regardless of whether they are allocated. More... | |
MLEXPORT MLMetaProfilePtr & | getMetaProfile () const |
Returns the MLMetaProfile for this paged image. Creates it if necessary. More... | |
Construction / Destruction. | |
MLEXPORT | PagedImage (Module *module=nullptr, MLint outputIndex=-1) |
Constructor. More... | |
MLEXPORT | ~PagedImage () override |
Destructor. More... | |
Set/Get/Update validity of image properties. | |
bool | isValid () const |
Returns whether image properties are valid and up-to-date. More... | |
void | setValid (bool flag=true) |
Sets image properties to valid/up-to-date, i.e., isValid() returns true afterwards. More... | |
void | setInvalid () |
Sets image properties invalid, i.e., isValid() returns false afterwards. More... | |
MLEXPORT void | setUpdateOfImagePropertiesNeeded (bool flag) |
Sets whether the update of the image properties is needed, as the ML graph has changed since the last update. More... | |
MLEXPORT bool | updateOfImagePropertiesNeeded () const |
Returns whether the update of the image properties is needed, as the ML graph has changed since the last update. More... | |
MLEXPORT MLErrorCode | updateImageProperties () |
Updates the image properties of the PagedImage using the Host::updateImageProperties method. More... | |
Setting Image and Page Properties | |
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. More... | |
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 content. More... | |
void | setImageExtent (const SubImageBox &box) |
Sets the extents of the image to box.getExtent() and updates all PagedImage settings. More... | |
virtual MLEXPORT void | setImageProperties (const PagedImage &imageProperties) |
Function to copy all associated characteristics from imageProperties . More... | |
MLEXPORT void | setPageExtent (const ImageVector &pageExtent) |
Sets the extents of the pages to pageExtent . More... | |
void | setClampPagesToImageExtent (bool flag=true) |
If enabled, the pages are clamped to the image extent, ensuring that pages on the border do not extend outside the image. More... | |
bool | getClampPagesToImageExtent () const |
See setClampPagesToImageExtent(). More... | |
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). More... | |
MLEXPORT void | setDataType (MLDataType dataType) override |
Sets the type of data to dataType . Overridden to perform access check. More... | |
MLEXPORT void | setMinVoxelValue (MLdouble minval) |
Sets the assumed minimum value to minval . Overridden to perform access check. More... | |
MLEXPORT void | setMaxVoxelValue (MLdouble maxval) |
Sets the assumed maximum value to maxval . Overridden to perform access check. More... | |
MLEXPORT void | setPage (MLint pageID, const MLMemoryBlockHandle &page) |
Sets the given page handle as pagedata at pageID . More... | |
MLEXPORT void | removePage (MLint pageID) |
This method removes a page with ID pageID from this instance. More... | |
MLEXPORT void | deletePageEntryFromDeletionCallback (ExtendedPageEntry *entry) |
This method removes a page referenced by the page entry . More... | |
MLEXPORT void | clearPageList () |
Removes all pages of the page image and from the ML cache, and all page data chunks are freed if not referenced by a memory block handle elsewhere. More... | |
MLEXPORT void | clearPageListAndMemoryImage () |
Removes all pages of the page image and from the ML cache, and all page data chunks are freed. More... | |
Property state information. | |
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 . More... | |
virtual MLEXPORT void | setStateInfoErrorCode (MLErrorCode errorCode) |
Sets the state information as MLErrorCode errorCode for this instance. More... | |
virtual MLEXPORT const std::string & | getStateInfoString () const |
Returns the current state information string, which might explain the state of this instance. More... | |
virtual MLEXPORT MLErrorCode | getStateInfoErrorCode () const |
Returns the current state information as MLError code, which might explain the state of this instance. More... | |
Bypass handling. | |
void | setBypassIndex (MLint index) |
Sets the index of the input image whose pages should be used instead of the pages of this image. More... | |
MLint | getBypassIndex () const |
Returns the index of the input image whose pages should be used instead of the pages of this image or -1 if bypassing is disabled. More... | |
Property query | |
Module * | getModule () const |
Returns the associated Module instance if passed to the constructor, NULL otherwise. More... | |
MLEXPORT const PagedImage * | getInputImage (int inputIndex) const |
Returns the input image at inputIndex of the associated Module. More... | |
MLint | getOutputIndex () const |
Returns associated output index of Module instance if passed to constructor, -1 otherwise. More... | |
ImageVector | getPageSetExtent () const |
Returns the extents of the page set covering the entire image extents. More... | |
ImageVector | getPageStride () const |
Returns the stride to get from one page to another. More... | |
ImageVector | getPageExtent () const |
Returns the extent of a page. More... | |
MLint | getPageID (const ImageVector &voxelPosition) const |
Returns the ID of that page that contains the image voxel position voxelPosition . More... | |
MemoryImage & | getMemoryImage () |
Allows access to a memory-cached output of the paged image. More... | |
const MemoryImage & | getMemoryImage () const |
Page inplace handling. | |
void | setInPlaceIndex (MLint inputIndex) |
Sets optimization flag: when calculating a page in calculateOutputSubImage(), the output image page shall use the same memory as the input page at inputIndex . More... | |
MLint | getInPlaceIndex () const |
Returns optimization flag: returns the index of the input image whose input tile is used also as output page in calculateOutputSubImage() (instead of allocating its own memory). More... | |
Setting the properties of input subimages/tiles for Module::calculateOutputSubImage | |
The following methods allow to define the properties of the input subimages that are passed to the Module::calculateOutputSubImage(). The default behavior is to provide all input subimages in the data type of the output image. Using the methods below, this behavior can be modified, to, e.g., use the input image's data type for the input subimages. | |
MLEXPORT void | setInputSubImageDataType (int inputIndex, MLDataType dataType) |
Sets the dataType for the given inputIndex . More... | |
MLEXPORT void | setInputSubImageIsReadOnly (int inputIndex, bool readOnly) |
Sets the input subimage for the input image at inputIndex to readOnly . More... | |
MLEXPORT void | setInputSubImagesAreReadOnly (bool readOnly=true) |
Sets the read-only flag for all input images. More... | |
MLEXPORT void | setInputSubImageUseMemoryImage (int inputIndex, bool useMemoryImage) |
Sets that the input subimage for the input image at inputIndex should use a memory image (this implicitly sets setInSubImageIsReadOnly() to true as well). More... | |
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 scaleShift data The default is to not shift/scale at all. More... | |
MLEXPORT const InputSubImageProperties & | getInputSubImageProperties (int inputIndex) const |
Returns a const reference to the InputSubImageProperties of the given input image at inputIndex . More... | |
MLEXPORT MLDataType | getInputSubImageDataType (int inputIndex) const |
Returns the input subimage data type for the input image at inputIndex . More... | |
MLEXPORT bool | getInputSubImageIsReadOnly (int inputIndex) const |
Returns whether the input subimage at inputIndex is set to 'read-only'. More... | |
Joining and copying Pages into sequential storage areas | |
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 linearly according to the parameter scaleShiftData (class ScaleShiftData) of the Pages. More... | |
Requesting data with wrapped functionality from Host | |
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). More... | |
MLEXPORT MLErrorCode | getTile (SubImage &subImage, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr) |
See Host::getTile( module, outputIndex, subImg, scaleShiftData). More... | |
MLEXPORT void | freeTile (void *data) |
Same as corresponding Host::freeTile(void *data). More... | |
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 0.5, 0.5, 0.5). More... | |
Public Member Functions inherited from ml::MedicalImageProperties | |
MedicalImageProperties () | |
Constructor. More... | |
~MedicalImageProperties () override | |
Destructor. Cleans up dynamically allocated memory. More... | |
MedicalImageProperties (const MedicalImageProperties &medicalImageProperties) | |
Copy constructor from an existing medicalImageProperties object to get a copy. More... | |
MedicalImageProperties & | operator= (const MedicalImageProperties &medicalImageProperties) |
Assignment operator from an existing edicalImageProperties object to get a copy. More... | |
void | setImageProperties (const MedicalImageProperties &medicalImageProperties) |
Sets a copy of the passed image properties medicalImageProperties . More... | |
bool | operator== (const MedicalImageProperties &medicalImageProperties) const |
Returns true if *this and medicalImageProperties are identical; otherwise, it returns false . More... | |
bool | operator!= (const MedicalImageProperties &medicalImageProperties) const |
Returns true if *this and medicalImageProperties differ; otherwise, it returns false . More... | |
void | setVoxelSize (MLdouble dx, MLdouble dy, MLdouble dz) |
Sets the voxel size to dx , dy , and dz . This changes the voxelToWorld matrix. More... | |
void | setVoxelSize (const Vector3 &voxelSize) |
Sets the voxel size to voxelSize . The transformation matrix is adapted adequately. More... | |
Vector3 | getVoxelSize () const |
Returns the voxel size. More... | |
double | getVoxelVolumeInCubicMillimeters () const |
Returns the volume of a single voxel in cubic millimeters (mm^3). More... | |
double | getVoxelVolumeInMilliliters () const |
Returns the volume of a single voxel in milliliters (ml). More... | |
bool | isVoxelToWorldMatrixValid () const |
Shows the validity state of the VoxelToWorldMatrix (default=true=valid). More... | |
void | setVoxelToWorldMatrixValid (bool valid) |
Validates/Invalidates the voxelToWorld matrix by passing true/false as valid . More... | |
const Matrix4 & | getVoxelToWorldMatrix () const |
Returns the voxelToWorld matrix. More... | |
void | setVoxelToWorldMatrix (const Matrix4 &matrix) |
Sets the matrix that transforms voxel to world coordinates to matrix . More... | |
const Matrix4 & | getWorldToVoxelMatrix () const |
Returns the worlToVoxel matrix. More... | |
Vector3 | mapVoxelToWorld (const Vector3 &voxelPosition) const |
Maps the voxelPosition vector to world coordinates and returns it. More... | |
Vector3 | mapWorldToVoxel (const Vector3 &worldPosition) const |
Maps the worldPosition vector to voxel coordinates and returns it. More... | |
void | scaleVoxelToWorldMatrix (const Vector3 &scaleFactors) |
Scales the voxelToWorld matrix by the vector scaleFactors and updates the image's voxel size. More... | |
void | translateVoxelToWorldMatrix (const Vector3 &offsetVector) |
Translates the voxelToWorld matrix by the offsetVector . More... | |
std::vector< std::string > & | getCDimensionInfos () |
Permits access to the additional information for subimages on the c-, t-, and u-dimensions. More... | |
std::vector< DateTime > & | getTDimensionInfos () |
std::vector< std::string > & | getUDimensionInfos () |
const std::vector< std::string > & | getCDimensionInfos () const |
const std::vector< DateTime > & | getTDimensionInfos () const |
const std::vector< std::string > & | getUDimensionInfos () const |
ImagePropertyExtensionContainer & | getImagePropertyContainer () |
Permits access to the container for user image properties. More... | |
const ImagePropertyExtensionContainer & | getConstImagePropertyContainer () const |
Public Member Functions inherited from ml::ImageProperties | |
MLEXPORT | ImageProperties () |
Constructor. More... | |
virtual MLEXPORT | ~ImageProperties () |
Virtual destructor to suppress compiler warnings. More... | |
MLEXPORT | ImageProperties (ImageVector extent, MLDataType dataType, MLdouble minValue, MLdouble maxValue) |
Constructor to set extent to extent , data type to dataType , minimum value to minValue , and maximum value to maxValue . More... | |
MLEXPORT | ImageProperties (const ImageProperties &imageProperties) |
Copy constructor from an existing imageProperties object to get an identical copy. More... | |
MLEXPORT ImageProperties & | operator= (const ImageProperties &imageProperties) |
Assignment operator from an existing imageProperties object to get an identical copy. More... | |
MLEXPORT void | setImageProperties (const ImageProperties &imageProperties) |
Copies property parameters from another image property instance imageProperties . More... | |
MLEXPORT bool | operator== (const ImageProperties &imageProperties) const |
Returns true if *this and imageProperties are identical; otherwise, it returns false . More... | |
MLEXPORT bool | operator!= (const ImageProperties &imageProperties) const |
Returns true if *this and imageProperties differ; otherwise, it returns false . More... | |
MLEXPORT void | setImageExtent (const ImageVector &extent) |
Sets the extent of the (sub)image. More... | |
ImageVector | getImageExtent () const |
Returns the extent of the (sub)image. More... | |
SubImageBox | getBoxFromImageExtent () const |
Returns the size of image as box with origin 0. More... | |
bool | hasValidExtent () const |
Returns whether the image has a valid extent (which means that all components are greater than 0). More... | |
MLint | getNumVoxels () const |
Returns the number of voxels in (sub)image. More... | |
MLint | getSizeInBytes () const |
Returns the number of potential bytes in (sub)image. More... | |
MLDataType | getDataType () const |
Returns the data type of the image. More... | |
void | setMinVoxelValue (MLdouble minval) |
Sets assumed minimum value to minval . More... | |
MLdouble | getMinVoxelValue () const |
Returns the assumed minimum value in data. More... | |
void | setMaxVoxelValue (MLdouble maxval) |
Sets assumed maximum value to maxval . More... | |
MLdouble | getMaxVoxelValue () const |
Returns the assumed maximum value in data. More... | |
Static Public Member Functions | |
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 completely. More... | |
static MLEXPORT void | setPageCountLimitToUsePageEntryMap (MLuint32 limit) |
Sets the limit of number of pages for using the page entry map instead of the page list. More... | |
static MLEXPORT MLuint32 | getPageCountLimitToUsePageEntryMap () |
Returns the limit of number of pages for using the page entry map instead of the page list. More... | |
Protected Member Functions | |
MLEXPORT void | calculateImageProperties () |
Updates the image properties via the Module::calculateOutputImageProperties or via CalculateOutputImagePropertiesCB if it is set. More... | |
MLEXPORT void | initializeInputSubImageProperties (MLint numInputs) |
Initializes the InSubImageProps for a given number of inputs; should only be called by the Host! More... | |
MLEXPORT void | validateInputSubImagePropertiesAfterCalculateOutputImageProperties () |
Validates the properties and sets the data type where it was not set; should only be called by the Host! More... | |
Friends | |
class | Host |
The host may access some methods that are otherwise unavailable. More... | |
The class PagedImage, representing a fragmented image that manages properties and data of an image located in pages.
Definition at line 65 of file mlPagedImage.h.
Defines the multithreading support of the paged image.
Definition at line 78 of file mlPagedImage.h.
Constructor.
module | The Module instance that uses this paged image inside of one of its output connectors, default is NULL. |
outputIndex | The index of the output connector of module that contains *this; default is -1. Note: module and outputIndex are only used by getTile/freeTile methods. If they are not used, the default parameters can be used. |
|
override |
Destructor.
Removes all pages and resets the corresponding memory image if it is controlled by the ML.
|
protected |
Updates the image properties via the Module::calculateOutputImageProperties or via CalculateOutputImagePropertiesCB if it is set.
MLEXPORT void ml::PagedImage::clearPageList | ( | ) |
Removes all pages of the page image and from the ML cache, and all page data chunks are freed if not referenced by a memory block handle elsewhere.
After this call, getPage(ID)
equals 0 for all pages of the image.
MLEXPORT void ml::PagedImage::clearPageListAndMemoryImage | ( | ) |
Removes all pages of the page image and from the ML cache, and all page data chunks are freed.
Pages are also removed if they are locked pages. After this call, getPage(ID)
equals 0 for all pages of the image. It also clears the memoryImg if the memoryImg mode is active.
Clears a pending page request for the given page ID.
MLEXPORT void ml::PagedImage::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 linearly according to the parameter scaleShiftData
(class ScaleShiftData) of the Pages.
Remark:
scaleShiftData
applies when scaleShiftData.getScale() == 1 and scaleShiftData.getShift() == 0. Thus, the gray value transformation has no effect, and copying can be implemented more efficiently with a special routine. MLEXPORT void ml::PagedImage::deletePageEntryFromDeletionCallback | ( | ExtendedPageEntry * | entry | ) |
This method removes a page referenced by the page entry
.
It removes the page entry of entry->pageId only if the stored pointer in the page entry map is the same as entry
. It finally deletes the page entry.
MLEXPORT void ml::PagedImage::freeTile | ( | void * | data | ) |
Same as corresponding Host::freeTile(void *data).
|
inline |
Returns the index of the input image whose pages should be used instead of the pages of this image or -1 if bypassing is disabled.
Definition at line 295 of file mlPagedImage.h.
MLEXPORT PagedImage& ml::PagedImage::getBypassSourceImage | ( | ) |
Returns the reference to the source image of a bypass chain.
MLEXPORT std::size_t ml::PagedImage::getCachedPagesSizeInBytes | ( | ) | const |
Returns the currently used cache size for pages in bytes.
|
inline |
Returns the pointer to the output image calculation interface.
Definition at line 113 of file mlPagedImage.h.
|
inline |
See setClampPagesToImageExtent().
Definition at line 209 of file mlPagedImage.h.
|
inline |
Returns the current image ID that changes whenever the image changes and that is unique accross all images.
Definition at line 129 of file mlPagedImage.h.
|
inline |
Returns optimization flag: returns the index of the input image whose input tile is used also as output page in calculateOutputSubImage() (instead of allocating its own memory).
If inplace calculation is off, then -1 is returned. Using inplace requires that page extent and voxel data type remain unchanged or errors will occur. The ML will disable inplace calculations automatically in some cases.
Definition at line 409 of file mlPagedImage.h.
MLEXPORT const PagedImage* ml::PagedImage::getInputImage | ( | int | inputIndex | ) | const |
Returns the input image at inputIndex
of the associated Module.
MLEXPORT MLDataType ml::PagedImage::getInputSubImageDataType | ( | int | inputIndex | ) | const |
Returns the input subimage data type for the input image at inputIndex
.
MLEXPORT bool ml::PagedImage::getInputSubImageIsReadOnly | ( | int | inputIndex | ) | const |
Returns whether the input subimage at inputIndex
is set to 'read-only'.
MLEXPORT const InputSubImageProperties& ml::PagedImage::getInputSubImageProperties | ( | int | inputIndex | ) | const |
Returns a const reference to the InputSubImageProperties of the given input image at inputIndex
.
Indexes outside the bounds of 0 to Module::getNumInputs()-1 will be handled fatally.
MLEXPORT MLdouble ml::PagedImage::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 0.5, 0.5, 0.5).
This method can be used for random access, but should not be used to, e.g., resample a full dataset, since it has a much larger overhead compared to modules that do the resampling on pages. Values on the image border are filled with the nearest image values, and values completely outside of the image are filled with outsideFillValue
.
|
inline |
Allows access to a memory-cached output of the paged image.
It can be used by the module and the host for caching the paged image. Control of this image is defined by _memoryImage.
Definition at line 329 of file mlPagedImage.h.
|
inline |
Definition at line 330 of file mlPagedImage.h.
MLEXPORT MLMetaProfilePtr& ml::PagedImage::getMetaProfile | ( | ) | const |
Returns the MLMetaProfile for this paged image. Creates it if necessary.
|
inline |
Returns the associated Module instance if passed to the constructor, NULL otherwise.
Definition at line 305 of file mlPagedImage.h.
Returns the total number of pages in this output image, regardless of whether they are allocated.
Definition at line 382 of file mlPagedImage.h.
|
inline |
Returns associated output index of Module instance if passed to constructor, -1 otherwise.
Definition at line 311 of file mlPagedImage.h.
MLEXPORT MLMemoryBlockHandle ml::PagedImage::getPage | ( | MLint | pageID | ) | const |
Returns the pointer to the CachedBuffer containing the data of the page with the ID pageID
.
MLEXPORT SubImageBox ml::PagedImage::getPageBox | ( | MLint | pageID | ) | const |
Returns the rectangular region in the entire image covered by the page with ID pageID
.
Returns the limit of number of pages for using the page entry map instead of the page list.
Definition at line 543 of file mlPagedImage.h.
|
inline |
Returns the extent of a page.
Definition at line 320 of file mlPagedImage.h.
|
inline |
Returns the ID of that page that contains the image voxel position voxelPosition
.
Definition at line 323 of file mlPagedImage.h.
MLEXPORT void ml::PagedImage::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
completely.
|
static |
Clears pageIDs
and inserts the IDs of all pages that need to be calculated to cover subImageBox
completely.
Static version of the previous method that also requires the extent of the image given by imageExtent
and the extent of the pages pageExtent
.
MLEXPORT MLMemoryBlockHandle ml::PagedImage::getPageOrCreatePageRequestOrAddToPendingRequest | ( | MLint & | pageID, |
TileRequest * | tileRequest, | ||
PageRequest ** | newPageRequest | ||
) |
Returns the valid page handle if it exists.
If no page data exists and there is a pending page request, the tileRequest
is added to the pending request. If no page data and no page request is pending, a new PageRequest is allocated and returned via newPageRequest
. The pageID
is passed by reference because, in an error situation, it needs to be reset and used outside of the method itself.
|
inline |
Returns the extents of the page set covering the entire image extents.
Definition at line 314 of file mlPagedImage.h.
|
inline |
Returns the stride to get from one page to another.
Definition at line 317 of file mlPagedImage.h.
|
virtual |
Returns the current state information as MLError code, which might explain the state of this instance.
|
virtual |
Returns the current state information string, which might explain the state of this instance.
MLEXPORT ThreadSupport ml::PagedImage::getThreadSupport | ( | ) | const |
Returns the current thread support of the paged image.
If the thread support is set to USE_MODULE_THREAD_SUPPORT, this method returns the thread support of the owning module.
MLEXPORT MLErrorCode ml::PagedImage::getTile | ( | SubImage & | subImage, |
const ScaleShiftData & | scaleShiftData = ScaleShiftData() , |
||
MLRequestProgressCB * | progressCallback = nullptr , |
||
void * | progressCallbackUserData = nullptr |
||
) |
See Host::getTile( module, outputIndex, subImg, scaleShiftData).
The call of this method requires that valid module
and outputIndex
parameters have been passed to the constructor. This is true
if this instance is part of an output connector of a Module.
MLEXPORT MLErrorCode ml::PagedImage::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).
The call of this method requires that valid module
and outputIndex
parameters have been passed to the constructor. This is true
if this instance is part of an output connector of a Module.
Referenced by ml::PCLMLTools::createPointCloudFromPagedImage(), and ml::getInputAsItkImportImageAndSubImg().
|
inline |
Returns whether the CalculateOutputImageHandler is an external handler and should not be overwritten.
Definition at line 120 of file mlPagedImage.h.
Initializes the InSubImageProps for a given number of inputs; should only be called by the Host!
|
inline |
Returns whether image properties are valid and up-to-date.
The default of a new instance is false
. The validity is changed only by the methods setValid() and setInvalid(), all other functions/ methods do not change the valid state of the instance.
Definition at line 143 of file mlPagedImage.h.
Referenced by ml::internal::TypedHandlerBase< BaseClass, Derived, NumberOfInputImages >::verifyProperties().
ml::PagedImage::ML_FRIEND_TEST | ( | PagedImageDeprecationTest | , |
DeprecatedAPI | |||
) |
ml::PagedImage::ML_FRIEND_TEST | ( | PagedImageDeprecationTest | , |
NewAPI | |||
) |
ml::PagedImage::ML_FRIEND_TEST | ( | TypedHandlersTest | , |
SetupAndVerifyProperties | |||
) |
This method removes a page with ID pageID
from this instance.
If it is no longer referenced by another memory block handle, it is freed immediately.
|
inline |
Sets the index
of the input image whose pages should be used instead of the pages of this image.
The index
= -1 disables the option to find pages also in an input image. Bypassing requires that image (data) content, image extent, page extent, and voxel data type remain unchanged or errors will occur.
Definition at line 291 of file mlPagedImage.h.
MLEXPORT void ml::PagedImage::setCalculateOutputImageHandler | ( | CalculateOutputImageHandler * | handler | ) |
Sets the pointer to the output image calculation interface handler
; the ownership is passed to the PagedImage.
MLEXPORT void ml::PagedImage::setCalculateOutputImagePropertiesCB | ( | CalculateOutputImagePropertiesCB * | callback, |
void * | userData | ||
) |
Sets the callback
and userdata
for the calculation of the properties of this PagedImage if they need to be updated.
|
inline |
If enabled, the pages are clamped to the image extent, ensuring that pages on the border do not extend outside the image.
This means that Module::calculateOutputSubImage and Module::calculateInputSubImageBox will get called with pages of different sizes. If disabled (which is the default), all pages will have the same size, even if they are partly outside of the image extent. The advantage of enabling the clamping is less memory usage and that the implementation of calculateOutputSubImage() does not need to use the valid region of the SubImage, since the whole page will always be in the valid region.
Definition at line 206 of file mlPagedImage.h.
|
overridevirtual |
Sets the type of data to dataType
. Overridden to perform access check.
Reimplemented from ml::ImageProperties.
Referenced by ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::calculateOutputImageProperties().
MLEXPORT void ml::PagedImage::setExternalCalculateOutputImageHandler | ( | CalculateOutputImageHandler * | handler | ) |
Sets the pointer to the output image calculation interface handler
, the ownership is NOT passed to the PagedImage and it is not overwritten by Host::updateImageProperties().
|
virtual |
Sets the extents of the image to extent
. The list of valid pages and its content are cleared.
Referenced by ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::calculateOutputImageProperties().
|
inline |
Sets the extents of the image to box.getExtent()
and updates all PagedImage settings.
The list of valid pages and its content are cleared.
Definition at line 185 of file mlPagedImage.h.
References ml::TSubImageBox< intT >::getExtent(), and setImageExtent().
Referenced by setImageExtent().
|
inline |
Sets the extents of the image to the extent (x,y,z,c,t,u) and clears the list of valid pages and its content.
The default value for missing dimensions is 1.
Definition at line 178 of file mlPagedImage.h.
References ml::ImageProperties::setImageExtent().
|
virtual |
Function to copy all associated characteristics from imageProperties
.
Sets inherited image characteristics as well as all MedicalImageProperties. Note that it usually sets only image properties and not page or image contents. The list of valid pages and its content are cleared and pristine.
|
inline |
Sets optimization flag: when calculating a page in calculateOutputSubImage(), the output image page shall use the same memory as the input page at inputIndex
.
This way, less allocations occur and the read and write buffers are identical. Usually only useful for voxel operations or algorithms that do not modify the image data. Using inplace requires that page extent and voxel data type remain unchanged or errors will occur. The ML will disable inplace calculations automatically in some cases.
Definition at line 400 of file mlPagedImage.h.
MLEXPORT void ml::PagedImage::setInputSubImageDataType | ( | int | inputIndex, |
MLDataType | dataType | ||
) |
Sets the dataType
for the given inputIndex
.
If this method is not called, the default is the output data type (getDataType()) after the Module::calculateOutputImageProperties() call. Note that your algorithm in Module::calculateOutputSubImage has to support different data types for in- and output subimages if you change the data type. Note: This should only be called from within Module::calculateOutputImageProperties().
Referenced by ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::calculateOutputImageProperties().
MLEXPORT void ml::PagedImage::setInputSubImageIsReadOnly | ( | int | inputIndex, |
bool | readOnly | ||
) |
Sets the input subimage for the input image at inputIndex
to readOnly
.
This means it is not allowed to write to this input subimage in Module::calculateOutputSubImage(). To ensure that your module supports this, you should use a 'const TSubImage' to guarantee that the data is only accessed via const pointers. For the Host to utilize this, the SubImageBox of the input subimage needs to match that of an input page; otherwise, the input data needs to be copied anyway. Note: This should only be called from within Module::calculateOutputImageProperties().
MLEXPORT void ml::PagedImage::setInputSubImagesAreReadOnly | ( | bool | readOnly = true | ) |
Sets the read-only flag for all input images.
(See setInputSubImageIsReadOnly() for details.)
Referenced by ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::calculateOutputImageProperties().
MLEXPORT void ml::PagedImage::setInputSubImageScaleShift | ( | int | inputIndex, |
const ScaleShiftData & | scaleShift | ||
) |
Sets that the input subimage for the input image at inputIndex
should be rescaled with the given scaleShift
data The default is to not shift/scale at all.
NOTE: This should only be called from within Module::calculateOutputImageProperties().
MLEXPORT void ml::PagedImage::setInputSubImageUseMemoryImage | ( | int | inputIndex, |
bool | useMemoryImage | ||
) |
Sets that the input subimage for the input image at inputIndex
should use a memory image (this implicitly sets setInSubImageIsReadOnly() to true
as well).
This is turned off by default. When requesting this, make sure that you return the complete input image box in Module::calculateInputSubImageBox(). If this is set to true
and the input module does not control its memory image itself, then the host saves the input volume in the memory output of the input image. This way, the input tile does not have to be calculated many times over if many modules request it. This way, a significant memory and performance gain may result if many connected modules request the same output page and at least one of them enables this flag. Note: Use the flag useMemoryImage
only if really necessary, as it usually assumes that the entire input image is cached at the output of the input module. This breaks the page-based image processing and may require a lot of memory. It also requests the entire input image through predecessor modules, which may use a lot of processing time. Note: This should only be called from within Module::calculateOutputImageProperties().
|
inline |
Sets image properties invalid, i.e., isValid() returns false
afterwards.
Definition at line 151 of file mlPagedImage.h.
Referenced by ml::internal::TypedHandlerBase< BaseClass, Derived, NumberOfInputImages >::verifyProperties().
Sets the assumed maximum value to maxval
. Overridden to perform access check.
Sets the assumed minimum value to minval
. Overridden to perform access check.
MLEXPORT void ml::PagedImage::setPage | ( | MLint | pageID, |
const MLMemoryBlockHandle & | page | ||
) |
Sets the given page
handle as pagedata at pageID
.
|
inlinestatic |
Sets the limit
of number of pages for using the page entry map instead of the page list.
Definition at line 540 of file mlPagedImage.h.
MLEXPORT void ml::PagedImage::setPageExtent | ( | const ImageVector & | pageExtent | ) |
Sets the extents of the pages to pageExtent
.
Referenced by ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::calculateOutputImageProperties().
|
inline |
Sets the extents of the pages to the extent (x,y,z,c,t,u).
The default value for missing dimensions is 1.
Definition at line 213 of file mlPagedImage.h.
|
virtual |
Sets the state information for this PagedImage to the string info
and the MLErrorCode errorCode
.
Calling this method only changes the state information, but not the data or validity of the instance itself. This method can be called by module programmers in calculateOutputImageProperties() to describe why they invalidated the module output.
Referenced by ml::internal::TypedHandlerBase< BaseClass, Derived, NumberOfInputImages >::verifyProperties().
|
virtual |
Sets the state information as MLErrorCode errorCode
for this instance.
It also sets the stateInfoString to the corresponding MLErrorCode. Calling this method only changes the state information, but not the data or validity of the instance itself. This method can be called by module programmers in calculateOutputImageProperties() to describe why they invalidated the module output.
|
inline |
Sets the thread support of the paged image to the given value.
This should only be called/changed from within calculateOutputImageProperties(). If it is set to USE_MODULE_THREAD_SUPPORT (which is the default), the thread support of the owning module is used.
Definition at line 337 of file mlPagedImage.h.
MLEXPORT void ml::PagedImage::setUpdateOfImagePropertiesNeeded | ( | bool | flag | ) |
Sets whether the update of the image properties is needed, as the ML graph has changed since the last update.
This sets the isOutOfDate() flag as well if set to true
.
|
inline |
Sets image properties to valid/up-to-date, i.e., isValid() returns true
afterwards.
Definition at line 147 of file mlPagedImage.h.
|
inline |
Sets that the image has changed.
Definition at line 132 of file mlPagedImage.h.
MLEXPORT MLErrorCode ml::PagedImage::updateImageProperties | ( | ) |
Updates the image properties of the PagedImage using the Host::updateImageProperties method.
|
inline |
Returns whether the update of the image properties is needed, as the ML graph has changed since the last update.
Definition at line 159 of file mlPagedImage.h.
|
protected |
Validates the properties and sets the data type where it was not set; should only be called by the Host!
|
friend |
The host may access some methods that are otherwise unavailable.
Definition at line 86 of file mlPagedImage.h.