MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlITKSpecialInputsSupport.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
17
18// Include most ML specific things.
19#include "mlModuleIncludes.h"
21
23
24
25//---------------------------------------------------------------------------
36//---------------------------------------------------------------------------
37template <typename ITK_INDATATYPE, unsigned int DIM>
38typename itk::ImportImageFilter<ITK_INDATATYPE, DIM>::Pointer getITKSpecialInImg(const SubImage& inSubImg,
39 const PagedImage& inImg)
40{
41 typename itk::ImportImageFilter<ITK_INDATATYPE, DIM>::Pointer itkSpecialImporter;
42
43 try {
44 // Get data from specialized image input.
46 }
47 catch (itk::ExceptionObject& e) {
48 // Send error to ML error handler.
49 postITKException(e, NULL, ML_ERROR, "Trying to continue without incomplete input(s).");
50 }
51
52 return itkSpecialImporter;
53}
54
55
56//---------------------------------------------------------------------------
75//---------------------------------------------------------------------------
76#define ImplementAndSetSpecialInputImage(ITK_SPECIAL_IN_IMAGE, IN_IDX, FUNC_CALL, PRE_PARAMS, POST_PARAMS, \
77 ML_PIX_TYPE, ITK_PIX_TYPE, DIMENSION) \
78 \
79 /* Get an ImportImageFilter from special input subimage. */ \
80 typename itk::ImportImageFilter<ITK_PIX_TYPE, DIMENSION>::Pointer ITK_SPECIAL_IN_IMAGE##Importer = \
81 getITKSpecialInImg<ITK_PIX_TYPE, DIMENSION>(inSubImgs[IN_IDX], *getInputImage(IN_IDX)); \
82 \
83 /* Get output image from the created importer. */ \
84 typedef typename itk::Image<ITK_PIX_TYPE, DIMENSION> ITK_SPECIAL_IN_IMAGE##Type; \
85 typename ITK_SPECIAL_IN_IMAGE##Type::Pointer ITK_SPECIAL_IN_IMAGE = \
86 ITK_SPECIAL_IN_IMAGE##Importer ? ITK_SPECIAL_IN_IMAGE##Importer->GetOutput() : nullptr; \
87 \
88 /* If the output image is valid the call Set function; otherwise print error. */ \
89 if (ITK_SPECIAL_IN_IMAGE) { \
90 FUNC_CALL(PRE_PARAMS ITK_SPECIAL_IN_IMAGE POST_PARAMS); \
91 } \
92 else { \
93 MLPrintAndNotify(ML_ERROR, "ML_", "", "Could not create special itk input image", "", "Not setting special image", \
94 __FILE__, __LINE__, ML_BAD_PARAMETER); \
95 }
96
97//---------------------------------------------------------------------------
108//---------------------------------------------------------------------------
109#define ImplementAndSetSpecialInputBase(ITK_SPECIAL_IN_IMAGE, IN_IDX, FUNC_CALL, MEMBER_NAME, DIMENSION) \
110 \
111 /* Call the set function of the itk object with the pointer from the base object wrapper. */ \
112 FUNC_CALL(MEMBER_NAME.getWrappedInputObject(MEMBER_NAME.getTypeId()));
113
114
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
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
@ ML_ERROR
Definition mlTypeDefs.h:752
itk::ImportImageFilter< ITK_INDATATYPE, DIM >::Pointer getITKSpecialInImg(const SubImage &inSubImg, const PagedImage &inImg)
Takes a SubImage and returns the ImportImageFilter managing the inSubImg as ITK object.
MLITK_SUPPORT_EXPORT void postITKException(const itk::ExceptionObject &e, const Module *module, MLMessageType messageType, const std::string &handling="")
Sends all available information from the ITKException itkException to the ML error handler.