ScanImage was developed using the Model-View-Controller design pattern. As a demonstration of the scripting-flexibility that ScanImage provides us, this article will show an example of how to set up a simple GUI for a specific ScanImage-based task. This article uses the ScanImage API, which is described in more detail here.
Suppose we were to run a hypothetical experiment/procedure that only requires the user to change the name of a file and start a frame acquisition based on clicking. For this purpose the following \GUIDE GUI would be more than sufficient for our needs:
We shall now see how we can tie the ScanImage core to perform the desired task through this GUI. First of all, let's link a new controller-view to ScanImage. To do this, we can inspect the scanimage startup script. In the Matlab command window, type:
Find the following section in the startup script:
Now we can set up the new controller
Next comes the View. Here will choose explicit names for each element in the GUI.
|Check-box for toggling logging-enabled state|
|Edit-box for setting the logging filename|
|Push-button for initiating a GRAB acquisition (not set in the view)|
|Push-button for stopping an acqusition (not set in the view)|
This concludes our simple implementation of the MVC approach for creating simple ScanImage user interfaces. This should be considered a starting point, given that error-checking and proper destructors should still be added to this implementation.