MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlKernelTools.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
16
17#if !defined(__mlKernelTools_H)
18#define __mlKernelTools_H
19
20// ML-includes
21#include "mlInitSystemKernel.h"
22#include "mlLineApplicator.h"
23#include "mlKernel.h"
24
26
27//---------------------------------------------------------------------------------------------
30//---------------------------------------------------------------------------------------------
31
32//-------------------------------------------------------------------------------------------
53//-------------------------------------------------------------------------------------------
54template <typename DATATYPE> struct fctLineFilter
55{
56public:
63
66 {}
67};
68
69//-------------------------------------------------------------------------------------------
75//-------------------------------------------------------------------------------------------
76template <class T, typename DATATYPE> struct useObjectLineFilter : public fctLineFilter<DATATYPE>
77{
78
83
88
89public:
96 : pOb(po)
97 , pLF(pf)
98 {}
99
102 {}
103
110 size_t numVox) const override
111 {
112 (pOb->*pLF)(inSubImg, outSubImg, numVox);
113 }
114};
116
117
118//-------------------------------------------------------------------------------------------
119//
121//
122//-------------------------------------------------------------------------------------------
123
124//-------------------------------------------------------------------------------------------
128//-------------------------------------------------------------------------------------------
129
130// internal function, for scalar types
131template <typename DATATYPE> static inline bool _isScalarValueInRange(const DATATYPE& v, bool normal, double minVal,
132 double maxVal, OverloadSelector::OnTrue)
133{
134 if (normal) {
135 return (v >= minVal) && (v <= maxVal);
136 }
137 else {
138 return (v < maxVal) || (v > minVal);
139 }
140}
141
142// internal function, for non-scalar types
143template <typename DATATYPE>
144static inline bool _isScalarValueInRange(const DATATYPE&, bool, double, double, OverloadSelector::OnFalse)
145{
146 return true;
147}
148template <typename DATATYPE>
149static inline bool isScalarValueInRange(const DATATYPE& v, bool normal, double minVal, double maxVal)
150{
151 return _isScalarValueInRange(v, normal, minVal, maxVal, OverloadSelector::isScalarType<DATATYPE>());
152}
153
154//-------------------------------------------------------------------------------------------
158//-------------------------------------------------------------------------------------------
159template <typename IN_DATATYPE, typename OUT_DATATYPE>
162{
163 if (inCursor == nullptr || outCursor == nullptr) {
164 return;
165 }
166
167 // Add srcVoxelOffset to inCursor. So we don't need to do it again and again in the loop.
169 for (size_t i = 0; i < numVox; ++i) {
170 // Copy input voxel to output.
171 *outCursor = static_cast<OUT_DATATYPE>(*inCursor);
172
173 // Move read and write cursor forward.
174 ++outCursor;
175 ++inCursor;
176 }
177}
178
179//-------------------------------------------------------------------------------------------
190//-------------------------------------------------------------------------------------------
191template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
193 const K_DATATYPE* valTab, const MLsoffset* indexTab, size_t indexTabSize)
194{
195 // Sum up the products of the kernel element values and the input image voxels which are
196 // found in the input page covered by kernel elements. Input image voxels are found
197 // by offsetting the pointer to the input image voxel with the indexes from indexTab.
198
199 typedef typename TypeTraits<OUT_DATATYPE>::IntermediateType IntermediateType;
200
201 // Apply kernel tab to all voxels in line.
202 for (size_t i = 0; i < numVox; i++) {
203
204 // IntermediateType is double for scalar types and OUT_DATATYPE itself for all other types
205 IntermediateType retVal = ml_cast_from_scalar<IntermediateType>(0);
206 for (size_t c = 0; c < indexTabSize; c++) {
207 retVal +=
208 static_cast<IntermediateType>(inCursor[indexTab[c]]) * ml_scalar_factor_cast<IntermediateType>(valTab[c]);
209 }
210
211 // Write result into output image.
213
214 // Move read and write cursor forward.
215 ++outCursor;
216 ++inCursor;
217 } // for
218}
219
220//-------------------------------------------------------------------------------------------
235//-------------------------------------------------------------------------------------------
236template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
238 size_t numVox, const K_DATATYPE* valTab,
239 const MLsoffset* indexTab, size_t indexTabSize,
241{
242 // Test whether we have a normal interval or an exclusive one (i.e. min > max).
243 const bool normal = minVal <= maxVal;
244
245 typedef typename TypeTraits<OUT_DATATYPE>::IntermediateType IntermediateType;
246
247 // Apply kernel tab to all voxels in line.
248 for (size_t i = 0; i < numVox; i++) {
250
251 // Test input image voxel. Is it in image interval?
252 if (!isScalarValueInRange(srcVox, normal, minVal, maxVal)) {
253 // No, copy value from input.
254 *outCursor = static_cast<OUT_DATATYPE>(srcVox);
255 }
256 else {
257 // Sum up the products of the kernel element values and the input image voxels which are
258 // found in the input page covered by kernel elements. Input image voxels are found
259 // by offsetting the pointer to the input image voxel with the indexes from indexTab.
260
261 // IntermediateType is double for scalar types and OUT_DATATYPE itself for all other types
262 IntermediateType retVal = ml_cast_from_scalar<IntermediateType>(0);
263 for (size_t c = 0; c < indexTabSize; c++) {
264 retVal +=
265 static_cast<IntermediateType>(inCursor[indexTab[c]]) * ml_scalar_factor_cast<IntermediateType>(valTab[c]);
266 }
267
268 // Write result into output image.
270
271 } // else
272
273 // Move read and write cursor forward.
274 ++outCursor;
275 ++inCursor;
276 } // for
277}
278
279
280//-------------------------------------------------------------------------------------------
298//-------------------------------------------------------------------------------------------
299template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
301 size_t numVox, const K_DATATYPE* valTab,
302 const MLsoffset* indexTab, size_t indexTabSize,
304{
305 // Test whether we have a normal interval or an exclusive one (i.e. min > max).
306 const bool normal = minVal <= maxVal;
307
308 typedef typename TypeTraits<OUT_DATATYPE>::IntermediateType IntermediateType;
309
310 // Apply kernel tab to all voxels in line.
311 for (size_t i = 0; i < numVox; i++) {
312
313 // Sums of weights for the kernel elements
314 MLdouble posValSum = 0; // that match the threshold criterion
315 MLdouble negValSum = 0; // that doesn't match the threshold criterion
316
317 // IntermediateType is double for scalar types and OUT_DATATYPE itself for all other types
318 IntermediateType retVal = ml_cast_from_scalar<IntermediateType>(0);
319 for (size_t c = 0; c < indexTabSize; c++) {
320 IN_DATATYPE val = inCursor[indexTab[c]];
321
322 // Get element from kernel table and multiply it with its corresponding input
323 // page voxel and add it to result value. Do this only if the voxel belongs
324 // to the kernel interval. Sum up the weights of valid and invalid voxels.
325 if (isScalarValueInRange(val, normal, minVal, maxVal)) {
326 retVal += static_cast<IntermediateType>(val) * ml_scalar_factor_cast<IntermediateType>(valTab[c]);
327 posValSum += valTab[c];
328 }
329 else {
330 negValSum += valTab[c];
331 }
332 }
333
334 // If any value has been added to retVal then pretend as if all kernel voxels which did
335 // not match the kernel threshold interval hold the weighted average of those who did.
336 // Otherwise return value from input image which is under the replaced output image voxel.
339 }
340 else {
343 }
344
345 // Move read and write cursor forward.
346 ++outCursor;
347 ++inCursor;
348 }
349}
350
351
352//-------------------------------------------------------------------------------------------
373//-------------------------------------------------------------------------------------------
374template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
376 size_t numVox, const K_DATATYPE* valTab,
377 const MLsoffset* indexTab, size_t indexTabSize,
381{
382 // Test whether we have a normal interval or an exclusive one (i.e. min > max).
383 const bool normalImgInt = imgIntMinVal <= imgIntMaxVal;
385
386 typedef typename TypeTraits<OUT_DATATYPE>::IntermediateType IntermediateType;
387
388 // Scan all voxels in line.
389 for (size_t i = 0; i < numVox; i++) {
390
391 // Get pointer to kernel origin in input data and the voxel corresponding to the changed voxel.
392 const IN_DATATYPE* voxPtr = inCursor;
394
395 // Test input image voxel. Is it in image interval?
397 // No, copy value from input.
398 *outCursor = static_cast<OUT_DATATYPE>(srcVox);
399 }
400 else {
401 // Yes, voxel needs to be filtered.
402
403 // Sums of weights for the kernel elements
404 MLdouble posValSum = 0; // that match the threshold criterion
405 MLdouble negValSum = 0; // that do not match the threshold criterion
406
407 // IntermediateType is double for scalar types and OUT_DATATYPE itself for all other types
408 IntermediateType retVal = ml_cast_from_scalar<IntermediateType>(0);
409 for (size_t c = 0; c < indexTabSize; c++) {
410 IN_DATATYPE val = inCursor[indexTab[c]];
411
412 // Get element from kernel table and multiply it with its corresponding input
413 // page voxel and add it to result value. Do this only if the voxel belongs
414 // to the kernel interval. Sum up the weights of valid and invalid voxels.
416 retVal += static_cast<IntermediateType>(val) * ml_scalar_factor_cast<IntermediateType>(valTab[c]);
417 posValSum += valTab[c];
418 }
419 else {
420 negValSum += valTab[c];
421 }
422 }
423
424 // If any value has been added to retVal then pretend as if all kernel voxels which did
425 // not match the kernel threshold interval hold the weighted average of those who did.
426 // Otherwise return value from input image which is under the replaced output image voxel.
429 }
430 else {
433 }
434
435 } // else
436
437 // Move read and write cursor forward.
438 ++outCursor;
439 ++inCursor;
440 }
441}
442
443//-------------------------------------------------------------------------------------------
454//-------------------------------------------------------------------------------------------
455template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
457 size_t numVox, const K_DATATYPE* valTab,
458 const MLsoffset* indexTab, size_t indexTabSize,
462{
463 if (useImgInt && !useKernInt) {
464 // Image interval on but kernel interval off:
467 }
468 else if (!useImgInt && useKernInt) {
469 // Image interval off but kernel interval on:
472 }
473 else if (useImgInt && useKernInt) {
474 // Image interval and kernel interval on:
478 }
479 else {
480 // Convolute the line normally without using intervals.
482 }
483} // correlateLineEvtWithIntervals
484
486
487
488//---------------------------------------------------------------------------------------------
596//---------------------------------------------------------------------------------------------
598{
599public:
600 //---------------------------------------------------------------------------------------------
603 //---------------------------------------------------------------------------------------------
604
605 //-------------------------------------------------------------------------------------------
650 //-------------------------------------------------------------------------------------------
662
663 //-------------------------------------------------------------------------------------------
665 //-------------------------------------------------------------------------------------------
666 static const char* const BorderHandlingNames[];
668
669
670 //-------------------------------------------------------------------------------------------
673 //-------------------------------------------------------------------------------------------
674
683
686 static void deleteIndexTab(MLsoffset* idxTab);
687
694
700
705
715 const ImageVector& posKernelExt, bool isSeparable,
717
736 const ImageVector& negExt, const ImageVector& posExt,
737 bool isSeparable = false, MLint numIterations = 1);
738
749
760 bool isSeparable = false, MLint numIterations = 1);
761
762
775
777
778
779 //-------------------------------------------------------------------------------------------
781 //-------------------------------------------------------------------------------------------
783 template <typename IN_DATATYPE, typename OUT_DATATYPE>
788
790 template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
796
798 template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
806
808 template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
816
818 template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE> static void
828
830 template <typename IN_DATATYPE, typename OUT_DATATYPE, typename K_DATATYPE>
841
843 template <typename DATATYPE>
850
852 template <typename DATATYPE>
862
863}; // end of class KernelTools
864
865
866//-------------------------------------------------------------------------------------------
868//-------------------------------------------------------------------------------------------
869
870//-------------------------------------------------------------------------------------------
885//-------------------------------------------------------------------------------------------
886template <typename DATATYPE>
898
899//-------------------------------------------------------------------------------------------
909//-------------------------------------------------------------------------------------------
910template <typename DATATYPE>
916{
917 // Fill border of subimages before calculating the correct area in output subimage.
918 KernelTools::fillBorders(inImgExt, negKernelExt, posKernelExt, borderHandling, fillValue, outSubImg, inSubImg);
919
920 // Calculate output image area to be calculated.
921 SubImageBox area(KernelTools::calcAreaToBeCalculated(inImgExt, negKernelExt, posKernelExt, borderHandling));
922
923 // Clamp region to be filled in output page, because e.g. in PAD_DST_FILL not the
924 // entire output buffer needs to be calculated; the rest is filled.
925 SubImageBox calcArea = outSubImg.getBox();
927
928 // Print size and position of output page.
931 ImageVector pOf = KernelTools::calcOutInCoordShift(borderHandling, negKernelExt);
932
933
934 // Scan all voxels of the output page in u,t,c,z, y and x direction with a 'voxel cursor'.
935 ImageVector p;
937 MLint rowLength = ov2.x - ov1.x + 1;
938 for (p.u = ov1.u; p.u <= ov2.u; p.u++) {
939 for (p.t = ov1.t; p.t <= ov2.t; p.t++) {
940 for (p.c = ov1.c; p.c <= ov2.c; p.c++) {
941 for (p.z = ov1.z; p.z <= ov2.z; p.z++) {
942 rowStart.set(0, 0, p.z, p.c, p.t, p.u);
943 for (p.y = ov1.y; p.y <= ov2.y; p.y++) {
944 // Move cursors in input and output subimage to start of rows.
945 // The input image cursor defines the current kernel placement.
946 // The output image cursor defines the result voxel filtered from kernel and input image values.
947 // Note that both cursors are placed in global image coordinates, and NOT in local page coordinates!
948 rowStart.x = ov1.x;
949 rowStart.y = p.y;
951 inSubImg.setCursorImagePosition(rowStart - pOf);
952
953 // Apply the kernel to a line in the input image and write result into the
954 // output image. Note that \c lineFilter is a function-like object whose
955 // operator() (TSubImageWithCursor<DATATYPE> *, TSubImageWithCursor<DATATYPE> *, long) is called
956 // when the object is used as function.
957 lineFilter(&inSubImg, &outSubImg, static_cast<size_t>(rowLength));
958 }
959 }
960 }
961 }
962 }
963}
965
967
968#endif // __mlKernelTools_H
@ T
Class collecting a set of templated an normal functions for filtering operations using kernels.
static void deleteIndexTab(MLsoffset *idxTab)
Function to delete an index table created with createIndexTab.
static MLsoffset * createIndexTab(const ImageVector &inSubImgStrides, const Kernel &kernel)
Create the table of offsets from the voxel (0,0,0,0,0,0) to the coordinates given by kernel....
static void applyFiltering(const ImageVector &inImgExt, const fctLineFilter< DATATYPE > &lineFilter, const ImageVector &negKernelExt, const ImageVector &posKernelExt, BorderHandling borderHandling, MLdouble fillValue, TSubImageWithCursor< DATATYPE > &outSubImg, TSubImageWithCursor< DATATYPE > &inSubImg)
See MLKernelToolsApplyFiltering.
static void correlateLine(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize)
See MLKernelToolsCorrelateLine.
static SubImageBox calcInSubImageBoxForOutSubImg(const SubImageBox &outSubImgBox, BorderHandling borderHandling, const ImageVector &negExt, const ImageVector &posExt, bool isSeparable=false, MLint numIterations=1)
Computes the size of the input page needed to calculate the page whose extents are given by outSubImg...
static void fillBorders(const ImageVector &inImgExt, const ImageVector &negKernelExt, const ImageVector &posKernelExt, KernelTools::BorderHandling borderHandling, MLdouble fillValue, SubImage &outSubImg, SubImage &inSubImg)
Fill the borders of the input or the output subimage (inSubImg or outSubImg) with the correct values ...
static SubImageBox calcAreaToBeCalculated(const ImageVector &inImgExt, const ImageVector &negFilterExt, const ImageVector &posFilterExt, BorderHandling borderHandling, bool isSeparable=false, MLint numIterations=1)
Calculate the area of the output to be calculated when the kernel the negative negKernelExt and the p...
static MLsoffset calcSrcVoxelOffset(const ImageVector &strides, const ImageVector &kernelNegExt)
Computes the offset index from voxel in output image to voxel in input image which can be returned as...
static void expandForSeparableOrIterativeFiltering(SubImageBox &box, const ImageVector &negKernelExt, const ImageVector &posKernelExt, bool isSeparable, MLint numIterations)
Adds additional "borders around a box for separable or iterative filtering, for example around reques...
static void adaptWorldCoordinates(PagedImage &outImg, BorderHandling borderHandling, const ImageVector &negExt)
Convenience function to correct the world matrix of the image outImg when a kernel is applied to outI...
static void correlateLineEvtWithIntervals(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble imgIntMinVal, MLdouble imgIntMaxVal, MLdouble kernIntMinVal, MLdouble kernIntMaxVal, bool useImgInt, bool useKernInt)
See MLKernelToolsCorrelateLineEvtWithIntervals.
static void correlateLineWithKernelInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble minVal, MLdouble maxVal)
See MLKernelToolsCorrelateLineWithKernelInterval.
static ImageVector calcOutImageExt(const ImageVector &imgExt, const ImageVector &kernelExt, BorderHandling borderHandling, MLint numIterations=1)
Calculate extents of output image for input image extents imgExt and kernel extents kernelExt if bord...
static void applyFiltering(const ImageVector &inImgExt, LineApplicator< DATATYPE > &lineApp, BorderHandling borderHandling, MLdouble fillValue, TSubImageWithCursor< DATATYPE > &outSubImg, TSubImageWithCursor< DATATYPE > &inSubImg)
See MLKernelToolsApplyFiltering.
BorderHandling
The border handling defines how an image is filtered at its borders if the kernel reaches undefined r...
static void correlateLineWithImageInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble minVal, MLdouble maxVal)
See MLKernelToolsCorrelateLineWithImageInterval.
static ImageVector calcOutInCoordShift(BorderHandling borderHandling, const ImageVector &negKernelExt)
For every voxel coordinate written into the output image there is a voxel coordinate in the input ima...
static void correlateLineWithImageAndKernelInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble imgIntMinVal, MLdouble imgIntMaxVal, MLdouble kernIntMinVal, MLdouble kernIntMaxVal)
See MLKernelToolsCorrelateLineWithImageAndKernelInterval.
static void copyLine(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, MLsoffset srcVoxelOffset)
Wrapping of functions globally available in ML_NAMESPACE for backward compatibility.
The LineApplicator class provides pure virtual functions used by the old applyFiltering functions fro...
virtual ImageVector getNegativeExtent() const
Returns the negative extent of a kernel used for filtering.
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
const SubImageBox & getBox() const
Returns the box describing the origin/extent of the subimage.
Definition mlSubImage.h:249
void set(const ComponentType v=0)
Sets all components to v or - if v is not specified - to 0.
static TSubImageBox< intT > intersect(const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2)
Returns the overlapping region of subimage regions box1 and box2.
A class that offers a TSubImage with a TSubImageCursor.
void setCursorImagePosition(const ImageVector &position)
Sets the cursor to the given 6D position relative to the origin of the complete image region.
bool MLValueIs0WOM(MLint8 a)
Returns true if value is 0; otherwise, it returns false.
#define MLKERNELEXPORT
Includes files used in many parts of the dll, defined dll-specific macros and controls any system dep...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint MLsoffset
Signed ML offset type that is a 32-bit signed integer on 32-bit platforms and a 64-bit integer on 64-...
Definition mlTypeDefs.h:559
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:489
static void MLKernelToolsCorrelateLineWithImageAndKernelInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble imgIntMinVal, MLdouble imgIntMaxVal, MLdouble kernIntMinVal, MLdouble kernIntMaxVal)
Correlate all voxels of the a row pointed to by inCursor with the current kernel and write the result...
static bool isScalarValueInRange(const DATATYPE &v, bool normal, double minVal, double maxVal)
static void MLKernelToolsCorrelateLineEvtWithIntervals(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble imgIntMinVal, MLdouble imgIntMaxVal, MLdouble kernIntMinVal, MLdouble kernIntMaxVal, bool useImgInt, bool useKernInt)
Correlate all voxels of the a row pointed to by inCursor with the current kernel and write the result...
static void MLKernelToolsCopyLine(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, MLsoffset srcVoxelOffset)
Copy the line from input subimage which corresponds to the line to be modified in the output image.
static void MLKernelToolsApplyFiltering(const ImageVector &inImgExt, LineApplicator< DATATYPE > &lineApp, KernelTools::BorderHandling borderHandling, MLdouble fillValue, TSubImageWithCursor< DATATYPE > &outSubImg, TSubImageWithCursor< DATATYPE > &inSubImg)
Global template functions for page filtering.
static void MLKernelToolsCorrelateLineWithKernelInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble minVal, MLdouble maxVal)
Correlate all voxels of the a row pointed to by inCursor with the current kernel and write the result...
static void MLKernelToolsCorrelateLineWithImageInterval(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, MLdouble minVal, MLdouble maxVal)
Correlate all voxels of the a row pointed to by inCursor with the current kernel and write the result...
static bool _isScalarValueInRange(const DATATYPE &v, bool normal, double minVal, double maxVal, OverloadSelector::OnTrue)
Global static template functions for line filtering.
static void MLKernelToolsCorrelateLine(const IN_DATATYPE *inCursor, OUT_DATATYPE *outCursor, size_t numVox, const K_DATATYPE *valTab, const MLsoffset *indexTab, size_t indexTabSize)
Correlate all voxels of the a row pointed to by inCursor with the current kernel and write the result...
Helper types to switch between implementations of functions by overloading.
The basic implementation of a filter to filter an image row with kernel operations.
virtual void operator()(TSubImageWithCursor< DATATYPE > *, TSubImageWithCursor< DATATYPE > *, size_t) const
This operator does the work of a fctLineFilter.
virtual ~fctLineFilter()
Virtual destructor to avoid warnings. Currently it does nothing.
Wrapper for the use of object bound row filters.
T * pOb
Pointer to store the pointer to the class type object passed to the explicit useObjectLineFilter as p...
~useObjectLineFilter() override
Virtual destructor to avoid warnings. Currently it does nothing.
void operator()(TSubImageWithCursor< DATATYPE > *inSubImg, TSubImageWithCursor< DATATYPE > *outSubImg, size_t numVox) const override
This operator is calling the filtering method pLF of the object pOb.
useObjectLineFilter(T *po, void(T::*pf)(TSubImageWithCursor< DATATYPE > *, TSubImageWithCursor< DATATYPE > *, size_t))
Constructor.