def measureCustom(layerset):
    # Obtain a list of all AreaLists:
    alis = layerset.getZDisplayables(AreaList)
    # The loader
    loader = layerset.getProject().getLoader()
    # The ResultsTable
    table = Utils.createResultsTable("AreaLists",
                                     ["id", "layer", "Z", "area", "mean"])
    # The LayerSet's Calibration (units in microns, etc)
    calibration = layerset.getCalibrationCopy()
    # The measurement options as a bit mask:
    moptions = Measurements.AREA | Measurements.MEAN

    for ali in alis:
        affine = ali.getAffineTransformCopy()
        box = ali.getBoundingBox()
        index = 0
        for layer in layerset.getLayers():
            index += 1  # layer index starts at 1, so sum before
            # The java.awt.geom.Area object for the AreaList 'ali'
            # at the given Layer 'layer':
            area = ali.getArea(layer)
            if area:
                # Bring the area to world coordinates,
                # and then local to its own data:
                tr = AffineTransform()
                tr.translate(-box.x, -box.y)
                tr.concatenate(affine)
                area = area.createTransformedArea(tr)
                # Create a snapshot of the images under the area:
                imp = loader.getFlatImage(layer, box, 1, 0xffffffff,
                                          ImagePlus.GRAY8, Patch, False)
                # Set the area as a roi
                imp.setRoi(ShapeRoi(area))
                # Perform measurements (uncalibrated)
                # (To get the calibration, call layerset.getCalibrationCopy())
                stats = ByteStatistics(imp.getProcessor(), moptions,
                                       calibration)
                table.incrementCounter()
                table.addLabel("Name", ali.getTitle())
                table.addValue(0, ali.getId())
                table.addValue(1, index)  # the layer index
                table.addValue(2, layer.getZ())
                table.addValue(3, stats.area)
                table.addValue(4, stats.mean)
        # Update and show the table
        table.show("AreaLists")
Example #2
0
def measureCustom(layerset):
  # Obtain a list of all AreaLists:
  alis = layerset.getZDisplayables(AreaList)
  # The loader
  loader = layerset.getProject().getLoader()
  # The ResultsTable
  table = Utils.createResultsTable("AreaLists", ["id", "layer", "Z", "area", "mean"])
  # The LayerSet's Calibration (units in microns, etc)
  calibration = layerset.getCalibrationCopy()
  # The measurement options as a bit mask:
  moptions = Measurements.AREA | Measurements.MEAN
  
  for ali in alis:
    affine = ali.getAffineTransformCopy()
    box = ali.getBoundingBox()
    index = 0
    for layer in layerset.getLayers():
      index += 1 # layer index starts at 1, so sum before
      # The java.awt.geom.Area object for the AreaList 'ali'
      # at the given Layer 'layer':
      area = ali.getArea(layer)
      if area:
        # Bring the area to world coordinates,
        # and then local to its own data:
        tr = AffineTransform()
        tr.translate(-box.x, -box.y)
        tr.concatenate(affine)
        area = area.createTransformedArea(tr)
        # Create a snapshot of the images under the area:
        imp = loader.getFlatImage(layer, box, 1, 0xffffffff,
              ImagePlus.GRAY8, Patch, False)
        # Set the area as a roi
        imp.setRoi(ShapeRoi(area))
        # Perform measurements (uncalibrated)
	# (To get the calibration, call layerset.getCalibrationCopy())
        stats = ByteStatistics(imp.getProcessor(), moptions, calibration)
	table.incrementCounter()
	table.addLabel("Name", ali.getTitle())
	table.addValue(0, ali.getId())
	table.addValue(1, index) # the layer index
	table.addValue(2, layer.getZ()) 
	table.addValue(3, stats.area)
	table.addValue(4, stats.mean)
    # Update and show the table
    table.show("AreaLists")
Example #3
0
 def transform(self, t):
   t = AffineTransform(t)
   t.concatenate(self.preTransformation)
   tile = Trimorphic(t)
   tile.getUI().setBackground(self.getUI().getBackground())
   return tile
Example #4
0
 def transform(self, t):
   t = AffineTransform(t)
   t.concatenate(self.preTransformation)
   w = SHorn(self.n, t)
   w.getUI().setBackground(self.getUI().getBackground())
   return w