Direkt zum InhaltDirekt zur SucheDirekt zur Navigation
▼ Zielgruppen ▼

Humboldt-Universität zu Berlin - Faculty of Mathematics and Natural Sciences - Strukturforschung / Elektronenmikroskopie

CM_focSeries.txt

// This script illustrates the use of the Camera manager
Image img,stack;
number width,height
number expTime = 1
number imgCount = 5
number deltaF = 50
number jImg,df

// find the current camera:
object camera = CM_GetCurrentCamera();

// find out whether this camera is inserted:
number inserted = CM_GetCameraInserted(camera)

// Retrieve the user-set settings for the "RECORD" mode camera setup:
acq_params = CM_GetCameraAcquisitionParameterSet(camera,"Imaging","Acquire","Record",0)
CM_CCD_GetSize(camera, width, height)

// Retrieve the exposure time and ask whether this should be changed:
number expTimeOld = CM_GetExposure(acq_params)
if (!getNumber("Exposure time per image",expTimeOld,expTime)) {
result("Image acquisition aborted\n"); exit(0)
}

// Ask the user for the number of images:
if (!getNumber("Number of different image defoci",imgCount,imgCount)) {
result("Image acquisition aborted\n"); exit(0)
}

// Ask the user for the defocus step:
if (!getNumber("Defocus step (nm)",deltaF,deltaF)) {
result("Image acquisition aborted\n"); exit(0)
}

// compute the initial defocus:
df = -deltaF*((imgCount-1)/2)

// start acquiring the different defocused images:
img := RealImage(“CCD Image",4,width,height)
stack := Realimage("Defocus Stack",4,sx,sy,imgCount);
for (jImg = 0; jImg<imgCount;jImg++) {
EMChangeFocus(df)
CM_AcquireImage(camera, acq_params,img)
df = df+deltaF

// insert the newly created image into the image stack
stack[0,0,jImg,width,height,jImg+1] = img;
result("Recorded image "+jImg+" with defocus="+df+"nm\n")
}
// reset the defocus
df = -deltaF*((imgCount+1)/2)
EMChangeFocus(df)

// show the resulting image
showimage(stack)