BamCatHeader(std::vector<libmaus2::bambam::BamAlignmentDecoderInfo> const & V) : orderedCoordinates(true), orderedNames(true) { libmaus2::autoarray::AutoArray< libmaus2::bambam::BamAlignmentDecoderWrapper::unique_ptr_type > wraps(V.size()); libmaus2::autoarray::AutoArray< libmaus2::bambam::BamAlignmentDecoder * > decs(V.size()); for ( uint64_t i = 0; i < V.size(); ++i ) { libmaus2::bambam::BamAlignmentDecoderWrapper::unique_ptr_type tptr ( BamAlignmentDecoderFactory::construct(V[i]) ); wraps[i] = UNIQUE_PTR_MOVE(tptr); decs[i] = &(wraps[i]->getDecoder()); } init(decs.begin(),decs.size()); }
box page_box (path ip, box b, tree page, SI width, SI height, SI left, SI top, SI bot, box header, box footer, SI head_sep, SI foot_sep) { SI h_y= -top- header->y1+ head_sep; SI f_y= -bot- footer->y2- foot_sep; array<box> bs (1); bs [0]= b; array<SI> bs_x (1); bs_x [0]= left; array<SI> bs_y (1); bs_y [0]= -top; array<box> decs (2); decs [0]= header; decs [1]= footer; array<SI> decs_x (2); decs_x [0]= left ; decs_x [1]= left; array<SI> decs_y (2); decs_y [0]= h_y ; decs_y [1]= f_y; return page_box (ip, page, width, height, bs, bs_x, bs_y, decs, decs_x, decs_y); }
static libmaus::bambam::BamCatHeader::unique_ptr_type constructHeader( std::vector<libmaus::bambam::BamAlignmentDecoderInfo> const & infos, wrapper_pointer_array_pointer_type & Pwrappers ) { if ( Pwrappers.get() ) { libmaus::autoarray::AutoArray<libmaus::bambam::BamAlignmentDecoder *> decs(Pwrappers->size()); for ( uint64_t i = 0; i < Pwrappers->size(); ++i ) decs[i] = &((*Pwrappers)[i]->getDecoder()); libmaus::bambam::BamCatHeader::unique_ptr_type tptr(new libmaus::bambam::BamCatHeader(decs)); return UNIQUE_PTR_MOVE(tptr); } else { libmaus::bambam::BamCatHeader::unique_ptr_type tptr(new libmaus::bambam::BamCatHeader(infos)); return UNIQUE_PTR_MOVE(tptr); } }
int main() { char d = 'r'; // Intialise restart variable to 'r' so the program runs on launch. do { if (d == 'r' || d == 'R') { char d = 'x'; // Set the restart variable back to 'x' to stop further loops. //============================================================= // // SET ARRAY TO 0 // //============================================================= int i, j, z; // Setting all the values of the array i = Y axis j = X axis z = Colour type (RGB). for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { for (z = 0; z < 3; z++) { numbers[i][j][z] = 0; // Sets the whole array to 0. } } } //============================================================= // // DRAW AXIS LINES // //============================================================= /*Set Y Axis Line*/ { int y, w; // y = y axis level, w = axis line width. for (y = 8; y < 109; y++) { for (w = 37; w < 39; w++) { numbers[y][w][0] = 255; numbers[y][w][1] = 255; numbers[y][w][2] = 255; } } } /*Set X Axis Line*/ { int x, w; // x = x axis level, w = axis line width. for (x = 37; x < 219; x++) { for (w = 109; w < 111; w++) { numbers[w][x][0] = 255; numbers[w][x][1] = 255; numbers[w][x][2] = 255; } } } /*Set X Axis Centre Line*/ { int x; // x = x axis level. for (x = 39; x < 219; x++) { numbers[58][x][0] = 168; numbers[58][x][1] = 177; numbers[58][x][2] = 181; } } //============================================================= // // DRAW AXIS TICKS // //============================================================= /*Y Axis Ticks*/ { int x, c; for (x = 35; x < 37; x++) { for (c = 0; c < 3; c++) { numbers[19][x][c] = 255; // '1.0' Value Tick numbers[58][x][c] = 255; // '0.0' value Tick numbers[97][x][c] = 255; // '-1.0' value Tick } } } /*X Axis Ticks */ { int y, c; for (y = 111; y < 113; y++) { for (c = 0; c < 3; c++) { numbers[y][39][c] = 255; // '0 deg' value Tick numbers[y][83][c] = 255; // '180 deg' value Tick numbers[y][128][c] = 255; // '360 deg' value Tick numbers[y][173][c] = 255; // '540 deg' value Tick numbers[y][218][c] = 255; // '720 deg' value Tick } } } //============================================================= // // Y AXIS NUMBERS // //============================================================= ones(17, 26); // decs(21, 28); // "1.0" zero(17, 30); // zero(56, 24); // decs(59, 28); // "0.0" zero(56, 30); // dec2(97, 23); // ones(95, 26); // "-1.0" decs(99, 28); // zero(95, 30); // //============================================================= // // X AXIS NUMBERS // //============================================================= zero(114, 38); // "0" zero(114, 82); // zero(114, 86); // "180" ones(114, 80); // decs(116, 83); // dec2(114, 123); // dec2(116, 123); // dec2(118, 123); // zero(114, 131); // dec2(116, 128); // "360" dec2(118, 128); // decs(117, 129); // ones(114, 125); // ones(114, 127); // zero(114, 176); // dec2(114, 168); // dec3(114, 167); // decs(116, 168); // dec3(116, 169); // "540" dec2(118, 167); // dec3(114, 171); // dec2(117, 171); // dec3(116, 173); // decs(117, 174); // ones(114, 215); // zero(114, 221); // dec2(114, 213); // dec2(114, 217); // decs(114, 219); // "720" decs(115, 219); // decs(116, 218); // decs(117, 217); // dec2(118, 217); // decs(118, 219); // //============================================================= // // WAVEFORMS // //============================================================= int inp, r1[999], g1[999], b1[999]; // Previous waveform colour save arrays. { int t = 0; int offt, offs, ap, j, z, c, r, g, b; double val; ap = 40; // Amplitude. val = PI / 180; // Radians to degrees conversion. offt = 39; // Offset in the x direction. offs = 58; // Offset in the y direction. int count = 1; printf("How many sine waves of accuracy do you want? "); scanf("%d/n", &inp); time_t e; // Define colour generator. srand((unsigned)time(&e)); // while (inp <= 0 || inp > 999) // Accuracy must be between 1 and 999 { printf("\nNumber must be between 1 and 999! Try again. "); scanf("%d/n", &inp); } if (inp > 500) { printf("\nYikes! This might take a while..."); } else { printf("Please Wait..."); } // BUILD PREVIOUS SINE WAVEFORMS { for (c = inp; c > 0; c--) { int s = 0; j = ((2 * c) - 1); for (t = 0; t < 720; t++) { s = 0; for (count = 1; count <= j; count += 2) { s = (int)((ap / count) * (sin(count*t*val))); // Generate Equation for next waveform. } z = offs - s; numbers[z][offt + (t / 4)][0] = 150; // numbers[z][offt + (t / 4)][1] = 0; // Colour is always dark red for each waveform. numbers[z][offt + (t / 4)][2] = 0; // } } } // BUILD PREVIOUS SQUARE WAVEFORMS { for (c = inp; c > 0; c--) { r = (rand() % 150) + 50; // g = (rand() % 150) + 50; // Create random colour between 50 & 200 for each waveform. b = (rand() % 150) + 50; // r1[c] = r; // g1[c] = g; // Stores colour for each wave to fetch later... b1[c] = b; // int s = 0; j = ((2 * c) - 1); for (t = 0; t < 720; t++) { s = 0; for (count = 1; count <= j; count += 2) { s = (int)(((ap / count) * (sin(count*t*val))) + s); // Generate Equation for next waveform. } z = offs - s; numbers[z][offt + (t / 4)][0] = r; // numbers[z][offt + (t / 4)][1] = g; // Random colour for each waveform. numbers[z][offt + (t / 4)][2] = b; // } } } // BUILD FINAL SQAURE WAVEFORM int s = 0; j = ((2 * inp) - 1); for (t = 0; t < 720; t++) { s = 0; for (count = 1; count <= j; count += 2) { s = (int)(((ap / count) * (sin(count*t*val))) + s); // Generate Equation for next waveform. } z = offs - s; numbers[z][offt + (t / 4)][0] = 245; // numbers[z][offt + (t / 4)][1] = 245; // Final waveform is always yellow. numbers[z][offt + (t / 4)][2] = 60; // } } //============================================================= // // WAVEFORM KEY // //============================================================= { int c; // Line pixel counter. /* "FIRST" */ dec2(13, 218); // ones(13, 217); // "F" dec2(15, 218); // ones(13, 221); // "I" ones(13, 223); // dec2(13, 224); // decs(14, 225); // "R" dec2(15, 224); // decs(16, 224); // decs(17, 225); // dec2(13, 227); // decs(13, 229); // decs(14, 227); // decs(15, 228); // "S" decs(16, 229); // dec2(17, 227); // decs(17, 229); // dec2(13, 231); // decs(13, 233); // "T" dec3(14, 232); // decs(17, 232); // /* First "=" */ dec2(14, 235); decs(14, 237); dec2(16, 235); decs(16, 237); /* "FINAL" */ if (inp > 1) { ones(23, 216); // dec2(23, 217); // "F" dec2(25, 217); // ones(23, 220); // "I" ones(23, 222); // decs(24, 223); // decs(25, 223); // "N" decs(25, 224); // decs(26, 224); // ones(23, 225); // dec3(24, 227); // decs(27, 227); // decs(23, 228); // "A" decs(25, 228); // dec3(24, 229); // decs(27, 229); // ones(23, 231); // "L" dec2(27, 232); // /*Final "="*/ dec2(24, 235); decs(24, 237); dec2(26, 235); decs(26, 237); /*Final Sample Line*/ for (c = 0; c < 15; c++) { numbers[25][239 + c][0] = 245; // numbers[25][239 + c][1] = 245; // Line sample of the final waveform. This is always yellow. numbers[25][239 + c][2] = 60; // } /*First Sample Line*/ for (c = 0; c < 15; c++) { numbers[15][239 + c][0] = r1[1]; // numbers[15][239 + c][1] = g1[1]; // Line sample of the first waveform if > 1 has been displayed. numbers[15][239 + c][2] = b1[1]; // } c = 0; } else { /*First Sample Line*/ for (c = 0; c < 15; c++) { numbers[15][239 + c][0] = 245; // numbers[15][239 + c][1] = 245; // Line sample of the first waveform if only 1 has been displayed. numbers[15][239 + c][2] = 60; // } c = 0; } /* "KEY" */ ones(3, 226); // decs(5, 227); // decs(4, 228); // "K" decs(3, 229); // decs(6, 228); // decs(7, 229); // ones(3, 231); // dec2(3, 232); // "E" dec2(5, 232); // dec2(7, 232); // decs(3, 235); // decs(4, 235); // dec3(5, 236); // "Y" decs(3, 237); // decs(4, 237); // /* "KEY" Underline */ for (c = 224; c < 239; c++) { numbers[8][c][0] = 171; numbers[8][c][1] = 171; numbers[8][c][2] = 171; } c = 0; /* Outer Lines*/ for (c = 0; c < 31; c++) { numbers[c][210][0] = 230; // numbers[c][210][1] = 230; // Vertical "off-white" colour, key boundary line. numbers[c][210][2] = 230; // } c = 0; for (c = 210; c < 256; c++) { numbers[30][c][0] = 230; // numbers[30][c][1] = 230; // Horizontal "off-white" colour, key boundary line. numbers[30][c][2] = 230; // } c = 0; } //============================================================= // // OPEN AND SET PPM FILE HEADER // //============================================================= FILE *pfile = NULL; // Create file pointer and set to NULL. if ((pfile = fopen("myimage.ppm", "w")) == NULL) /* Checks if the .pmm file can be opened successfully. Returns -1 if there is a problem.*/ { printf("\nThere was a problem opening '%s', please contact support.", "myimage.ppm"); return -1; } fprintf(pfile, "P3\n"); // Identify PPM file type. fprintf(pfile, "# myimage.ppm\n"); // Writes confirmation comment of the file name. fprintf(pfile, "%d %d\n", width, height); // Writes the width and height of the array. fprintf(pfile, "%d\n", colour); // Writes the colour depth level (always 255). //============================================================= // // WRITE DATA FROM ARRAY TO FILE // //============================================================= int a, b, c; for (a = 0; a < height; a++) { for (b = 0; b < width; b++) { for (c = 0; c < 3; c++) { fprintf(pfile, "%d", numbers[a][b][c]); fprintf(pfile, " "); }fprintf(pfile, " "); }fprintf(pfile, "\n\n"); } // The file can be found here...\executable_folder\myimage.ppm printf("\nMade Changes! Look for 'myimage.pmm' in the project folder.\n\n"); fclose(pfile); } printf("Press [R] to restart or any key to exit...\n\n\n\n"); d = _getch(); } while (d == 'r' || d == 'R'); printf("\n\n"); printf("Goodbye! "); }