├── DIHM_Camera.py ├── Lower_Box.stl ├── Pinhole_Holder.stl ├── README.md └── Upper_Box.stl /DIHM_Camera.py: -------------------------------------------------------------------------------- 1 | import os 2 | import errno 3 | import picamera 4 | import time 5 | import RPi.GPIO as GPIO 6 | 7 | #initialize GPIO 8 | 9 | GPIO.setmode(GPIO.BCM) 10 | GPIO.setup(17, GPIO.OUT) 11 | 12 | 13 | #initialize parameters 14 | 15 | d1 = 30 #distance between pinhole and camera in mm 16 | d2 = 5.91 #distance between object and camera in mm 17 | ph = 15 #pinhole size in microns 18 | wl = 430 #wavelength in nm 19 | object = 'objectname' #which object 20 | 21 | #create the directory and save the parameters 22 | 23 | path = "/home/pi/Desktop/" + time.strftime("%y.%m.%d_%H.%M") #the absolute path 24 | filename = path + "/Parameters.txt" #the folder is named after the current date and time. If you take several pictures in one minute, they get overwritten! 25 | if not os.path.exists(os.path.dirname(filename)): 26 | try: os.makedirs(os.path.dirname(filename)) 27 | except OSError as exc: # Guard against race condition 28 | if exc.errno != errno.EEXIST: 29 | raise 30 | 31 | with open(filename, "w") as f: #write down experimental parameters 32 | f.write("Object: " + object +"\r") 33 | f.write("Distance between camera and pinhole: " + str(d1) + " mm\r") 34 | f.write("Distance between camera and object: " + str(d2) + " mm\r") 35 | f.write("Pinhole size: " + str(ph) + " microns\r") 36 | f.write("Wavelength: " + str(wl) + " nm\r") 37 | 38 | #turn on LED and capture images 39 | 40 | GPIO.output(17, GPIO.HIGH) #turns on LED 41 | 42 | with picamera.PiCamera() as camera: 43 | camera.resolution = (3280, 2464) 44 | camera.iso = 100 #fixed iso 45 | camera.awb_mode = 'off' 46 | camera.awb_gains = (1,3) #fixed white balance 47 | camera.start_preview(resolution=(1440, 1080)) 48 | input("Take Picture") 49 | camera.capture_sequence([path + '/object%s.jpg'%i for i in range(1)]) #one image is captured on pressing enter 50 | input("Take Background") 51 | camera.capture_sequence([path + '/background%s.jpg'%i for i in range(1)]) #remove object. On pressing enter again, the background image is captured. 52 | camera.close() 53 | 54 | 55 | GPIO.output(17, GPIO.LOW) #turns off LED 56 | -------------------------------------------------------------------------------- /Lower_Box.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teph12/DIHM/3d2935c8ba87425d98cb8fa78171d7aa634bf2aa/Lower_Box.stl -------------------------------------------------------------------------------- /Pinhole_Holder.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teph12/DIHM/3d2935c8ba87425d98cb8fa78171d7aa634bf2aa/Pinhole_Holder.stl -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Digital Inline Holographic Microscopy (DIHM) 2 | =========================================== 3 | 4 | Here we want to present an easy to use digital inline holographic microscope employing 3D printed parts, a Raspberry Pi and Pi Cam, as well as a high-power LED and a 15 micron pinhole. For details see (link to publication following). 5 | 6 | # Assembly 7 | 8 | 1. Print the required parts (.stl files) with a 3D printer or a 3D-printing service of your choice. We used PLA as printer material. 9 | 2. Using pliers, remove the lens in front of the Raspberry Pi Cam v2. Assemble the Raspberry Pi 3 and the Raspberry Pi Cam. 10 | 3. Fix the pinhole on the upper side of the pinhole holder. We used black tape to prevent residual light from passing. 11 | 4. Connect the LED to a current source providing a current of 125 mA. Run the cables through the hole in the lower box. Fix the LED on the lower side of the pinhole holder. 12 | 5. Assemble lower box, pinhole holder and upper box. Connect the Raspberry Pi Cam to the upper box. Connect a monitor, mouse and power source to the Raspberry Pi. Power it on. 13 | 14 | # Image Acquisition 15 | 16 | 1. Open Camera_DIHM.py and insert the experimental parameters. If you run the file, a folder with the name YY.MM.DD_hh.mm will be created and all following files will be saved here. 17 | ATTENTION: Run Camera_DIHM.py only once every minute, or the previous files will be overwritten! 18 | 2. If you control the LED with the Raspberry Pi's GPIO, it will now be turned on. If not, turn on the LED. 19 | 3. Insert an object on a standard microscope slide. You will now see its hologram in the preview. 20 | 4. By pressing ENTER an image of the object is captured. If you want to capture a higher number of images, you can enter the number in range(N). 21 | 5. Remove the object slide. By pressing ENTER again, N in range(N) background images are captured. 22 | 23 | # Reconstruction 24 | 25 | 1. Move the images to a PC with Fiji and the following plugin installed https://unal-optodigital.github.io/NumericalPropagation/ 26 | 2. Open Fiji and the plugin. 27 | 3. Open the object image and choose Image>Type>32-Bit to convert it to a greyscale image. 28 | 4. In the Plugin choose the image as real image. Let imaginary image empty. Enter the required parameters. 29 | 5. Press propagate. After that, you can reconstruct several image planes at once by using Batch. To increase the reconstructed image's contrast you can use Process>Enhance Contrast with (0.2, normalize, prozess whole stack). 30 | -------------------------------------------------------------------------------- /Upper_Box.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teph12/DIHM/3d2935c8ba87425d98cb8fa78171d7aa634bf2aa/Upper_Box.stl --------------------------------------------------------------------------------