Class LMSMetadataExtractor

java.lang.Object
loci.formats.in.LeicaMicrosystemsMetadata.LMSMetadataExtractor

public class LMSMetadataExtractor extends Object
This class extracts metadata information from Leica Microsystems image XML and stores it in the reader's CoreMetadata and MetadataTempBuffer
Author:
Melissa Linkert melissa at glencoesoftware.com, Constanze Wendlandt constanze.wendlandt at leica-microsystems.com
  • Field Details

  • Constructor Details

    • LMSMetadataExtractor

      public LMSMetadataExtractor(LMSFileReader reader)
  • Method Details

    • translateMetadata

      public void translateMetadata(List<LMSImageXmlDocument> docs) throws FormatException, IOException
      Extracts all information from Leica image xml Documents and writes it to reader's CoreMetadata and MetadataTempBuffer
      Parameters:
      docs - list of Leica xml documents
      Throws:
      FormatException
      IOException
    • translateImage

      public void translateImage(Element image, int i) throws FormatException
      Extracts information from element node and writes it to reader's CoreMetadata and MetadataTempBuffer
      Parameters:
      image - node with tag name "element" from Leica XML
      i - image /core index
      Throws:
      FormatException
    • translateChannelDescriptions

      public void translateChannelDescriptions(Element imageNode, int coreIndex) throws FormatException
      Extracts i.a. channel number and luts from channel descriptions and writes it to reader's CoreMetadata and MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      coreIndex -
      Throws:
      FormatException
    • translateLuts

      private void translateLuts(List<String> luts, int imgIndex)
      Translates raw channel luts of an image to Colors and writes it to reader's MetadataTempBuffer
      Parameters:
      luts - list of raw lut names / values from Leica XML
    • getChannelPriority

      private int getChannelPriority(String lutName)
    • translateLut

      private ome.xml.model.primitives.Color translateLut(String lutName)
      Translates Leica XML lut name / value to Color
      Parameters:
      lutName -
      Returns:
    • translateDimensionDescriptions

      private void translateDimensionDescriptions(Element imageNode, int coreIndex) throws FormatException
      Extracts information from dimension descriptions and writes it to reader's CoreMetadata and MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      coreIndex -
      Throws:
      FormatException
    • setCoreDimensionSizes

      private void setCoreDimensionSizes(int coreIndex)
      Writes extracted dimension sizes to CoreMetadata
      Parameters:
      coreIndex -
    • setPixelType

      private void setPixelType(int coreIndex) throws FormatException
      Sets CoreMetadata.pixelType depending on extracted x bytesInc
      Parameters:
      coreIndex -
      Throws:
      FormatException
    • translateAttachmentNodes

      public void translateAttachmentNodes(Element imageNode, int image) throws FormatException
      Extracts information from dimension descriptions and writes it to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateScannerSettings

      public void translateScannerSettings(Element imageNode, int image) throws FormatException
      Extracts scanner information and writes it to reader's CoreMetadata and MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateFilterSettings

      public void translateFilterSettings(Element imageNode, int image) throws FormatException
      Extracts filter information and writes it to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateTimestamps

      public void translateTimestamps(Element imageNode, int image) throws FormatException
      Extracts timestamps and writes them to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateLaserLines

      public void translateLaserLines(Element imageNode, int image) throws FormatException
      Extracts laser information and writes it to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateROIs

      public void translateROIs(Element imageNode, int image) throws FormatException
      Extracts ROIs and writes them to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateSingleROIs

      public void translateSingleROIs(Element imageNode, int image) throws FormatException
      Extracts single ROIs and writes them to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateDetectors

      public void translateDetectors(Element imageNode, int image) throws FormatException
      Extracts detector information and writes it to reader's MetadataTempBuffer
      Parameters:
      imageNode - Image node from Leica xml
      image - image / core index
      Throws:
      FormatException
    • translateSingleTimestamp

      private double translateSingleTimestamp(String timestamp)
      Translates hex timestamp string to double value
      Parameters:
      timestamp - timestamp in format
      Returns:
      number of seconds
    • translateSingleTimestamp

      private double translateSingleTimestamp(Element timestamp)
      Translates the content of a timestamp node to double value
      Parameters:
      timestamp - timestamp node
      Throws:
      FormatException
    • addUserCommentMeta

      private void addUserCommentMeta(Element imageNode, int image) throws FormatException
      Extracts user comments and adds them to the reader's CoreMetadata
      Parameters:
      imageNode -
      image -
      Throws:
      FormatException
    • populateOriginalMetadata

      private void populateOriginalMetadata(Element root, Deque<String> nameStack)
      Creates key value pairs from attributes of the root's child nodes (tag | attribute name : attribute value) and adds them to reader's CoreMetadata
      Parameters:
      root - xml node
      nameStack - list of node names to be prepended to key name
    • parseLong

      public long parseLong(String value)
    • parseInt

      public int parseInt(String value)
    • parseDouble

      public double parseDouble(String value)
    • getImageDescription

      private Element getImageDescription(Element root)
    • getChannelDescriptionNodes

      private NodeList getChannelDescriptionNodes(Element root)
    • getDimensionDescriptionNodes

      private NodeList getDimensionDescriptionNodes(Element root)
    • getNodes

      private NodeList getNodes(Element root, String nodeName)
      Returns all (grand*n)children nodes with given node name
      Parameters:
      root - root node
      nodeName - name of children that shall be searched
      Returns:
      list of child nodes with given name
    • getChannelIndex

      public static int getChannelIndex(Element filterSetting)