Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include <mitkImage.h>
18 #include <mitkImageCast.h>
19 #include <mitkImageDataItem.h>
20 
21 #include <mitkBoundingObject.h>
23 #include <mitkCuboid.h>
24 
25 #include <itkImage.h>
26 
27 #include <fstream>
28 
29 #include <vtkImageData.h>
30 
31 #include <mitkTestingMacros.h>
32 
33 int mitkBoundingObjectCutterTest(int /*argc*/, char * /*argv*/ [])
34 {
36 
38  // mitk::Image::Pointer image;
39  // mitk::PixelType pt(mitk::MakeScalarPixelType<int>() );
40  // unsigned int dim[]={100,100,20};
41 
42  // MITK_TEST_OUTPUT(<< "Creating Image as imput for cutting: ");
43  // image=mitk::Image::New();
44  // image->Initialize(mitk::MakeScalarPixelType<int>(), 3, dim);
45  // mitk::ImageReadAccessor imgAcc(image);
46  // int *p = (int*)imgAcc.GetData();
47  // unsigned int i;
48  // unsigned int size = dim[0]*dim[1]*dim[2];
49  // for(i=0; i<size; ++i, ++p)
50  // *p= (signed int)i;
51  // std::cout<<"[PASSED]"<<std::endl;
52 
53  // MITK_TEST_OUTPUT(<< "Testing mitk::BoundingObject::FitGeometry(image->GetGeometry()) with an mitk::Cuboid
54  // (sub-class of mitk::BoundingObject): ");
55  // mitk::Cuboid::Pointer cuboid = mitk::Cuboid::New();
56  // cuboid->FitGeometry(image->GetGeometry());
57  // std::cout<<"[PASSED]"<<std::endl;
58 
59  // MITK_TEST_OUTPUT(<< "Testing whether corners of the cuboid are identical to corners of the image: ");
60  // int c;
61  // for(c=0; c<6; ++c)
62  // {
63  // MITK_TEST_OUTPUT(<< " Testing GetCornerPoint(" << c << "): ");
64  // MITK_TEST_CONDITION_REQUIRED(
65  // mitk::Equal(image->GetGeometry()->GetCornerPoint(c),cuboid->GetGeometry()->GetCornerPoint(c)-1), "");
66  // }
67 
68  // MITK_TEST_OUTPUT(<< "Testing whether diagonal^2 of fitted mitk::Cuboid is identical to diagonal^2 of image: ");
69  // MITK_TEST_CONDITION_REQUIRED(
70  // mitk::Equal(image->GetGeometry()->GetDiagonalLength2(),cuboid->GetGeometry()->GetDiagonalLength2()), "");
71 
72  // MITK_TEST_OUTPUT(<< "Testing mitk::BoundingObjectCutter: ");
73  // mitk::BoundingObjectCutter::Pointer boCutter = mitk::BoundingObjectCutter::New();
74  // boCutter->SetInput(image);
75  // boCutter->SetBoundingObject(cuboid);
76  // MITK_TEST_OUTPUT(<< " Testing mitk::BoundingObjectCutter::UpdateLargestPossibleRegion():: ");
77  // boCutter->UpdateLargestPossibleRegion();
78  // std::cout<<"[PASSED]"<<std::endl;
79 
80  // mitk::Image::Pointer cuttedImage = boCutter->GetOutput();
81 
82  // MITK_TEST_OUTPUT(<< " Testing whether origin of cutted image is identical to origin of original image: ");
83  // MITK_TEST_CONDITION_REQUIRED(
84  // mitk::Equal(image->GetGeometry()->GetOrigin(),cuttedImage->GetGeometry()->GetOrigin()), "");
85 
86  // MITK_TEST_OUTPUT(<< " Testing whether spacing of cutted image is identical to spacing of original image: ");
87  // MITK_TEST_CONDITION_REQUIRED(
88  // mitk::Equal(image->GetGeometry()->GetSpacing(),cuttedImage->GetGeometry()->GetSpacing()), "");
89 
90  // MITK_TEST_OUTPUT(<< " Testing whether center of cutted image is identical to center of original image: ");
91  // MITK_TEST_CONDITION_REQUIRED(
92  // mitk::Equal(image->GetGeometry()->GetCenter(),cuttedImage->GetGeometry()->GetCenter()), "");
93 
94  // MITK_TEST_OUTPUT(<< " Testing whether diagonal^2 of cutted image is identical to diagonal^2 of original image: ");
95  // MITK_TEST_CONDITION_REQUIRED(
96  // mitk::Equal(image->GetGeometry()->GetDiagonalLength2(),cuttedImage->GetGeometry()->GetDiagonalLength2()), "");
97 
98  // MITK_TEST_OUTPUT(<< " Testing whether corners of cutted image are identical to corners of original image: ");
99  // for(c=0; c<6; ++c)
100  //{
101  // MITK_TEST_OUTPUT(<< " Testing GetCornerPoint(" << c << "): ");
102  // MITK_TEST_CONDITION_REQUIRED(
103  // mitk::Equal(image->GetGeometry()->GetCornerPoint(c),cuttedImage->GetGeometry()->GetCornerPoint(c)), "");
104  //}
105 
106  // MITK_TEST_OUTPUT(<< " Testing whether pixel data of cutted image are identical to pixel data of original image: ");
107  // mitk::ImageReadAccessor imgAcc(image);
108  // p = (int*)imgAcc.GetData();
109  // mitk::ImageReadAccessor cuttedImage(cuttedImage);
110  // int *pCutted = (int*)cuttedImage.GetData();
111  // for(i=0; i<size; ++i, ++p, ++pCutted)
112  //{
113  // if(*p!=*pCutted)
114  // break;
115  //}
116  // MITK_TEST_CONDITION_REQUIRED(i==size, "");
117 
118  // MITK_TEST_OUTPUT(<< " Testing whether geometry of cutted image has ImageGeometry==true: ");
119  // MITK_TEST_CONDITION_REQUIRED(cuttedImage->GetGeometry()->GetImageGeometry(), "");
120 
121  MITK_TEST_END();
122 
123  return EXIT_SUCCESS;
124 }
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
and MITK_TEST_END()
int mitkBoundingObjectCutterTest(int, char *[])