Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mitkImage.h"
00019 #include "mitkHistogramMatching.h"
00020
00021 int mitkHistogramMatchingTest(int , char* [])
00022 {
00023
00024 mitk::Image::Pointer image;
00025 mitk::PixelType pt(typeid(int));
00026 unsigned int dim[]={100,100,20};
00027
00028 std::cout << "Creating image: ";
00029 image = mitk::Image::New();
00030
00031 image->Initialize(mitk::PixelType(typeid(int)), 3, dim);
00032 int *p = (int*)image->GetData();
00033
00034 int size = dim[0]*dim[1]*dim[2];
00035 int i;
00036 for(i=0; i<size; ++i, ++p)
00037 *p=i;
00038 std::cout<<"[PASSED]"<<std::endl;
00039
00040
00041 mitk::Image::Pointer image2;
00042 mitk::PixelType pt2(typeid(int));
00043 unsigned int dim2[]={100,100,20};
00044
00045 std::cout << "Creating image: ";
00046 image2 = mitk::Image::New();
00047
00048 image2->Initialize(mitk::PixelType(typeid(int)), 3, dim2);
00049 int *p2 = (int*)image2->GetData();
00050
00051 int size2 = dim2[0]*dim2[1]*dim2[2];
00052 int i2;
00053 for(i2=0; i2<size2; ++i2, ++p2)
00054 *p2=i2;
00055 std::cout<<"[PASSED]"<<std::endl;
00056
00057 std::cout << "Constructor: ";
00058 mitk::HistogramMatching::Pointer histogramMatching = mitk::HistogramMatching::New();
00059 std::cout<<"[PASSED]"<<std::endl;
00060
00061 std::cout << "Set Reference Image: ";
00062 histogramMatching->SetReferenceImage(image);
00063 std::cout<<"[PASSED]"<<std::endl;
00064
00065 std::cout << "Set Moving Image: ";
00066 histogramMatching->SetInput(image2);
00067 std::cout<<"[PASSED]"<<std::endl;
00068
00069 std::cout << "Set number of match points: ";
00070 histogramMatching->SetNumberOfMatchPoints(100);
00071 std::cout<<"[PASSED]"<<std::endl;
00072
00073 std::cout << "Set number of histogram levels: ";
00074 histogramMatching->SetNumberOfHistogramLevels(8);
00075 std::cout<<"[PASSED]"<<std::endl;
00076
00077 std::cout << "Set threshold at mean intensity: ";
00078 histogramMatching->SetThresholdAtMeanIntensity(true);
00079 std::cout<<"[PASSED]"<<std::endl;
00080
00081 std::cout << "Perform histogram matching: ";
00082 histogramMatching->Update();
00083 std::cout<<"[PASSED]"<<std::endl;
00084
00085 std::cout << "Get the result image: ";
00086 mitk::Image::Pointer histimage = histogramMatching->GetOutput();
00087 std::cout<<"[PASSED]"<<std::endl;
00088
00089 return EXIT_SUCCESS;
00090 }