Varex 1207

Last modified by henrikma@helsinki_fi on 2024/02/07 06:21

The imaging detector communicates with a PC via the CameraLink interface. The data cable connects from the detector to a frame grabber, which is installed into a PCIe slot in the computer. The drivers, control program and libraries can be installed on Windows using the installer found here (link checked 28.2.2023):

https://vareximagpub.sharepoint.com/:f:/g/EpbONhWBk41Bk-E70MJStcIBhnUxjYGYqnY3rFn0OAyf3A

At the moment, the operation of the detector only works on the Windows PC in the phase-contrast room. A graphical user interface is provided by the SCap (or Pelican) program. Own programs can be made at least with C, C++ and Python. The necessary libraries, documentations and example programs can be found in the installation path, e.g., C:\Program Files\Varex\DexelaDetectorAPI.

In the current setup, the piezo and micrometer screw are controlled from the Linux PC and the detector from the Windows PC. The communication between these PCs is implemented via the lab network and server/client programs coded with Python (2.7/3.4). The server program (Phase_step_server.py) has to be located on the Windows PC. It can be obtained from GitLab (https://version.helsinki.fi/xraylab/imaging/phase-contrast/phase-grating-control/-/tree/master/Windows) and placed e.g. in C:\Users\xraylab\Documents\Varex_image_server.

NOTE: Currently the easiest way to align a sample or take a quick snapshot is to use SCap. Also, make sure that SCap is not on while using an own program to take images, because SCap reserves the detector for itself. Sometimes there also seems to be a bug with SCap (or the drivers?), and no detectors can be seen by an own program. This seems to fix when turning on SCap, switching off/on the ADC and turning SCap on again. At the bottom of the SCap window, the t0 parameter turns from -1ms to 17ms, when everything is ok.

Using the imaging server (on Windows)

Navigate to the folder including the server program and start PowerShell (or other shell program). In the file explorer app (head to the desired folder), PowerShell can be launched in the current folder (path) by clicking the "File" tab in the top bar and "Open Windows PowerShell" from the drop-down menu. You can also first start PowerShell and then navigate to the desired folder with the "cd" command.

The server program has been coded using Python. It can be launched from the shell program with the following command:

python Phase_step_server.py

When starting the server, the program first checks all CameraLink devices that are present and initializes the detector(s) that are found. After initialization, the server constantly waits for requests from a client program.

When the server is running, it is not advisable to run the SCap program, because this seems to "break" the server program and images are not acquired correctly. If this happens, just close SCap and restart the server.

Taking images using a client program (on Linux) [OUTDATED]

The Linux PC can communicate with the imaging server on the Windows PC with the client program phase_step_client.py, currently located under /home/phasecontrast/path_to_file. Single images can be taken from a Linux shell (Ctrl+Alt+T) with the command:

python varex_client.py fname imnum

where fname is the name of the file that includes the imaging parameters (now /home/phasecontrast/Desktop/input.txt) and imnum is the number of the image (which is appended to the end of the image name). Both the server and the client print info about their activity/actions. The imaging server can be closed from the Linux PC by running the client program without the two command line arguments.

Note that the images are saved on the Windows PC, and currently there is no way to access the image folder from the Linux PC. Thus, the file paths in the parameter file have to be paths on the Windows machine.

Acquiring a phase stepping series from spec (on Linux) [OUTDATED]

The necessary spec macros for performing phase stepping are located in the file /home/phasecontrast/Desktop/Piezo/piezo.mac, which can be loaded into spec with qdofile("/home/phasecontrast/Desktop/Piezo/piezo.mac").

Phase stepping can be performed by calling:

stepping(inputfname)

where the name of the input file (now input.txt) is given as an argument (must include full path and quotes). Both the piezo and the imaging parameters have to be specified in this input file. The stepping macro automatically numbers the images (correctly if # of images < 100), which makes later image analysis easier. The layout of the input file is the following:

input.txt - example
#Piezo parameters: nim,pstart,pstep
10
2
0.2

#Imaging parameters: exptime,impath,imname,darkpath
3200
D:\DATA\Varex_testing_15072019\test\
testim
D:\Varex_calibration\1207-33545-Dark-High-10x3200,ms-Binx11.smv

Make sure not to add any additional or empty lines to file, because the client program needs to know exactly where the imaging parameters start (now on line 7). Piezo starting location (pstart) and step (pstep) are given in micrometers. The exposure time (exptime) has to be set in milliseconds. All the paths are on the Windows PC (note direction of "\").

GUI for input

You can alternatively use the GUI tool input_GUI.py to create the necessary input file for phase stepping. This can be done by running:

python /home/phasecontrast/Desktop/input_GUI.py

from a terminal. This creates an input file with the name input_GUI.txt to the desktop. Remember to give this file name to the stepping() macro in spec.

Currently there is a bug, which prevents the creation of the input file, when the tool is called from spec. Spec probably only needs writing rights. The future plan is to implement the GUI into a spec macro called stepping_GUI(), which then automatically reads the correct input file.