Skip to content

Builds a camera/electrode management DLL to expose to Python applications

Notifications You must be signed in to change notification settings

john-judge/PhotoLib

Repository files navigation

pyPhoto21

Demo Footage

Region Selector

region-selector_xuo55Yja.mp4

Contrast Adjustment

contrast.mp4

Zoom and Pan

zoom-pan_lrWBI3av.mp4

Time Course Plot

photo21-2021-09-01-16-09-31_DIgmb4tD.mp4

DAQ Config

photo21-2021-09-01-16-10-43_evhoCxYX.mp4

Live Feed

image

PhotoLib

Builds a camera/electrode management DLL to expose to (Python) applications. Includes a GUI application for acquisition and analysis, written in Python.

Building Executable

Uses pyinstaller. Navigate to the PhotoLib directory.

One-File Mode

Not recommended because start-up is slow, but it is simpler. If you want a single exe for analysis only and portability between folders, shared drivers, machine, etc. For one-file mode:

pyinstaller -F -n pyPhoto21 --add-data nicaiu.dll;. --add-data clseredt.dll;. --add-data ./x64/Release/PhotoLib.dll;./x64/Release/ onefile.py

This will take serveral minutes.

Building for Rig Computer (One-Folder Mode)

Or in one-folder mode (faster startup, but files are messy):

 pyinstaller -n pyPhoto21 --add-data nicaiu.dll;. --add-data clseredt.dll;. driver.py --distpath dist --add-data ./x64/Release/PhotoLib.dll;./x64/Release/

Avoid using the --clean --noconfirm options.

This will take serveral minutes.

Create a shortcut to the executable in the current directory. Place the shortcut anywhere you like, but do not move any files in the folder in which pyinstaller was run, and do not change the location of the folder either.

Distributing This Application

If single-file mode, the .exe is ~400 MB, so it will have to be distributed via shared network, Google Drive, USB/external drive, or building locally on destination machine. If single-folder mode, right-click > Send To > Compressed File to zip before distributing. The entire repository folder (PhotoLib), not just the pyinstaller dist path, must be zipped and distributed.

Hardware Requirements

  • DLL targets 64-bit machines
  • RedshirtImaging's Little Dave (DaVinci 2K)
  • NI-USB

Software Requirements

Instructions

  • Clone repository.
  • Follow the build from source guide below. Or, when/if I've released a stable, standalone version of PhotoLib.dll, use that directly (dependencies should come with this repository).

Build From Source

This project is built with Visual Studio Code 2017 or 2019 with the Dynamic Loaded Library (DLL) project template.

  • Target x64-Release
  • Enable /MT compiler option
  • Copy Include Paths from PhotoZ VS setup as needed
  • Press F7 to compile and build the DLL
  • Use the DLL as a library in any application needed.
  • Python: A Python wrapper module using the built-in ctypes library is included.

Python GUI

Install the conda environment from environment.yml:

conda env create --name PhotoLib -f environment.yml

Activate with conda activate PhotoLib and then run python driver.py

To update environment from changed yml file:

 conda env update --name PhotoLib --file environment.yml  --prune

Development: if additional conda dependencies are added to the environment, update the environment.yml with:

conda env export > environment.yml

Troubleshooting

dumpbin /DEPENDENTS .\x64\Release\PhotoLib.dll

Typically:

  Image has the following dependencies:

    clseredt.dll
    nicaiu.dll
    KERNEL32.dll
    VCOMP140.DLL

Find these dependencies and make sure their directories are included in your system environment's PATH variable or add them to one of the DLL search paths.

Architecture

Overview

modules (1)

Related Projects and Applications

  • PhotoZ for data acquisition and analysis with GUI entirely in C++
  • ZDA_Explorer for flexible data analysis scripting with PhotoZ raw data
  • PhotoZ_Images for camera image display
  • Cell Detection Kate's SNR clustering method for identifying ROIs

About

Builds a camera/electrode management DLL to expose to Python applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published