39#include "ramCanvas.hpp"
42typedef mjr::ramCanvas3c8b rct;
43typedef rct::colorType ct;
46std::vector<std::array<mjr::ramCanvas1c16b::coordFltType, 12>> params {
48 { 1.375390, -0.4212800, 0.26969, 0.08352, 0.338347, 6, 15.00, -1.30, 1.30, -1.30, 1.30, 1.0},
49 { 1.600230, -1.1340800, -0.17506, 0.67872, 0.049490, 6, 14.00, 0.10, 0.70, 0.43, 0.90, 0.0},
50 { 1.000890, -0.7678100, 1.89425, -1.13943, -0.688827, 7, 10.00, -0.90, 0.90, -0.90, 0.90, 0.0},
51 {-1.563400, 1.7238200, 0.74440, 0.71874, 0.258907, 3, 8.00, -0.75, 0.75, -0.75, 0.75, 1.0},
52 { 1.361000, -1.8225400, -0.92635, -1.74108, -0.761120, 5, 2.00, -0.70, 0.70, -0.70, 0.70, 1.0},
53 { 1.609310, -1.6924900, 0.85055, 0.26523, -0.716769, 5, 4.00, -0.90, 0.90, -0.90, 0.90, 0.0},
54 { 1.464900, -1.8825700, -1.47205, -0.83559, -0.701477, 4, 3.00, -0.80, 0.80, -0.80, 0.80, 1.0},
55 { 1.622110, -1.0694500, -0.11181, 0.62253, 0.784032, 4, 2.00, -1.20, 1.20, -1.20, 1.20, 1.0},
56 {-1.380150, 0.7472100, 1.17094, 0.05782, -0.574188, 6, 10.00, -1.00, 1.00, -1.00, 1.00, 0.0},
57 { 0.335010, -1.3467500, -0.65137, -0.87848, -1.231490, 5, 10.00, -1.20, 1.20, -1.20, 1.20, 1.0},
58 {-1.496290, 1.8701600, -1.93938, -0.88084, -0.139602, 3, 10.00, -0.55, 0.55, -0.55, 0.55, 1.0},
59 {-1.248610, 1.0816100, -0.50731, 0.97272, -0.853955, 11, 10.00, -1.00, 1.00, -1.00, 1.00, 0.0},
60 {-1.991900, 1.8219100, -0.38273, 0.68143, 0.493416, 11, 10.00, -1.00, 1.00, -1.00, 1.00, 0.0},
61 { 1.694170, -1.2730200, 0.75035, -1.28615, 0.561096, 6, 2.50, -1.10, 1.10, -1.10, 1.10, 1.0},
62 {-0.386753, -0.0610025, -1.02847, 0.78619, -0.984828, 3, 5.00, -1.20, 1.20, -1.20, 1.20, 0.0},
63 { 0.982876, -1.1125600, 0.500411, -1.44111, -1.008560, 4, 7.00, -0.80, 0.80, -0.80, 0.80, 0.0},
64 {-1.257170, 0.0390811, 0.13892, -0.87058, 0.023977, 7, 2.60, -1.20, 1.20, -1.20, 1.20, 1.0},
65 { 1.008500, 0.2275230, -0.56604, -0.62146, 0.693161, 5, 3.00, -1.20, 1.20, -1.20, 1.20, 1.0},
66 { 1.618250, -1.6035300, 1.13920, -1.60120, -0.761638, 5, 2.80, -1.00, 1.00, -1.00, 1.00, 0.0},
67 {-0.960670, 0.0834029, 1.01438, 1.05748, -0.599590, 21, 2.60, -1.20, 1.20, -1.20, 1.20, 1.0},
68 { 0.908230, 0.3047990, 1.03560, 0.29872, -0.473521, 7, 3.00, -1.20, 1.20, -1.20, 1.20, 0.0},
69 { 1.873130, -1.2822600, -1.28938, -1.36355, -0.141951, 21, 2.00, -1.10, 1.10, -1.10, 1.10, 1.0},
70 { 1.536250, -0.6547000, -1.43255, -0.24270, 0.128769, 31, 2.50, -1.00, 1.00, -1.00, 1.00, 0.0},
71 {-2.080000, 1.0000000, -0.10000, 0.16700, 0.000000, 7, 4.00, -1.20, 1.20, -1.20, 1.20, 0.0},
72 {-2.500000, 5.0000000, -1.90000, 1.00000, 0.180000, 5, 2.75, -0.75, 0.75, -0.75, 0.75, 0.0},
73 { 2.500000, -2.5000000, 0.00000, 0.90000, 0.000000, 3, 2.75, -1.40, 1.40, -1.40, 1.40, 0.0},
74 { 2.600000, -2.0000000, 0.00000, -0.50000, 0.000000, 5, 4.75, -1.30, 1.30, -1.30, 1.30, 1.0},
84 mjr::ramCanvas1c16b& attachedRC;
87 g2rgb8(mjr::ramCanvas1c16b& aRC, uint64_t newFactor) : attachedRC(aRC), factor(static_cast<int>(newFactor)) { }
88 inline bool isIntAxOrientationNaturalX() {
return attachedRC.isIntAxOrientationNaturalX(); }
89 inline bool isIntAxOrientationNaturalY() {
return attachedRC.isIntAxOrientationNaturalY(); }
90 inline mjr::ramCanvas1c16b::coordIntType getNumPixX() {
return attachedRC.getNumPixX(); }
91 inline mjr::ramCanvas1c16b::coordIntType getNumPixY() {
return attachedRC.getNumPixY(); }
92 typedef mjr::colorRGB8b colorType;
93 inline colorType getPxColorNC(rct::coordIntType x, rct::coordIntType y) {
95 rct::csIntType tmp =
static_cast<rct::csIntType
>(attachedRC.getPxColorNC(x, y).getC0() * 1275 / factor);
96 return retColor.cmpRGBcornerDGradiant(tmp,
"0RYBCW");
102 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
103 const int BSIZ = 7680/4;
104 mjr::ramCanvas1c16b::colorType aColor;
106 for(
decltype(params.size()) j=0; j<params.size(); ++j) {
107 mjr::ramCanvas1c16b theRamCanvas(BSIZ, BSIZ, params[j][7], params[j][8], params[j][9], params[j][10]);
108 typename mjr::ramCanvas1c16b::coordFltType lambda = params[j][0];
109 typename mjr::ramCanvas1c16b::coordFltType alpha = params[j][1];
110 typename mjr::ramCanvas1c16b::coordFltType beta = params[j][2];
111 typename mjr::ramCanvas1c16b::coordFltType gamma = params[j][3];
112 typename mjr::ramCanvas1c16b::coordFltType w = params[j][4];
113 double ipw =
static_cast<double>(params[j][6]);
114 int n =
static_cast<int>( params[j][5]);
115 int filter =
static_cast<int>( params[j][11]);
117 std::complex<typename mjr::ramCanvas1c16b::coordFltType> cplxi (0,1);
119 uint64_t maxitr = 10000000000ul;
121 std::complex<typename mjr::ramCanvas1c16b::coordFltType> z(.01,.01);
123 for(uint64_t i=0;i<maxitr;i++) {
124 z = (lambda + alpha*z*std::conj(z)+beta*std::pow(z, n).real() + w*cplxi)*z+gamma*std::pow(std::conj(z), n-1);
125 typename mjr::ramCanvas1c16b::coordFltType x=z.real(), y=z.imag();
127 theRamCanvas.drawPoint(x, y, theRamCanvas.getPxColor(x, y).tfrmAdd(aColor));
128 if(theRamCanvas.getPxColor(x, y).getC0() > maxII) {
129 maxII = theRamCanvas.getPxColor(x, y).getC0();
131 std::cout <<
"ITER(" << j <<
"): " << i <<
" MAXS: " << maxII <<
" EXIT: Maximum image intensity reached" << std::endl;
135 if((i % 10000000) == 0)
136 std::cout <<
"ITER(" << j <<
"): " << i <<
" MAXS: " << maxII << std::endl;
139 std::cout <<
"ITER(" << j <<
"): " <<
"Big TIFF" << std::endl;
140 theRamCanvas.writeTIFFfile(
"sic_" + mjr::math::str::fmt_int(j, 2,
'0') +
".tiff");
143 std::cout <<
"ITER(" << j <<
"): " <<
"TFRM & SCALE" << std::endl;
144 theRamCanvas.autoHistStrech();
146 theRamCanvas.applyHomoPixTfrm(&mjr::ramCanvas1c16b::colorType::tfrmStdPow, 1/ipw);
148 theRamCanvas.scaleDownMean(4);
150 theRamCanvas.scaleDownMax(4);
151 theRamCanvas.autoHistStrech();
154 std::cout <<
"ITER(" << j <<
"): " <<
"MAX" << std::endl;
156 for(
auto& pixel : theRamCanvas)
157 if(pixel.getC0() > maxII)
158 maxII = pixel.getC0();
160 std::cout <<
"ITER(" << j <<
"): " <<
"TIFF" << std::endl;
162 theRamCanvas.writeTIFFfile(
"sicM_" + mjr::math::str::fmt_int(j, 2,
'0') +
".tiff");
173 g2rgb8 rcFilt(theRamCanvas, maxII);
174 theRamCanvas.writeTIFFfile(
"sicCC_" + mjr::math::str::fmt_int(j, 2,
'0') +
".tiff", rcFilt,
false);
176 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
177 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])