24 #define TestImageType(type, dim) \
25 MITK_TEST_CONDITION(typeid(type) == typeid(TPixel) && dim == VDimension, \
26 "Checking for correct type itk::Image<" #type "," #dim ">")
28 #define TestVectorImageType(type, dim) \
29 MITK_TEST_CONDITION(typeid(type) == typeid(TPixel) && dim == VDimension && \
30 typeid(itk::VariableLengthVector<type>) == typeid(typename ImageType::PixelType), \
31 "Checking for correct type itk::VectorImage<" #type "," #dim ">")
36 typedef AccessByItkTest Self;
38 typedef itk::Image<int, 2> IntImage2D;
39 typedef itk::Image<int, 3> IntImage3D;
40 typedef itk::Image<float, 2> FloatImage2D;
41 typedef itk::Image<float, 3> FloatImage3D;
43 typedef itk::VectorImage<int, 3> IntVectorImage3D;
54 void testAccessByItk()
68 AccessByItk_n(mitkFloatImage2D, AccessItkImage, (Float2D, 2));
69 AccessByItk_n(mitkFloatImage3D, AccessItkImage, (Float3D, 2));
84 void testAccessFixedDimensionByItk()
111 void testAccessFixedPixelTypeByItk()
138 void testAccessFixedTypeByItk()
174 void testAccessTwoImagesFixedDimensionByItk()
182 template <
typename TPixel,
unsigned int VDimension>
183 void AccessItkImage(
const itk::Image<TPixel, VDimension> *,
184 EImageType param1 = Unknown,
212 template <
typename TPixel,
unsigned int VDimension>
213 void AccessItkImage(itk::VectorImage<TPixel, VDimension> *,
214 EImageType param1 = Unknown,
218 typedef itk::VectorImage<TPixel, VDimension>
ImageType;
244 template <
typename TPixel1,
unsigned int VDimension1,
typename TPixel2,
unsigned int VDimension2>
245 void AccessTwoItkImages(itk::Image<TPixel1, VDimension1> * ,
246 itk::Image<TPixel2, VDimension2> * )
248 if (!(
typeid(
int) ==
typeid(TPixel1) &&
typeid(
float) ==
typeid(TPixel2) && VDimension1 == 2 && VDimension2 == 2))
250 throw std::runtime_error(
"Image type mismatch");
254 template <
typename ImageType>
258 typename ImageType::IndexType start;
260 typename ImageType::SizeType size;
262 typename ImageType::RegionType region;
263 region.SetSize(size);
264 region.SetIndex(start);
265 itkImage->SetRegions(region);
266 itkImage->Allocate();
270 template <
typename ImageType>
274 typename ImageType::IndexType start;
276 typename ImageType::SizeType size;
278 typename ImageType::RegionType region;
279 region.SetSize(size);
280 region.SetIndex(start);
281 itkImage->SetRegions(region);
282 itkImage->SetVectorLength(vectorLength);
283 itkImage->Allocate();
292 AccessByItkTest accessTest;
295 accessTest.testAccessByItk();
298 accessTest.testAccessFixedDimensionByItk();
301 accessTest.testAccessFixedTypeByItk();
304 accessTest.testAccessFixedPixelTypeByItk();
307 accessTest.testAccessTwoImagesFixedDimensionByItk();
#define AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, va_tuple)
Access a mitk-image with known type (pixel type and dimension) by an itk-image with one or more param...
itk::SmartPointer< Self > Pointer
#define MITK_TEST_FOR_EXCEPTION_END(EXCEPTIONCLASS)
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
Access a mitk-image with known dimension by an itk-image.
itk::Image< unsigned char, 3 > ImageType
#define AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, va_tuple)
Access a mitk-image with known dimension by an itk-image with one or more parameters.
#define AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, va_tuple)
Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image with one or more par...
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
#define AccessByItk_n(mitkImage, itkImageTypeFunction, va_tuple)
Access a MITK image by an ITK image with one or more parameters.
#define TestImageType(type, dim)
int mitkAccessByItkTest(int, char *[])
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
#define MITK_TEST_OUTPUT(x)
Output some text.
#define AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq)
Access a mitk-image with known type (pixel type and dimension) by an itk-image.
#define AccessVectorPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple)
Access a vector mitk::Image by an ITK vector image with one or more parameters.
#define TestVectorImageType(type, dim)
#define MITK_TEST_CONDITION(COND, MSG)
#define MITK_TEST_FOR_EXCEPTION_BEGIN(EXCEPTIONCLASS)
Begin block which should be checked for exceptions.
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
#define AccessFixedPixelTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq)
Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image. ...
Exception class thrown in AccessByItk macros.
#define AccessVectorPixelTypeByItk(mitkImage, itkImageTypeFunction)
#define AccessTwoImagesFixedDimensionByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension)
Access two mitk-images with known dimension by itk-images.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.