Esempio n. 1
0
  processor = frame.getProcessor()

  filters = RankFilters()
  filters.setup("median", frame)
  filters.rank(processor, filter_window, filters.MEDIAN)

  # Perform gamma correction
  processor.gamma(gamma)

  frame = ImagePlus("Frame " + str(frame_i), processor)

  # Rolling ball background subtraction
  processor = frame.getProcessor()

  bg_subtractor = BackgroundSubtracter()
  bg_subtractor.setup("", frame)
  bg_subtractor.rollingBallBackground(processor, rolling_ball_size/pixel_size, False, False, False, False, True)

  frame = ImagePlus("Frame " + str(frame_i), processor)

  # Calibrate pixels
  calibration = Calibration()
  calibration.setUnit("pixel")
  calibration.pixelWidth = pixel_size
  calibration.pixelHeight = pixel_size
  calibration.pixelDepth = 1.0

  frame.setCalibration(calibration)

  # Save to output dir
  file_name = output_dir + "/" + str(frame_i).zfill(4) + ".tif"