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 =
static_cast<int>(rEng() % theRamCanvas.getNumPixX());
64 y =
static_cast<int>(rEng() % theRamCanvas.getNumPixY());
65 if(theRamCanvas.getPxColor(x+0, y+0).getC2()) {
69 for(
int count=0;count<MAXCOUNT;count++) {
70 int rn =
static_cast<int>(rEng() % 5);
83 if(x<1 || y<1 || x>(theRamCanvas.getNumPixX()-2) || y>(theRamCanvas.getNumPixY()-2)) {
87 if(theRamCanvas.getPxColor(x+1, y+0).getC2() ||
88 theRamCanvas.getPxColor(x-1, y+0).getC2() ||
89 theRamCanvas.getPxColor(x+0, y+1).getC2() ||
90 theRamCanvas.getPxColor(x+0, y-1).getC2() ||
91 theRamCanvas.getPxColor(x+1, y+1).getC2() ||
92 theRamCanvas.getPxColor(x+1, y-1).getC2() ||
93 theRamCanvas.getPxColor(x-1, y+1).getC2() ||
94 theRamCanvas.getPxColor(x-1, y-1).getC2()
96 theRamCanvas.drawPoint(x, y, mjr::ramCanvas3c8b::colorType(0, 0, 255));
103 if((numPt%1024)==0) {
104 if(linesPrinted == 0) {
105 std::cout << std::setw(10) <<
"HITS/1k" <<
" " << std::setw(10) <<
"CLIPS/1k" <<
" " << std::setw(10) <<
"CLOSE/1k";
106 std::cout <<
" " << std::setw(10) <<
"HITS" <<
" @ " << std::setw(10) <<
"POINTS" << std::endl;
109 if(linesPrinted > 20)
111 std::cout << std::setw(10) << numHitsRel <<
" " << std::setw(10) << numClipRel <<
" " << std::setw(10) << numCloseRel;
112 std::cout <<
" " << std::setw(10) << numHits <<
" @ " << std::setw(10) << numPt << std::endl;
118 if(theRamCanvas.writeTIFFfile(argv[2])) {
119 std::cout <<
"ERROR: Problem with file: " << argv[2] << std::endl;
123 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
124 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])