Class MultiStagePosition

java.lang.Object
org.micromanager.MultiStagePosition

public final class MultiStagePosition extends Object
Definition of a position in space in terms of available stages/drives.

The current implementation uses the concept of "DefaultXYStage", and "DefaultZStage". This is problematic. The concept of "default" stages originates in the Micro-Manager core, that always has only 1 stage that is the "active" one. However, MultiStagePosition devices can record the position of multiple stages, sometimes even lacking those of the "default" stages, so it can not rely on the Micro-manager "Default" stages being in the list.

It would be nice to be able to rely on the getX, getY, and getZ functions, but these will return bogus values if the system's default stages are not included. To avoid surprises, you may need to parse the MultiStagePosition yourself.

  • Constructor Details

    • MultiStagePosition

      public MultiStagePosition()
      Default constructor.
    • MultiStagePosition

      public MultiStagePosition(String xyStage, double x, double y, String zStage, double z)
      Convenient constructor where the motion system consists of one XY stage and one focus stage.
      Parameters:
      xyStage - name
      x - - coordinate in microns
      y - - coordinate in microns
      zStage - name
      z - - focus position in microns
  • Method Details

    • newInstance

      public static MultiStagePosition newInstance(MultiStagePosition aMps)
      Copy constructor.
      Parameters:
      aMps - - another instance of the MultiStagePoswition class
      Returns:
      multistageposition
    • add

      public void add(StagePosition sp)
      Add one stage position point.
      Parameters:
      sp - Stageposition to be added
    • remove

      public void remove(StagePosition sp)
      Removed one stage position point.
      Parameters:
      sp - stage position point to be removed
    • size

      public int size()
      Number of stages.
      Returns:
      number of stages in this MultiStagePosition object
    • get

      public StagePosition get(int idx)
      Return stage position based on index.
      Parameters:
      idx - - position index
      Returns:
      stageposition
    • get

      public StagePosition get(String stageName)
      Returns position for a specific stage.
      Parameters:
      stageName - Name of the stage
      Returns:
      position of the specified stage
    • setProperty

      public void setProperty(String key, String value)
      Add a generalized property-value par to the position.
      Parameters:
      key - Key of the property
      value - Value of the property
    • getPropertyNames

      public String[] getPropertyNames()
      Return the array of property keys (names) associated with this position.
      Returns:
      array with property names
    • hasProperty

      public boolean hasProperty(String key)
      Checks if the position has a particular property.
      Parameters:
      key - Key or property
      Returns:
      true if the position has this key
    • getProperty

      public String getProperty(String key)
      Returns property value for a given key (name).
      Parameters:
      key - Key of the property
      Returns:
      value associated with the key
    • getLabel

      public String getLabel()
      Returns position label.
      Returns:
      label associated with this MultiStagePosition
    • setLabel

      public void setLabel(String lab)
      Sets position label (such as well name, etc.).
      Parameters:
      lab - new MultiStagePosition Label
    • setDefaultZStage

      public void setDefaultZStage(String stage)
      Defines which stage serves as focus control.
      Parameters:
      stage - new focus stage
    • getDefaultZStage

      public String getDefaultZStage()
      Returns the Default Z stage, i.e. the one that will be used if not named explicitly.
      Returns:
      Default Z stage (defined by the user in MMCore)
    • getDefaultXYStage

      public String getDefaultXYStage()
      Return the default XY stage, i,e, the one used if no stage is named explicitly.
      Returns:
      Default XY stage (defined by the user in MMCore)
    • setDefaultXYStage

      public void setDefaultXYStage(String stage)
      Defines which stage serves as the default XY motion control device.
      Parameters:
      stage - new default XY stage
    • goToPosition

      public static void goToPosition(MultiStagePosition msp, mmcorej.CMMCore core) throws Exception
      Moves all stages to the specified positions.
      Parameters:
      msp - position to move to
      core - - microscope API
      Throws:
      Exception - If there is an error moving the stage.
    • getX

      public double getX()
      Returns "X" coordinate of the position.
      Returns:
      X position of the default XY stage
    • getY

      public double getY()
      Returns "Y" coordinate of the position.
      Returns:
      Y position of the default XY stage
    • getZ

      public double getZ()
      Returns "Z" - focus coordinate of the position.
      Returns:
      Position of the default Focus stage
    • setGridCoordinates

      public void setGridCoordinates(int row, int col)
      Sets grid parameters for the rectangular grid.
      Parameters:
      row - Row number of the grid coordinate
      col - Column number of the grid coordinate
    • getGridRow

      public int getGridRow()
      Returns rectangular grid row.
      Returns:
      row
    • getGridColumn

      public int getGridColumn()
      Returns rectangular grid column.
      Returns:
      column
    • equals

      public boolean equals(Object alt)
      Compares this MultiStagePosition to another, and returns true if they are equal in all aspects.
      Overrides:
      equals in class Object
      Parameters:
      alt - The MultiStagePosition to compare against.
      Returns:
      true if every field of this MultiStagePosition matches every field of the provided MultiStagePosition, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toPropertyMap

      public PropertyMap toPropertyMap()
      Returns a propertymap describing this MultiStagePosition.
      Returns:
      PropertyMap describing this MultiStagePosition
    • fromPropertyMap

      public static MultiStagePosition fromPropertyMap(PropertyMap pmap)
      Generates a multistagePosition from the given PropertyMap.
      Parameters:
      pmap - PropertyMap
      Returns:
      MultiStagePosition