Scanimage 2017 : How to Set Up Your ScanImage Development Environment

Summary

So you want to compile and/or modify ScanImage code for your lab? The following step-by-step directions will allow you to accomplish this.

Setting Up Your Development Environment

The following steps will allow you to recreate a standalone Development environment for ScanImage 5.0.

  1. Download and Install Microsoft Visual Studio 2008
  2. Download and Install MATLAB (64-bit ScanImage 5.0 only runs on 64-bit MATLAB). Tested versions of MATLAB are 2013b-2014a.
  3. Download and Install the latest version of National Instruments NI-DAQmx. Use the express install option and install the default components. (http://www.ni.com/download/ni-daqmx-9.8/4297/en/). DAQmx handles all digital I/O and analog I/O for driving the resonant scanner, galvo(s), and other components such as the Piezo, Motion Stages, and Pockels Cells.
  4. Download and Install the latest version of National Instruments NI FlexRIO software. (http://www.ni.com/download/ni-flexrio-13.1/4485/en/). The FlexRIO is used for the FPGA and A/D converter used for the frame grabber portion of ScanImage.
  5. Optional - Download and Install Atlassian Sourcetree (or other Git client) to access the Vidrio Technologies ScanImage repository located at https://bitbucket.org/vidriotech/scanimage-5
  6. Create the following directory: C:\PROGRAM FILES\SCANIMAGE\DEVTOOLS\
  7. Connect to the Vidrio Technologies Dropbox (http://www.dropbox.com/) and download the contents of \SHARED\DEVTOOLS into the C:\PROGRAM FILES\SCANIMAGE\DEVTOOLS directory.
  8. In Windows Explorer, right click on the 'Libraries' folder (usually located on the left side of the Explorer Window) and select New >> Library

    Icon

    libraries.png

  9. Right click on "New Library" and under the "Library" tab, click the "Add..." button.
  10. Select the C:\PROGRAM FILES\SCANIMAGE\DEVTOOLS directory.
  11. Download the latest version of ScanImage 5.0 and install into C:\SCANIMAGE-5\
  12. Open Microsoft Visual Studio 2008.
  13. Go to File >> Open >> Project/Solution
  14. Select C:\SCANIMAGE-5\+scanimage\+adapters\@ResonantAcq\ResonantAcq MEX Build\ResonantAcqMex.sln
  15. Make sure the current Configuration is set to Release and x64.

    Icon

    vs.png

  16. Select Build >> Rebuild Solution. This will compile and install both NiFPGAWrapper.dll and NiFPGAMex.dll.
  17. If you do not yet have a FlexRIO Chassis, then you must create a simulated FlexRIO Chassis device. Start up NI MAX. Under "My System", right click on "Devices and Interfaces", then select "Create New...".

    Icon

    daqmx.png

  18. In the "Create New..." dialog window, select "Simulated NI-DAQmx Device or Modular Instrument", then flick the "Finish" button.
  19. In the "Create Simulated NI-DAQmx Device" dialog window, type "6356" and select PXIe-6356.
  20. Set "PXI Slot" to 3
  21. Click the "OK" button.
  22. You should now be able to start MATLAB and run Scanimage 5.0 without issues. You should also be able to modify C++ code in Visual Studio, recompile it, and run the updated dll's in MATLAB without issues.

Sourcetree Caveats

Using Sourcetree with Windows 7 Library directories or Dropbox is not recommended. The Windows 7 Library directories will give you permission errors, and using Dropbox will prevent switching between local branches from executing properly.