33#include "ramCanvas.hpp"
36int main(
int argc,
char *argv[]) {
37 int numHits = 1, numHitsRel = 0, numClipRel = 0, numCloseRel = 0, linesPrinted = 0;
38 std::random_device rd;
39 std::minstd_rand0 rEng(rd());
40 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
41 mjr::ramCanvas3c8b theRamCanvas(7680/2, 4320/2, -2.2, 2.2, -2.2, 2.2);
42 theRamCanvas.clrCanvas(mjr::ramCanvas3c8b::colorType(255, 0, 0));
43 int MAXNUMPT = 524288;
44 int MAXCOUNT = 524288;
46 if((argc < 3) || (argc > 5)) {
47 std::cout <<
"ERROR: Useage: dlaBrownian inFile.tiff outFile.tiff [ITERATIONS [POINTS]]" << std::endl;
50 if(theRamCanvas.readTIFFfile(argv[1])) {
51 std::cout <<
"ERROR: Problem with file: " << argv[2] << std::endl;
56 MAXCOUNT = std::stoi(argv[3]);
58 MAXNUMPT = std::stoi(argv[4]);
60 for(
int numPt=1;numPt<MAXNUMPT;numPt++) {
62 mjr::ramCanvas3c8b::coordIntType x, y;
63 x = rEng() % theRamCanvas.getNumPixX();
64 y = rEng() % theRamCanvas.getNumPixY();
65 if(theRamCanvas.getPxColor(x+0, y+0).getC2()) {
69 for(
int count=0;count<MAXCOUNT;count++) {
70 mjr::ramCanvas3c8b::colorType aColor;
74 x++; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
76 x--; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
78 y++; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
80 y--; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
82 x++; y++; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
84 x++; y--; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
86 x--; y++; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
88 x--; y--; aColor = mjr::ramCanvas3c8b::colorType(0, 0, 255);
break;
90 if(x<1 || y<1 || x>(theRamCanvas.getNumPixX()-2) || y>(theRamCanvas.getNumPixY()-2)) {
94 if(theRamCanvas.getPxColor(x+1, y+0).getC2() ||
95 theRamCanvas.getPxColor(x-1, y+0).getC2() ||
96 theRamCanvas.getPxColor(x+0, y+1).getC2() ||
97 theRamCanvas.getPxColor(x+0, y-1).getC2() ||
98 theRamCanvas.getPxColor(x+1, y+1).getC2() ||
99 theRamCanvas.getPxColor(x+1, y-1).getC2() ||
100 theRamCanvas.getPxColor(x-1, y+1).getC2() ||
101 theRamCanvas.getPxColor(x-1, y-1).getC2()
103 theRamCanvas.drawPoint(x, y, aColor);
110 if((numPt%1024)==0) {
111 if(linesPrinted == 0) {
112 std::cout << std::setw(10) <<
"HITS/1k" <<
" " << std::setw(10) <<
"CLIPS/1k" <<
" " << std::setw(10) <<
"CLOSE/1k";
113 std::cout <<
" " << std::setw(10) <<
"HITS" <<
" @ " << std::setw(10) <<
"POINTS" << std::endl;
116 if(linesPrinted > 20)
118 std::cout << std::setw(10) << numHitsRel <<
" " << std::setw(10) << numClipRel <<
" " << std::setw(10) << numCloseRel;
119 std::cout <<
" " << std::setw(10) << numHits <<
" @ " << std::setw(10) << numPt << std::endl;
125 if(theRamCanvas.writeTIFFfile(argv[2])) {
126 std::cout <<
"ERROR: Problem with file: " << argv[2] << std::endl;
130 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
131 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])