MeVisLab Toolbox Reference
mlITKSupportMacrosP.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
#pragma once
14
16
#include "
mlInitSystemITKSupport.h
"
17
19
#include "
mlModuleIncludes.h
"
20
22
#include <itkImage.h>
23
24
//---------------------------------------------------------------------------
27
//---------------------------------------------------------------------------
28
#define _ML_INSTANTIATE_2D_CODE(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, USER_CODE2, CLASS_NAME, DIM) \
29
{ \
30
switch (DIM){ \
31
case 2: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 2, CLASS_NAME); break; \
32
default: \
33
ML_ITK_ML_PRINT_ERROR(#CLASS_NAME, ML_BAD_DIMENSION, "Ignoring case(_ML_INSTANTIATE_2D_CODE).", "DIM=", DIM); \
34
} \
35
}
36
37
//---------------------------------------------------------------------------
40
//---------------------------------------------------------------------------
41
#define _ML_INSTANTIATE_3D_CODE(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, USER_CODE2, CLASS_NAME, DIM) \
42
{ \
43
switch (DIM){ \
44
case 3: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 3, CLASS_NAME); break; \
45
default: \
46
ML_ITK_ML_PRINT_ERROR(#CLASS_NAME, ML_BAD_DIMENSION, "Ignoring case(_ML_INSTANTIATE_3D_CODE).", "DIM=", DIM); \
47
} \
48
}
49
50
//---------------------------------------------------------------------------
53
//---------------------------------------------------------------------------
54
#define _ML_INSTANTIATE_2D3D_CODE(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, USER_CODE2, CLASS_NAME, DIM) \
55
{ \
56
switch (DIM){ \
57
case 2: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 2, CLASS_NAME); break; \
58
case 3: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 3, CLASS_NAME); break; \
59
default: \
60
ML_ITK_ML_PRINT_ERROR(#CLASS_NAME, ML_BAD_DIMENSION, "Ignoring case(_ML_INSTANTIATE_3D_CODE).", "DIM=", DIM); \
61
} \
62
}
63
64
//---------------------------------------------------------------------------
67
//---------------------------------------------------------------------------
68
#define _ML_INSTANTIATE_6D_CODE(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, USER_CODE2, CLASS_NAME, DIM) \
69
{ \
70
switch (DIM){ \
71
/* case 1: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 1, CLASS_NAME); break;*/
\
72
case 2: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 2, CLASS_NAME); break; \
73
case 3: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 3, CLASS_NAME); break; \
74
/* case 4: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 4, CLASS_NAME); break; */
\
75
/* case 5: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 5, CLASS_NAME); break; */
\
76
case 6: USER_CODE2(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, 6, CLASS_NAME); break; \
77
default: \
78
ML_ITK_ML_PRINT_ERROR(#CLASS_NAME, ML_BAD_DIMENSION, "Ignoring case(_ML_INSTANTIATE_6D_CODE).", "DIM=", DIM); \
79
} \
80
}
81
82
//------------------------------------------------------------------------------------
84
//------------------------------------------------------------------------------------
85
#define _ML_IMPLEMENT_ALL_ITK_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM, DIM_INST)\
86
switch(DATATYPE_ENUM){ \
87
case MLint8Type: DIM_INST(MLint8 , MLint8 , MLint8 , MLint8 , USER_CODE, CLASS_NAME, DIM); break; \
88
case MLuint8Type: DIM_INST(MLuint8 , MLuint8 , MLuint8 , MLuint8 , USER_CODE, CLASS_NAME, DIM); break; \
89
case MLint16Type: DIM_INST(MLint16 , MLint16 , MLint16 , MLint16 , USER_CODE, CLASS_NAME, DIM); break; \
90
case MLuint16Type: DIM_INST(MLuint16 , MLuint16 , MLuint16 , MLuint16 , USER_CODE, CLASS_NAME, DIM); break; \
91
case MLint32Type: DIM_INST(MLint32 , MLint32 , MLint32 , MLint32 , USER_CODE, CLASS_NAME, DIM); break; \
92
case MLuint32Type: DIM_INST(MLuint32 , MLuint32 , MLuint32 , MLuint32 , USER_CODE, CLASS_NAME, DIM); break; \
93
case MLfloatType: DIM_INST(MLfloat , MLfloat , MLfloat , MLfloat , USER_CODE, CLASS_NAME, DIM); break; \
94
case MLdoubleType: DIM_INST(MLdouble , MLdouble , MLdouble , MLdouble , USER_CODE, CLASS_NAME, DIM); break; \
95
/* case MLldoubleType: DIM_INST(MLldouble , MLldouble , MLldouble , MLldouble, USER_CODE, CLASS_NAME, DIM); break; */
\
96
/* case MLint64Type: DIM_INST(MLint64 , MLint64 , MLint64 , MLint64 , USER_CODE, CLASS_NAME, DIM); break; */
\
97
/* case MLuint64Type: DIM_INST(MLuint64 , MLuint64 , MLuint64 , MLuint64 , USER_CODE, CLASS_NAME, DIM); break; */
\
98
default: { \
99
ML_ITK_ML_PRINT_ERROR(#CLASS_NAME, ML_BAD_DATA_TYPE, \
100
"Type case not executed(_ML_IMPLEMENT_ALL_ITK_CASES).", \
101
"DATATYPE_ENUM=", DATATYPE_ENUM, \
102
"DIM=", DIM); \
103
break; \
104
} \
105
} \
106
107
//------------------------------------------------------------------------------------
109
//------------------------------------------------------------------------------------
110
#define ML_IMPLEMENT_ALL_ITK_2D_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM)\
111
_ML_IMPLEMENT_ALL_ITK_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM, _ML_INSTANTIATE_2D_CODE)
112
113
//------------------------------------------------------------------------------------
115
//------------------------------------------------------------------------------------
116
#define ML_IMPLEMENT_ALL_ITK_3D_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM)\
117
_ML_IMPLEMENT_ALL_ITK_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM, _ML_INSTANTIATE_3D_CODE)
118
119
//------------------------------------------------------------------------------------
121
//------------------------------------------------------------------------------------
122
#define ML_IMPLEMENT_ALL_ITK_2D3D_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM)\
123
_ML_IMPLEMENT_ALL_ITK_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM, _ML_INSTANTIATE_2D3D_CODE)
124
125
//------------------------------------------------------------------------------------
127
//------------------------------------------------------------------------------------
128
#define ML_IMPLEMENT_ALL_ITK_6D_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM)\
129
_ML_IMPLEMENT_ALL_ITK_CASES(INFO_STRING, USER_CODE, CLASS_NAME, DATATYPE_ENUM, DIM, _ML_INSTANTIATE_6D_CODE)
130
131
132
//---------------------------------------------------------------------------
134
//---------------------------------------------------------------------------
135
#define _TEMPLATE_INPUTS0 OutImageType
136
#define _TEMPLATE_INPUTS1 InImageType,OutImageType
137
#define _TEMPLATE_INPUTS2 InImageType,InImageType,OutImageType
138
#define _TEMPLATE_INPUTS3 InImageType,InImageType,InImageType,OutImageType
139
#define _TEMPLATE_INPUTS4 InImageType,InImageType,InImageType,InImageType,OutImageType
140
#define _TEMPLATE_INPUTS5 InImageType,InImageType,InImageType,InImageType,InImageType,OutImageType
142
143
144
//---------------------------------------------------------------------------
148
//---------------------------------------------------------------------------
149
#define _WRAPPER_DETERMINE_IN_REGION1_CPP(CLASS_NAME) \
150
151
152
153
//---------------------------------------------------------------------------
156
//---------------------------------------------------------------------------
157
#define _ML_CALL_CALCOUTSUBIMAGE(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
158
{ \
159
reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
160
->calcOutSubImageT(*outSubImg, outIndex, inSubImgs); \
161
}
162
163
//---------------------------------------------------------------------------
176
//---------------------------------------------------------------------------
177
#define _ML_CREATE_ITK_FILTER(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
178
reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
179
->_createITKFilterT();
180
181
//---------------------------------------------------------------------------
192
//---------------------------------------------------------------------------
193
#define _ML_DESTROY_ITK_FILTER(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
194
reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
195
->_destroyITKFilterT();
196
197
//---------------------------------------------------------------------------
208
//---------------------------------------------------------------------------
209
#define _ML_DETERMINE_ITK_IN_REGION(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, _DIM, CLASS_NAME) \
210
return reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, _DIM>*>(this) \
211
->_determineInRegionT(inIndex, outBox, outIndex, numActiveInputs);
212
213
214
//---------------------------------------------------------------------------
225
//---------------------------------------------------------------------------
226
#define _ML_DETERMINE_ITK_OUT_IMAGE_REGION(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
227
return reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
228
->_getOutImageRegionT(numImageInputs);
229
230
//---------------------------------------------------------------------------
241
//---------------------------------------------------------------------------
242
#define _ML_SET_FILTER_PARAMETERS(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
243
return reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
244
->_setFilterParametersT();
245
246
//---------------------------------------------------------------------------
257
//---------------------------------------------------------------------------
258
#define _ML_GET_FILTER_PARAMETERS(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
259
return reinterpret_cast<CLASS_NAME##Wrapper<MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM>*>(this) \
260
->_getFilterParametersT();
261
262
263
//----------------------------------------------------------------------------
266
//----------------------------------------------------------------------------
267
#define _ML_ITK_DETERMINE_IN_REGION_0(CLASS_NAME, NAMESPACE) \
268
SubImageBox _determineInRegionT(MLint
/*inIndex*/
, const SubImageBox &
/*outBox*/
, MLint
/*outIndex*/
, MLint
/*numActiveInputs*/
) \
269
{ \
270
return SubImageBox(); \
271
}
272
273
//----------------------------------------------------------------------------
278
//----------------------------------------------------------------------------
279
#define _ML_ITK_DETERMINE_IN_REGION_N(CLASS_NAME, NAMESPACE) \
280
SubImageBox _determineInRegionT(MLint inIndex, const SubImageBox &outBox, MLint outIndex, MLint numActiveInputs) \
281
{ \
282
typename FilterType::Pointer filter = static_cast<FilterType*>(_itkObj->voidFilterPtr()); \
283
return determineImageFilterInRegionTN<FilterType, InImageType> \
284
(filter, *this, inIndex, outBox, outIndex, numActiveInputs); \
285
} \
286
287
288
289
//----------------------------------------------------------------------------
292
//----------------------------------------------------------------------------
293
#define _ML_ITK_DETERMINE_OUT_REGION_0(CLASS_NAME, NAMESPACE) \
294
SubImageBox _getOutImageRegionT(int
/*numImageInputs*/
) \
295
{ \
296
typename FilterType::Pointer filter = static_cast<FilterType*>(_itkObj->voidFilterPtr());\
297
return determineImageFilterOutImageRegionT0<FilterType, OutImageType> \
298
(filter, *this); \
299
} \
300
301
//----------------------------------------------------------------------------
304
//----------------------------------------------------------------------------
305
#define _ML_ITK_DETERMINE_OUT_REGION_N(CLASS_NAME, NAMESPACE) \
306
SubImageBox _getOutImageRegionT(int numImageInputs) \
307
{ \
308
typename FilterType::Pointer filter = static_cast<FilterType*>(_itkObj->voidFilterPtr());\
309
return determineImageFilterOutImageRegionTN<FilterType, OutImageType, InImageType> \
310
(filter, *this, numImageInputs); \
311
} \
312
313
314
315
//--------------------------------------------------------------------------------
320
//--------------------------------------------------------------------------------
322
#define ML_ITK_DEFAULT_WRAPPER_TYPEDEFS_0(CLASS_NAME, NAMESPACE) \
323
typedef NAMESPACE::CLASS_NAME<_TEMPLATE_INPUTS0> FilterType; \
324
326
#define ML_ITK_DEFAULT_WRAPPER_TYPEDEFS_1(CLASS_NAME, NAMESPACE) \
327
typedef NAMESPACE::CLASS_NAME<_TEMPLATE_INPUTS1> FilterType; \
328
330
#define ML_ITK_DEFAULT_WRAPPER_TYPEDEFS_2(CLASS_NAME, NAMESPACE) \
331
typedef NAMESPACE::CLASS_NAME<_TEMPLATE_INPUTS2> FilterType; \
332
334
#define ML_ITK_DEFAULT_WRAPPER_TYPEDEFS_3(CLASS_NAME, NAMESPACE) \
335
typedef NAMESPACE::CLASS_NAME<_TEMPLATE_INPUTS3> FilterType; \
336
338
339
//----------------------------------------------------------------------------------
344
// <typename DATATYPE, unsigned int DIM>
348
// TSubImage<DATATYPE> *outSubImg, int outIndex SUB_IMGS)
351
//----------------------------------------------------------------------------------
352
#define _ML_ITK_WRAPPER(PROJECT_PREFIX, CLASS_NAME, NAMESPACE, DET_IN_REGION, WRAPPER_TYPEDEFS, CREATOR_SWITCH, DET_OUT_REGION) \
353
\
354
\
355
template <typename ML_OUTDATATYPE, typename ITK_OUTDATATYPE, \
356
typename ML_INDATATYPE, typename ITK_INDATATYPE, unsigned int DIM> \
357
class CLASS_NAME##Wrapper : public PROJECT_PREFIX##CLASS_NAME \
358
{ \
359
friend class PROJECT_PREFIX##CLASS_NAME; \
360
\
361
/*--------------------------------------------------------------------*/
\
362
\
363
/*--------------------------------------------------------------------*/
\
364
typedef itk::Image<ITK_INDATATYPE,DIM> InImageType; \
365
\
366
/*--------------------------------------------------------------------*/
\
367
\
368
/*--------------------------------------------------------------------*/
\
369
typedef ITK_INDATATYPE InPixelType; \
370
\
371
/*--------------------------------------------------------------------*/
\
372
\
373
/*--------------------------------------------------------------------*/
\
374
typedef itk::Image<ITK_OUTDATATYPE,DIM> OutImageType; \
375
\
376
/*--------------------------------------------------------------------*/
\
377
\
378
/*--------------------------------------------------------------------*/
\
379
typedef ITK_OUTDATATYPE OutPixelType; \
380
\
381
/*--------------------------------------------------------------------*/
\
382
\
383
/*--------------------------------------------------------------------*/
\
384
WRAPPER_TYPEDEFS(CLASS_NAME, NAMESPACE) \
385
\
386
/*--------------------------------------------------------------------*/
\
387
\
388
/*--------------------------------------------------------------------*/
\
389
void _createITKFilterT() \
390
{ \
391
/* Create and store the typed object wrapper in */
\
392
/* untyped base class pointer. */
\
393
_itkObj = new TypedObjectHolderT<FilterType>(); \
394
} \
395
\
396
/*--------------------------------------------------------------------*/
\
397
\
398
\
399
/*--------------------------------------------------------------------*/
\
400
void _destroyITKFilterT() \
401
{ \
402
delete _itkObj; _itkObj = nullptr; \
403
} \
404
\
405
/*------------------------------------------------------------------------*/
\
406
\
407
\
408
/*------------------------------------------------------------------------*/
\
409
DET_IN_REGION(CLASS_NAME, NAMESPACE) \
410
\
411
/*------------------------------------------------------------------------*/
\
412
\
413
/*------------------------------------------------------------------------*/
\
414
DET_OUT_REGION(CLASS_NAME, NAMESPACE) \
415
\
416
/*------------------------------------------------------------------------*/
\
417
\
418
/*------------------------------------------------------------------------*/
\
419
MLErrorCode _setFilterParametersT(); \
420
\
421
/*------------------------------------------------------------------------*/
\
422
\
423
/*------------------------------------------------------------------------*/
\
424
MLErrorCode _getFilterParametersT(); \
425
\
426
/*------------------------------------------------------------------------*/
\
427
\
428
/*------------------------------------------------------------------------*/
\
429
void calcOutSubImageT(SubImage &outSubImg, \
430
int outIndex, \
431
SubImage *inSubImgs); \
432
\
433
\
434
private: \
435
/*--- DO NOT IMPLEMENT MEMBERS IN THIS CLASS --- */
\
436
/*--- IT MUST BE LEGAL TO CAST IT TO ITS --- */
\
437
/*--- BASE CLASS AND BACK! --- */
\
438
\
439
\
440
CLASS_NAME##Wrapper(); \
441
\
442
~CLASS_NAME##Wrapper(); \
443
\
444
CLASS_NAME##Wrapper(const CLASS_NAME##Wrapper &); \
445
\
446
CLASS_NAME##Wrapper operator=(const CLASS_NAME##Wrapper &); \
447
\
448
}; \
449
\
450
/*---------------------------------------------------------------------------*/
\
451
/*--- Implement virtual calculateOutputSubImage method to call correctly ---*/
\
452
/*--- typed calcOutSubImageT method of template wrapper ---*/
\
453
/*---------------------------------------------------------------------------*/
\
454
void PROJECT_PREFIX##CLASS_NAME::calculateOutputSubImage(SubImage *outSubImg, \
455
int outIndex, \
456
SubImage *inSubImgs) \
457
{ \
458
/* Call correct template version of calcOutSubImageT for all types and dims.*/
\
459
CREATOR_SWITCH("calculateOutputSubImage()", \
460
_ML_CALL_CALCOUTSUBIMAGE, \
461
CLASS_NAME, _m_PixelType, _m_Dimension); \
462
} \
463
\
464
/*---------------------------------------------------------------------------*/
\
465
\
466
\
467
\
468
\
469
\
470
\
471
\
472
\
473
/*---------------------------------------------------------------------------*/
\
474
void PROJECT_PREFIX##CLASS_NAME::_createITKFilter(MLDataType dataType, MLint dim)\
475
{ \
476
/* Clean up an eventually existing filter. */
\
477
_destroyITKFilter(); \
478
\
479
/* Set data type and dimension of the filter to be created. */
\
480
_m_PixelType = dataType; \
481
_m_Dimension = dim; \
482
\
483
ML_TRY \
484
{ \
485
/* Implement ITKImage creation for all data types and all dimensions. */
\
486
CREATOR_SWITCH("_createITKFilter()", \
487
_ML_CREATE_ITK_FILTER, \
488
CLASS_NAME, _m_PixelType, _m_Dimension); \
489
} \
490
ML_CATCH_BLOCK(...) \
491
{ \
492
ML_ITK_ML_PRINT_ERROR("_createITKFilter()", \
493
ML_UNKNOWN_EXCEPTION, "Filter not created.", \
494
"_m_PixelType=", _m_PixelType, \
495
"_m_Dimension=", _m_Dimension); \
496
} \
497
} \
498
\
499
\
500
/*---------------------------------------------------------------------------*/
\
501
\
502
\
503
\
504
\
505
\
506
\
507
\
508
\
509
\
510
\
511
/*---------------------------------------------------------------------------*/
\
512
void PROJECT_PREFIX##CLASS_NAME::_destroyITKFilter() \
513
{ \
514
/* Destroy only valid objects */
\
515
if (!_itkObj || (_m_Dimension < 1) || \
516
(ML_INVALID_DATA_TYPE == _m_PixelType)){ return; } \
517
ML_TRY \
518
{ \
519
/* Implement ITKImage creation for all data types and all dimensions. */
\
520
CREATOR_SWITCH("_destroyITKFilter()", \
521
_ML_DESTROY_ITK_FILTER, \
522
CLASS_NAME, _m_PixelType, _m_Dimension); \
523
} \
524
ML_CATCH_BLOCK(...) \
525
{ \
526
ML_ITK_ML_PRINT_ERROR("_destroyITKFilter()", \
527
ML_UNKNOWN_EXCEPTION, "Filter destruction failed.", \
528
"_m_PixelType=", _m_PixelType, \
529
"_m_Dimension=", _m_Dimension); \
530
} \
531
_itkObj = nullptr; \
532
} \
533
\
534
\
535
/*----------------------------------------------------------------------------*/
\
536
\
537
\
538
\
539
\
540
\
541
\
542
\
543
\
544
\
545
\
546
\
547
\
548
/*----------------------------------------------------------------------------*/
\
549
SubImageBox PROJECT_PREFIX##CLASS_NAME::_determineInRegion(MLint inIndex, \
550
const SubImageBox &outBox,\
551
MLint outIndex, \
552
MLint numActiveInputs) \
553
{ \
554
ML_TRY \
555
{ \
556
/* Implement ITKImage creation for all data types and all dimensions. */
\
557
CREATOR_SWITCH("_determineInRegion()", \
558
_ML_DETERMINE_ITK_IN_REGION, \
559
CLASS_NAME, _m_PixelType, _m_Dimension); \
560
} \
561
ML_CATCH_BLOCK(...) \
562
{ \
563
ML_ITK_ML_PRINT_ERROR("_determineInRegion()", \
564
ML_UNKNOWN_EXCEPTION, "InRegion calculation failed.", \
565
"inIndex=", inIndex, \
566
"outIndex=", outIndex, \
567
"_m_PixelType=", _m_PixelType, \
568
"_m_Dimension=", _m_Dimension); \
569
} \
570
return SubImageBox();
/* Return empty box in case of error */
\
571
} \
572
\
573
\
574
/*----------------------------------------------------------------------------*/
\
575
\
576
\
577
\
578
\
579
\
580
\
581
\
582
/*----------------------------------------------------------------------------*/
\
583
SubImageBox PROJECT_PREFIX##CLASS_NAME::_getOutImageRegion(int numImageInputs) \
584
{ \
585
ML_TRY \
586
{ \
587
/* Implement ITKImage creation for all data types and all dimensions. */
\
588
CREATOR_SWITCH("_getOutImageRegion()", \
589
_ML_DETERMINE_ITK_OUT_IMAGE_REGION, \
590
CLASS_NAME, _m_PixelType, _m_Dimension); \
591
} \
592
ML_CATCH_BLOCK(...) \
593
{ \
594
ML_ITK_ML_PRINT_ERROR("_getOutImageRegion()", \
595
ML_UNKNOWN_EXCEPTION, "OutRegion calculation failed.", \
596
"numImageInputs=", numImageInputs, \
597
"_m_PixelType=", _m_PixelType, \
598
"_m_Dimension=", _m_Dimension); \
599
} \
600
return SubImageBox();
/* Return empty box in case of error */
\
601
} \
602
\
603
\
604
/*----------------------------------------------------------------------------*/
\
605
\
606
/*----------------------------------------------------------------------------*/
\
607
MLErrorCode PROJECT_PREFIX##CLASS_NAME::_setFilterParameters() \
608
{ \
609
MLErrorCode retCode = ML_RESULT_OK; \
610
\
611
ML_TRY \
612
{ \
613
/* Implement ITKImage creation for all data types and all dimensions. */
\
614
CREATOR_SWITCH("_setFilterParameters()", \
615
_ML_SET_FILTER_PARAMETERS, \
616
CLASS_NAME, _m_PixelType, _m_Dimension); \
617
} \
618
ML_CATCH_BLOCK(...) \
619
{ \
620
ML_PRINT_ERROR("_setFilterParameters())", \
621
ML_UNKNOWN_EXCEPTION, "Returning empty box."); \
622
retCode = ML_UNKNOWN_EXCEPTION; \
623
} \
624
\
625
return retCode; \
626
} \
627
\
628
\
629
/*----------------------------------------------------------------------------*/
\
630
\
631
/*----------------------------------------------------------------------------*/
\
632
MLErrorCode PROJECT_PREFIX##CLASS_NAME::_getFilterParameters() \
633
{ \
634
MLErrorCode retCode = ML_RESULT_OK; \
635
\
636
ML_TRY \
637
{ \
638
/* Call the correct template version of get filter function. */
\
639
CREATOR_SWITCH("_getFilterParameters()", \
640
_ML_GET_FILTER_PARAMETERS, \
641
CLASS_NAME, _m_PixelType, _m_Dimension); \
642
} \
643
ML_CATCH_BLOCK(...) \
644
{ \
645
ML_PRINT_ERROR("_getFilterParameters())", \
646
ML_UNKNOWN_EXCEPTION, "Parameter no or only partially read.");\
647
retCode = ML_UNKNOWN_EXCEPTION; \
648
} \
649
\
650
return retCode; \
651
} \
652
\
653
mlInitSystemITKSupport.h
mlModuleIncludes.h
MeVisLab
ITK
Sources
ML
MLITKSupport
mlITKSupportMacrosP.h
Generated by
1.10.0