#include "StdAfx.h" #include "ExtrasInput.h" void ExtrasSampleCreation( void *ExtrasDlgPtr, char *data_out_prefix ) { UNREFERENCED_PARAMETER(data_out_prefix); //to get rid of compiler warning message DS_1b_cube * ds_cube; ExtrasDialog *ExtrasDlg = (ExtrasDialog*)ExtrasDlgPtr; if ( ExtrasDlg->check_do_not_read_input.GetCheck() ) { ds_cube = new DS_1b_cube( (unsigned short)ExtrasDlg->field_width_slices_int, (unsigned short)ExtrasDlg->field_width_Y_int, (unsigned short)ExtrasDlg->field_width_X_int ); // Initial state of cube ds_cube->clear(); // Zero out cube // ds_cube->setall(); // Set all of cube } else { ds_cube = ExtrasDlg->Dlg_Input_to_cDS(); } Vect3usi start_coord, end_coord, dimensions; unsigned short inner_diam, outer_diam; inner_diam = 0; outer_diam = 1; // Value to draw with bool mark_val; // '1' mark_val = true; // '1' // Draw a 6-connected line //start_coord.from_zyx( 20, 20, 20 ); //end_coord.from_zyx( 50, 100, 50 ); //ds_cube->drawLine6Connected( start_coord, end_coord, mark_val ); // Draw a box //start_coord.from_zyx( 50, 120, 20 ); //dimensions.from_zyx( 30, 10, 45 ); //ds_cube->drawSolidBox( start_coord, dimensions, mark_val ); // Draw a sphere //inner_diam = 16; //outer_diam = 60; //start_coord.from_zyx( 100, 120, 120 ); //ds_cube->drawSolidSphere( start_coord, inner_diam, outer_diam, mark_val ); //bed of 3x3x3 spheres for diffusion debug //requires 120x120x120 ds_cube input //inner_diam = 0; //outer_diam = 30; //for (outer_diam = 5; outer_diam <61; outer_diam += 5) //{//first center @ (x,y,z)=(19,19,19) // unsigned char x, y, z; // for (x=19; x<100; x+=40) // for (y=19; y<100; y+=40) // for (z=19; z<100; z+=40) // { // start_coord.from_zyx( z, y, x ); // ds_cube->drawSolidSphere( start_coord, inner_diam, outer_diam, mark_val ); // } // // Write result to file // ds_cube->writeToFile( data_out_prefix, true ); //} // //bed of 4x4x4 spheres for diffusion debug // //requires 121x121x121 ds_cube input // inner_diam = 0; // //outer_diam = 30; // char data_out_prefix_cut [1024]; // sprintf(data_out_prefix_cut, "%s", "T:\\ExtrasOutput\\bed_spheres4_diam"); // for (outer_diam = 1; outer_diam <53; outer_diam ++) // {//first center @ (x,y,z)=(14,14,14) //// unsigned char x, y, z; // short int x, y, z; // short int rad = (short int)(outer_diam/2); // float rad2 = pow((float)(outer_diam),(float)2)/(float)4; // for (x=15; x<110; x+=30) // for (y=15; y<110; y+=30) // for (z=15; z<110; z+=30) // { // //start_coord.from_zyx( z, y, x ); // //ds_cube->drawSolidSphere( start_coord, inner_diam, outer_diam, mark_val ); // short int xx, yy, zz; // for (xx=-rad; xx<=rad; xx++) // for (yy=-rad; yy<=rad; yy++) // for (zz=-rad; zz<=rad; zz++) // if ( ( pow((float)xx,(float)2)+pow((float)yy,(float)2)+pow((float)zz,(float)2) <= rad2 ) // && ( x+xx >=0 ) && ( x+xx < 121 ) // && ( y+yy >=0 ) && ( y+yy < 121 ) // && ( z+zz >=0 ) && ( z+zz < 121 ) ) // ds_cube->set_spot_1( (unsigned short)(z+zz), (unsigned short)(y+yy), (unsigned short)(x+xx) ); // } // // Write result to file // if (outer_diam <10) // sprintf(data_out_prefix, "%s0%d", data_out_prefix_cut, outer_diam); // else // sprintf(data_out_prefix, "%s%d", data_out_prefix_cut, outer_diam); // ds_cube->writeToFile( data_out_prefix, true ); // } // //bed of 2x2x2 spheres for diffusion debug // //requires 61x61x61 ds_cube input // inner_diam = 0; // //outer_diam = 30; // char data_out_prefix_cut [1024]; // sprintf(data_out_prefix_cut, "%s", "T:\\ExtrasOutput\\bed_spheres2_diam"); // for (outer_diam = 0; outer_diam <53; outer_diam ++) // {//first center @ (x,y,z)=(14,14,14) //// unsigned char x, y, z; // short int x, y, z; // short int rad = (short int)(outer_diam/2); // float rad2 = pow((float)(outer_diam),(float)2)/(float)4; // for (x=15; x<55; x+=30) // for (y=15; y<55; y+=30) // for (z=15; z<55; z+=30) // { // //start_coord.from_zyx( z, y, x ); // //ds_cube->drawSolidSphere( start_coord, inner_diam, outer_diam, mark_val ); // short int xx, yy, zz; // for (xx=-rad; xx<=rad; xx++) // for (yy=-rad; yy<=rad; yy++) // for (zz=-rad; zz<=rad; zz++) // if ( ( pow((float)xx,(float)2)+pow((float)yy,(float)2)+pow((float)zz,(float)2) <= rad2 ) // && ( x+xx >=0 ) && ( x+xx < 61 ) // && ( y+yy >=0 ) && ( y+yy < 61 ) // && ( z+zz >=0 ) && ( z+zz < 61 ) ) // ds_cube->set_spot_1( (unsigned short)(z+zz), (unsigned short)(y+yy), (unsigned short)(x+xx) ); // } // // Write result to file // if (outer_diam <10) // sprintf(data_out_prefix, "%s0%d", data_out_prefix_cut, outer_diam); // else // sprintf(data_out_prefix, "%s%d", data_out_prefix_cut, outer_diam); // ds_cube->writeToFile( data_out_prefix, true ); // } //bed of 4x4x4 spheres for diffusion debug //requires 240x240x240 ds_cube input //inner_diam = 0; //outer_diam = 30; ////for (outer_diam = 3; outer_diam <43; outer_diam += 3) //{//first center @ (x,y,z)=(14,14,14) // unsigned char x, y, z; // for (x=14; x<230; x+=30) // for (y=14; y<230; y+=30) // for (z=14; z<230; z+=30) // { // start_coord.from_zyx( z, y, x ); // ds_cube->drawSolidSphere( start_coord, inner_diam, outer_diam, mark_val ); // } // // Write result to file // ds_cube->writeToFile( data_out_prefix, true ); //} // Write result to file //ds_cube->writeToFile( data_out_prefix, true ); delete ds_cube; }