Commit f28a7240194c8e24b4dab54c99b333ad0189fc3a

Authored by David Mayerich
1 parent e4c3ae76

added support for a cutoff filter based on the objective NA

Showing 1 changed file with 7 additions and 1 deletions   Show diff stats
@@ -289,6 +289,9 @@ void set_simulation(){ @@ -289,6 +289,9 @@ void set_simulation(){
289 g_NA_obj[1] = args["objective"].as_float(0); //set the external condenser NA 289 g_NA_obj[1] = args["objective"].as_float(0); //set the external condenser NA
290 if(args["objective"].nargs() == 2) g_NA_obj[0] = args["objective"].as_float(1); //if the internal NA is specified, use it 290 if(args["objective"].nargs() == 2) g_NA_obj[0] = args["objective"].as_float(1); //if the internal NA is specified, use it
291 else g_NA_obj[0] = 0; //otherwise set the internal NA to zero 291 else g_NA_obj[0] = 0; //otherwise set the internal NA to zero
  292 + if (args["objective"].nargs() == 2) {
  293 + std::cout << "WARNING: This implementation of BIMSim does not currently support an objective central obscuration." << std::endl;
  294 + }
292 295
293 if (args["simage"].is_set()) //if a source image is provided 296 if (args["simage"].is_set()) //if a source image is provided
294 g_sources = simage<float>(g_S_ff, args["simage"].as_string()); //convert the image to a list of sources 297 g_sources = simage<float>(g_S_ff, args["simage"].as_string()); //convert the image to a list of sources
@@ -346,6 +349,7 @@ int main(int argc, char* argv[]){ @@ -346,6 +349,7 @@ int main(int argc, char* argv[]){
346 std::chrono::high_resolution_clock::time_point t_begin = std::chrono::high_resolution_clock::now(); 349 std::chrono::high_resolution_clock::time_point t_begin = std::chrono::high_resolution_clock::now();
347 double P = 0; 350 double P = 0;
348 std::thread t1(progressbar_thread, &P); //start the progress bar thread 351 std::thread t1(progressbar_thread, &P); //start the progress bar thread
  352 + //for each point representing the illumination source
349 for(size_t s = 0; s < g_sources.size(); s++){ 353 for(size_t s = 0; s < g_sources.size(); s++){
350 stim::scalarbeam<float> beam((float)g_lambda, 1, g_sources[s], d, (float)g_NA_cond[1], (float)g_NA_cond[0]); //create a focused beam 354 stim::scalarbeam<float> beam((float)g_lambda, 1, g_sources[s], d, (float)g_NA_cond[1], (float)g_NA_cond[0]); //create a focused beam
351 355
@@ -355,7 +359,8 @@ int main(int argc, char* argv[]){ @@ -355,7 +359,8 @@ int main(int argc, char* argv[]){
355 stim::filename incident_file = outfile.prefix(outfile.prefix() + "_0_nfi"); 359 stim::filename incident_file = outfile.prefix(outfile.prefix() + "_0_nfi");
356 E0.image(incident_file.str(), stim::complexMag); 360 E0.image(incident_file.str(), stim::complexMag);
357 } 361 }
358 - E0.crop(g_padding, Eff); 362 + E0.lowpass(stim::TAU / g_lambda * g_NA_obj[1]); //apply the objective cut-off filter to generate the far-field image
  363 + E0.crop(g_padding, Eff); //crop out the padding to get the final incident field
359 Eff.intensity(I0); 364 Eff.intensity(I0);
360 365
361 spheres.eval(E, beam, g_Nl, g_MC); 366 spheres.eval(E, beam, g_Nl, g_MC);
@@ -372,6 +377,7 @@ int main(int argc, char* argv[]){ @@ -372,6 +377,7 @@ int main(int argc, char* argv[]){
372 E.image(propagate_file.str(), stim::complexMag); 377 E.image(propagate_file.str(), stim::complexMag);
373 } 378 }
374 379
  380 + E.lowpass(stim::TAU / g_lambda * g_NA_obj[1]); //apply the cut-off frequency to generate the far-field image
375 E.crop(g_padding, Eff); //crop out the far field slice 381 E.crop(g_padding, Eff); //crop out the far field slice
376 Eff.intensity(I); //calculate the far field intensity and add it to the single-beam image 382 Eff.intensity(I); //calculate the far field intensity and add it to the single-beam image
377 383