Skip to content

Instantly share code, notes, and snippets.

@hirokai
Created December 16, 2013 09:35
Show Gist options
  • Save hirokai/7984478 to your computer and use it in GitHub Desktop.
Save hirokai/7984478 to your computer and use it in GitHub Desktop.
Confocal and TIRF on Scope 7
// Test acquisition script
// Modified from http://www.micro-manager.org/w/images/3/33/TestAcq.bsh (Nenad Amodaj, feb2008)
import org.micromanager.api.AcquisitionOptions;
// clear all previous acquisitions
gui.closeAllAcquisitions();
gui.clearMessageWindow();
// file locations
rootDirName = "E:/Hiro/20131126/01 FC1";
// parameters
numFrames = 10;
intervalMs = 0;
/*
acqName_confocal = "acq_confocal";
channelGroup_confocal = "confocal-EMCCD";
String[] channels_confocal = {"488confocalEM", "561confocalEM"};
Color[] colors = {Color.GREEN, Color.RED};
int[] exposures_confocal = {100, 100};
numSlices = 10;
acqName_tirf = "acq_tirf";
channelGroup_tirf = "TIRF-Flash4";
String[] channels_tirf = {"488tirf", "561tirf"};
Color[] colors = {Color.GREEN, Color.RED};
int[] exposures_tirf = {30, 30};
*/
acqName = "tirf-confocal";
channelGroup_confocal = "Channel";
String[] channels_confocal = {"FITC", "Rhodamine"};
Color[] colors = {Color.GREEN, Color.RED};
int[] exposures_confocal = {100, 100};
numSlices = 10;
// acqName_tirf = "test-acq-col2";
channelGroup_tirf = "Channel";
String[] channels_tirf = {"FITC", "Rhodamine"};
Color[] colors = {Color.GREEN, Color.RED};
int[] exposures_tirf = {30, 30};
float[] zpositions = new float[numSlices];
for(int i=0;i<numSlices;i++){
zpositions[i] = new Float(0.5*new Float(i) + 1.0);
}
// create acquisition and set options
gui.openAcquisition(acqName, rootDirName, numFrames, channels.length, numSlices+1);
for (int i=0; i<colors.length; i++)
gui.setChannelColor(acqName, i, colors[i]);
for (int i=0; i<channels.length; i++)
gui.setChannelName(acqName, i, channels[i]);
zdefault = 0;
for(int k=0;k<numFrames;k++){
mmc.fullFocus();
for (int j=0; j<channels_tirf.length; j++) {
gui.message("Acquiring frame " + i + ", channel " + channels[j] + ".");
mmc.setExposure(exposures_tirf[j]);
mmc.setConfig(channelGroup_tirf, channels_tirf[j]);
mmc.waitForConfig(channelGroup_tirf, channels_tirf[j]);
gui.snapAndAddImage(acqName, k, j, 0);
}
// set channel contrast based on the first frame
if (i==0) {
gui.setContrastBasedOnFrame(acqName, i, 0);
}
mmc.setExposure(exposures_confocal[0]);
mmc.setConfig(channelGroup_confocal, channels_confocal[0]);
mmc.waitForConfig(channelGroup_confocal, channels_confocal[0]);
for (int i=0; i<numSlices; i++) {
z = zpositions[i];
//safe within 20 um
if(z >= -20 && z <= 20){
mmc.setRelativePosition(mmc.getFocusDevice(), z);
mmc.setProperty("Z","Position",""+z);
}
for (int j=0; j<channels_confocal.length; j++) {
gui.message("Acquiring frame " + i + ", channel " + channels[j] + ".");
mmc.setExposure(exposures_confocal[j]);
mmc.setConfig(channelGroup_confocal, channels_confocal[j]);
mmc.waitForConfig(channelGroup_confocal, channels_confocal[j]);
gui.snapAndAddImage(acqName, k, j, i+1);
}
// set channel contrast based on the first frame
if (i==0) {
gui.setContrastBasedOnFrame(acqName, i, 0);
}
}
gui.sleep(intervalMs);
}
mmc.setRelativePosition(mmc.getFocusDevice(),zdefault);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment