MeVisLab Toolbox Reference
|
Class which collects some useful functions needed in many places of operator programming. More...
#include <mlTools.h>
Static Public Member Functions | |
static MLErrorCode | scanInput (Module *op, MLint inIdx, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax) |
Analyzes the image at input inIdx of module op for min/max values with the scanImage function. | |
static MLErrorCode | scanOutput (Module *op, MLint outIdx, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax) |
Analyzes the image at output outIdx of module op for min/max values with the scanImage function. | |
static MLErrorCode | scanImage (PagedImage &img, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax, MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr) |
Analyzes the given image for min/max values. | |
static MLdouble | calculateImageCheckSum (MLint outNum, Module &baseOp) |
Compute a checksum of the output outNum of Module baseOp. | |
static void | separate (const std::string &stri, char sep, MLuint &num, std::string *&seps) |
Get a separation of the string into substrings which are separated by the character sep. | |
static void | replace (std::string &s, char sch, char rep) |
Replaces all occurrences of character sch in s by rep. | |
static std::string | toHex (MLint64 val, size_t minNumDigitSpace=1, bool useCapitals=true, bool isSigned=false) |
Returns hexadecimal string from val. | |
static std::string | toString (MLint64 val, size_t minFieldSize=1, int align=1, size_t preSpaces=0, size_t postSpaces=0, int hex=0, size_t minNumDigitSpace=8, bool useCapitals=true) |
Returns val converted to a std::string. | |
static bool | appendToLog (const std::string &path, const std::string &logString) |
Append message logString to the log file specified by path path. | |
static bool | clearLogFile (const std::string &path, bool remove=false) |
If remove is false then the contents of log file specified by path are cleared, i.e. | |
static bool | getVoxelValueRescale (MedicalImageProperties *img, double &slope, double &intercept, bool inverse=false) |
Return voxel value rescale parameters for img in slope and intercept, describing the transformation from stored voxel values to output voxel values (e.g. | |
static std::string | getTypeInformation (MLDataType dt) |
Return a string representing an information table about the data type dt. | |
static void | getLoopOrder (int dim, const SubImageBox &calcBox, std::vector< int > &loopOrder, std::vector< int > &loopStart, std::vector< int > &loopEnd) |
Return a suitable loop order, i.e., the order in which the six dimensions x,y,z,c,t,u are looped over, for filtering along dimension with index dim. | |
Static Protected Member Functions | |
static MLErrorCode | scanImageWithGetTile (PagedImage &img, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax) |
Helper method that scans image using getTile(). | |
static MLErrorCode | scanImageWithProcessAllPages (PagedImage &img, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax, MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr) |
Helper method that is used by scanInput and that uses processAllPages. | |
static std::string | _separateBuffer (const std::string &str, const std::string &colSep, const std::string &lineSep) |
Return a string from str separated with column and line separator strings colSep and lineSep replacing spaces and tabs. | |
Class which collects some useful functions needed in many places of operator programming.
|
staticprotected |
Return a string from str separated with column and line separator strings colSep and lineSep replacing spaces and tabs.
The returned string is useful for table views requiring such a format.
|
static |
Append message logString to the log file specified by path path.
Return true on success and false on failure.
Compute a checksum of the output outNum of Module baseOp.
If the entire image can be scanned then the sum is the sum of all voxel values multiplied with their corresponding image indices, otherwise 0. The voxel values are multiplied with their indices to make the check sum more variant to image translations and rotations.
If remove is false then the contents of log file specified by path are cleared, i.e.
the file has size 0. If remove is true then the log file specified by path is removed. On success true is returned, otherwise false.
|
static |
Return a suitable loop order, i.e., the order in which the six dimensions x,y,z,c,t,u are looped over, for filtering along dimension with index dim.
dim = 0 means the x dimension and dim = 5 means the u dimension. The inner loop should be over the given dimension dim, the order of the other dimensions does not matter but still needs to be specified. The indexes of the dimensions are returned in loopOrder, where loopOrder[5] is the inner loop. loopStart and loopEnd contain the start and end voxels for each dimension ordered according to loopOrder. The box of the page to be filtered is given as input in calcBox.
dim[in] | Dimension to be filtered. 0=x, 1=y, 2=z, 3=c, 4=t, 5=u. |
calcBox[in] | Coordinate box in which filtering should be applied. |
loopOrder[out] | Order in which the the dimensions are looped over. |
loopStart[out] | Start indexes for each dimension ordered according to loopOrder. |
loopEnd[out] | End indexes for each dimension ordered according to loopOrder. |
|
static |
Return a string representing an information table about the data type dt.
The line separator for the table is the character '
' and the column separator is '@'.
|
static |
Return voxel value rescale parameters for img in slope and intercept, describing the transformation from stored voxel values to output voxel values (e.g.
Hounsfield units for CT) by output = stored * slope + intercept If inverse is true, the parameters for the inverse transform from output to stored values are returned. The rescale parameters are obtained from the DICOM tags Rescale Slope and Rescale Intercept. If these are not present, slope and intercept are set to 1 and 0, resp., and the function returns false. Otherwise, the function returns true.
Replaces all occurrences of character sch in s by rep.
|
static |
Analyzes the given image for min/max values.
stdMin and stdMax are set to the minimum/maximum of the image properties; realMin and realMax are set to the real minimum/maximum determined from image data if the return value is ML_RESULT_OK. Otherwise these values have undefined values. For details on progressCallback
, see Host::getTile().
|
staticprotected |
Helper method that scans image using getTile().
Currently not used because the scanInputImageWithProcessAllPages() is much faster with the new ML host.
|
staticprotected |
Helper method that is used by scanInput and that uses processAllPages.
|
static |
Analyzes the image at input inIdx of module op for min/max values with the scanImage function.
See documentation of scanImage for further information. Note that DummyOp::getGlobalInstance() is considered as an invalid input, i.e. its image as invalid image.
|
static |
Analyzes the image at output outIdx of module op for min/max values with the scanImage function.
See documentation of scanImage for further information. Note that DummyOp::getGlobalInstance() is considered as an invalid output, i.e. its image as an invalid image.
|
static |
Get a separation of the string into substrings which are separated by the character sep.
After the call num contains the number of found separations and seps the pointer to the separated substrings. The seps pointer will be overwritten without check of its content. seps must be deleted by the application after usage with delete []. Note that a separator directly after another one produces an additional empty string in seps. num=0 is returned on allocation failure for seps. Otherwise at least one string is returned (the original) if no separation symbol is found.
|
static |
Returns hexadecimal string from val.
val | is the value converted to a hexadecimal string. |
useCapitals | if true then capital letters are used for hexadecimal numbers; otherwise lower characters are used; default is true. |
minNumDigitSpace | is the minimum number of numeric characters returned as hexadecimal digits; if necessary the value is prefixed with "0"s or "f"s depending on the sign of val; default is 1. |
isSigned | if true then a leading "-" is used followed by the hexadecimal absolute value of val; default is false. |
|
static |
Returns val converted to a std::string.
val | is the value to be converted. |
minFieldSize | defines the minimum size of entire returned string; default is 1. If necessary spaces are added dependent on centered settings. |
align | defaults to 1.
|
preSpaces | defines the number of spaces added before value string if > 0, otherwise it's ignored. |
postSpaces | defines the number of spaces appended to value string > 0, otherwise it's ignored. |
hex | if 0 then the number is printed normally. If negative then a signed hexadecimal number is created. If positive then an unsigned hexadecimal number is created. |
useCapitals | see parameter description of toHex, only used if hex != 0. |
minNumDigitSpace | see parameter description of toHex, only used if hex != 0. |