00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CSPadPixCoords/PixCoords2x1.h"
00018 #include "CSPadPixCoords/Image2D.h"
00019
00020 #include <string>
00021 #include <iostream>
00022
00023 using std::cout;
00024 using std::endl;
00025
00026
00027
00028
00029
00030 void test01()
00031 {
00032 CSPadPixCoords::PixCoords2x1 *pix_coords_2x1 = new CSPadPixCoords::PixCoords2x1();
00033
00034 pix_coords_2x1 -> print_member_data();
00035
00036 pix_coords_2x1 -> print_selected_coords_2x1(CSPadPixCoords::PixCoords2x1::ROW);
00037 pix_coords_2x1 -> print_selected_coords_2x1(CSPadPixCoords::PixCoords2x1::COL);
00038 pix_coords_2x1 -> print_selected_coords_2x1(CSPadPixCoords::PixCoords2x1::ORT);
00039
00040 }
00041
00042
00043
00044 void test02()
00045 {
00046 enum{ NX=600, NY=300 };
00047 double arr[NY][NX];
00048
00049 for (unsigned iy=0; iy<NY; iy++){
00050 for (unsigned ix=0; ix<NX; ix++){
00051 arr[iy][ix] = ix + iy;
00052 }
00053 }
00054
00055 CSPadPixCoords::Image2D<double> *img2d = new CSPadPixCoords::Image2D<double>(&arr[0][0],NY,NX);
00056 img2d -> saveImageInFile("test.txt",0);
00057 }
00058
00059
00060
00061 void test03()
00062 {
00063
00064
00065 enum{ NX=500, NY=500 };
00066 double arr[NY][NX];
00067 for (unsigned iy=0; iy<NY; iy++){
00068 for (unsigned ix=0; ix<NX; ix++){
00069 arr[iy][ix] = 0;
00070 }
00071 }
00072
00073
00074 CSPadPixCoords::PixCoords2x1 *pix_coords_2x1 = new CSPadPixCoords::PixCoords2x1();
00075 pix_coords_2x1 -> print_member_data();
00076
00077
00078 enum{ NROWS=CSPadPixCoords::PixCoords2x1::NRows2x1,
00079 NCOLS=CSPadPixCoords::PixCoords2x1::NCols2x1 };
00080
00081 CSPadPixCoords::PixCoords2x1::ORIENTATION rot=CSPadPixCoords::PixCoords2x1::R000;
00082 CSPadPixCoords::PixCoords2x1::COORDINATE X =CSPadPixCoords::PixCoords2x1::X;
00083 CSPadPixCoords::PixCoords2x1::COORDINATE Y =CSPadPixCoords::PixCoords2x1::Y;
00084
00085 cout << "NROWS=" << NROWS << endl;
00086 cout << "NCOLS=" << NCOLS << endl;
00087
00088
00089
00090
00091
00092
00093 unsigned mrgx=20;
00094 unsigned mrgy=20;
00095
00096 for (unsigned r=0; r<NROWS; r++){
00097 for (unsigned c=0; c<NCOLS; c++){
00098
00099 double x = pix_coords_2x1 -> getPixCoorRotN90_pix (rot, X, r, c);
00100 double y = pix_coords_2x1 -> getPixCoorRotN90_pix (rot, Y, r, c);
00101
00102
00103
00104
00105 int iy = mrgy + (int)y;
00106 int ix = mrgx + (int)x;
00107
00108
00109
00110
00111
00112
00113 arr[iy][ix] = ix;
00114 }
00115 }
00116
00117 CSPadPixCoords::Image2D<double> *img2d = new CSPadPixCoords::Image2D<double>(&arr[0][0],NY,NX);
00118 img2d -> saveImageInFile("test.txt",0);
00119 }
00120
00121
00122
00123 int main ()
00124 {
00125 test01();
00126 test02();
00127 test03();
00128
00129 return 0;
00130 }
00131
00132
00133