1. from nd2reader import ND2Reader
  2. from cane import cane_3d
  3. import imageio
  4. import numpy as np
  5. import time
  6. import matplotlib.pyplot as plt
  7. import napari
  8. ## Nikon data to numpy array
  9. images = ND2Reader('/mnt/data/CA3-CA1-tracing.nd2')
  10. ny,nx = images.frame_shape
  11. nz = len(images.metadata['z_levels'])
  12. Img = np.zeros((nz,ny,nx),dtype='float64')
  13. for i in range(0,nz):
  14. Img[i,:,:] = images[i]
  15. #viewer = napari.view_image(Img)

nikon nd2 format metedata information

All metadata properties are:

  • width: the width of the image in pixels
  • height: the height of the image in pixels
  • date: the date the image was taken
  • fields_of_view: the fields of view in the image
  • frames: a list of all frame numbers
  • z_levels: the z levels in the image
  • total_images_per_channel: the number of images per color channel
  • channels: the color channels
  • pixel_microns: the amount of microns per pixel
  • rois: the regions of interest (ROIs) defined by the user
  • experiment: information about the nature and timings of the ND experiment

高灿灿拍摄的神经元像素尺寸大小:
image.png