Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkBoundingObjectCutterTest.cpp
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#include <
mitkImage.h
>
14
#include <
mitkImageCast.h
>
15
#include <
mitkImageDataItem.h
>
16
17
#include <
mitkBoundingObject.h
>
18
#include <
mitkBoundingObjectCutter.h
>
19
#include <
mitkCuboid.h
>
20
21
#include <itkImage.h>
22
23
#include <fstream>
24
25
#include <vtkImageData.h>
26
27
#include <
mitkTestingMacros.h
>
28
29
int
mitkBoundingObjectCutterTest
(
int
/*argc*/
,
char
*
/*argv*/
[])
30
{
31
MITK_TEST_BEGIN
(
mitkBoundingObjectCutterTest
);
32
34
// mitk::Image::Pointer image;
35
// mitk::PixelType pt(mitk::MakeScalarPixelType<int>() );
36
// unsigned int dim[]={100,100,20};
37
38
// MITK_TEST_OUTPUT(<< "Creating Image as imput for cutting: ");
39
// image=mitk::Image::New();
40
// image->Initialize(mitk::MakeScalarPixelType<int>(), 3, dim);
41
// mitk::ImageReadAccessor imgAcc(image);
42
// int *p = (int*)imgAcc.GetData();
43
// unsigned int i;
44
// unsigned int size = dim[0]*dim[1]*dim[2];
45
// for(i=0; i<size; ++i, ++p)
46
// *p= (signed int)i;
47
// std::cout<<"[PASSED]"<<std::endl;
48
49
// MITK_TEST_OUTPUT(<< "Testing mitk::BoundingObject::FitGeometry(image->GetGeometry()) with an mitk::Cuboid
50
// (sub-class of mitk::BoundingObject): ");
51
// mitk::Cuboid::Pointer cuboid = mitk::Cuboid::New();
52
// cuboid->FitGeometry(image->GetGeometry());
53
// std::cout<<"[PASSED]"<<std::endl;
54
55
// MITK_TEST_OUTPUT(<< "Testing whether corners of the cuboid are identical to corners of the image: ");
56
// int c;
57
// for(c=0; c<6; ++c)
58
// {
59
// MITK_TEST_OUTPUT(<< " Testing GetCornerPoint(" << c << "): ");
60
// MITK_TEST_CONDITION_REQUIRED(
61
// mitk::Equal(image->GetGeometry()->GetCornerPoint(c),cuboid->GetGeometry()->GetCornerPoint(c)-1), "");
62
// }
63
64
// MITK_TEST_OUTPUT(<< "Testing whether diagonal^2 of fitted mitk::Cuboid is identical to diagonal^2 of image: ");
65
// MITK_TEST_CONDITION_REQUIRED(
66
// mitk::Equal(image->GetGeometry()->GetDiagonalLength2(),cuboid->GetGeometry()->GetDiagonalLength2()), "");
67
68
// MITK_TEST_OUTPUT(<< "Testing mitk::BoundingObjectCutter: ");
69
// mitk::BoundingObjectCutter::Pointer boCutter = mitk::BoundingObjectCutter::New();
70
// boCutter->SetInput(image);
71
// boCutter->SetBoundingObject(cuboid);
72
// MITK_TEST_OUTPUT(<< " Testing mitk::BoundingObjectCutter::UpdateLargestPossibleRegion():: ");
73
// boCutter->UpdateLargestPossibleRegion();
74
// std::cout<<"[PASSED]"<<std::endl;
75
76
// mitk::Image::Pointer cuttedImage = boCutter->GetOutput();
77
78
// MITK_TEST_OUTPUT(<< " Testing whether origin of cutted image is identical to origin of original image: ");
79
// MITK_TEST_CONDITION_REQUIRED(
80
// mitk::Equal(image->GetGeometry()->GetOrigin(),cuttedImage->GetGeometry()->GetOrigin()), "");
81
82
// MITK_TEST_OUTPUT(<< " Testing whether spacing of cutted image is identical to spacing of original image: ");
83
// MITK_TEST_CONDITION_REQUIRED(
84
// mitk::Equal(image->GetGeometry()->GetSpacing(),cuttedImage->GetGeometry()->GetSpacing()), "");
85
86
// MITK_TEST_OUTPUT(<< " Testing whether center of cutted image is identical to center of original image: ");
87
// MITK_TEST_CONDITION_REQUIRED(
88
// mitk::Equal(image->GetGeometry()->GetCenter(),cuttedImage->GetGeometry()->GetCenter()), "");
89
90
// MITK_TEST_OUTPUT(<< " Testing whether diagonal^2 of cutted image is identical to diagonal^2 of original image: ");
91
// MITK_TEST_CONDITION_REQUIRED(
92
// mitk::Equal(image->GetGeometry()->GetDiagonalLength2(),cuttedImage->GetGeometry()->GetDiagonalLength2()), "");
93
94
// MITK_TEST_OUTPUT(<< " Testing whether corners of cutted image are identical to corners of original image: ");
95
// for(c=0; c<6; ++c)
96
//{
97
// MITK_TEST_OUTPUT(<< " Testing GetCornerPoint(" << c << "): ");
98
// MITK_TEST_CONDITION_REQUIRED(
99
// mitk::Equal(image->GetGeometry()->GetCornerPoint(c),cuttedImage->GetGeometry()->GetCornerPoint(c)), "");
100
//}
101
102
// MITK_TEST_OUTPUT(<< " Testing whether pixel data of cutted image are identical to pixel data of original image: ");
103
// mitk::ImageReadAccessor imgAcc(image);
104
// p = (int*)imgAcc.GetData();
105
// mitk::ImageReadAccessor cuttedImage(cuttedImage);
106
// int *pCutted = (int*)cuttedImage.GetData();
107
// for(i=0; i<size; ++i, ++p, ++pCutted)
108
//{
109
// if(*p!=*pCutted)
110
// break;
111
//}
112
// MITK_TEST_CONDITION_REQUIRED(i==size, "");
113
114
// MITK_TEST_OUTPUT(<< " Testing whether geometry of cutted image has ImageGeometry==true: ");
115
// MITK_TEST_CONDITION_REQUIRED(cuttedImage->GetGeometry()->GetImageGeometry(), "");
116
117
MITK_TEST_END
();
118
119
return
EXIT_SUCCESS;
120
}
mitkImageCast.h
mitkTestingMacros.h
mitkImageDataItem.h
MITK_TEST_BEGIN
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
mitkCuboid.h
mitkBoundingObjectCutter.h
mitkBoundingObject.h
mitkImage.h
MITK_TEST_END
and MITK_TEST_END()
mitkBoundingObjectCutterTest
int mitkBoundingObjectCutterTest(int, char *[])
Definition:
mitkBoundingObjectCutterTest.cpp:29
Source
Modules
AlgorithmsExt
test
mitkBoundingObjectCutterTest.cpp
Generated on Thu Mar 12 2020 10:23:39 for Medical Imaging Interaction Toolkit by
1.8.13