Class which collects some useful functions needed in many places of operator programming.
More...
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
static MLdouble | calculateImageCheckSum (MLint outNum, Module &baseOp) |
| Compute a checksum of the output outNum of Module baseOp. More...
|
|
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. More...
|
|
static void | replace (std::string &s, char sch, char rep) |
| Replaces all occurrences of character sch in s by rep. More...
|
|
static std::string | toHex (MLint64 val, size_t minNumDigitSpace=1, bool useCapitals=true, bool isSigned=false) |
| Returns hexadecimal string from val. More...
|
|
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. More...
|
|
static bool | appendToLog (const std::string &path, const std::string &logString) |
| Append message logString to the log file specified by path path. More...
|
|
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. More...
|
|
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. More...
|
|
static std::string | getTypeInformation (MLDataType dt) |
| Return a string representing an information table about the data type dt. More...
|
|
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. More...
|
|
|
static MLErrorCode | scanImageWithGetTile (PagedImage &img, MLdouble &stdMin, MLdouble &stdMax, MLdouble &realMin, MLdouble &realMax) |
| Helper method that scans image using getTile(). More...
|
|
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. More...
|
|
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. More...
|
|
Class which collects some useful functions needed in many places of operator programming.
Definition at line 48 of file mlTools.h.
static void ml::Tools::getLoopOrder |
( |
int |
dim, |
|
|
const SubImageBox & |
calcBox, |
|
|
std::vector< int > & |
loopOrder, |
|
|
std::vector< int > & |
loopStart, |
|
|
std::vector< int > & |
loopEnd |
|
) |
| |
|
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.
- Parameters
-
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 bool ml::Tools::getVoxelValueRescale |
( |
MedicalImageProperties * |
img, |
|
|
double & |
slope, |
|
|
double & |
intercept, |
|
|
bool |
inverse = false |
|
) |
| |
|
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.