Class PositionList

java.lang.Object
org.micromanager.PositionList
All Implemented Interfaces:
Iterable<MultiStagePosition>

public class PositionList extends Object implements Iterable<MultiStagePosition>
Navigation list of positions for the Stages. Used for multi site acquisition support. Consists of a list of MultiStagePositions and an Optional instance of MultiWellPlate.

TODO: Change into an interface and make a default implementation

  • Constructor Details

    • PositionList

      public PositionList()
      Constructor of navigation list of positions for the Stages.
    • PositionList

      public PositionList(MultiWellPlate plate)
  • Method Details

    • newInstance

      public static PositionList newInstance(PositionList aPl)
      Static copy constructor.
      Parameters:
      aPl - input PositionList; if null an empty PositionList is returned
      Returns:
      new instance of a PositionList with identical positions to the input
    • addChangeListener

      public void addChangeListener(ChangeListener listener)
      Adds a changeListener to this PositionList.
      Parameters:
      listener - Will fire when the list changes
    • removeChangeListener

      public void removeChangeListener(ChangeListener listener)
      Removes the given listener. Nothing will happen if listener was not added first.
      Parameters:
      listener - Removes the specified listener.
    • notifyChangeListeners

      public void notifyChangeListeners()
      Notifies all changeListeners to the list that something changed.
    • getPosition

      public MultiStagePosition getPosition(int idx)
      Returns multi-stage position associated with the position index.
      Parameters:
      idx - - position index
      Returns:
      multi-stage position
    • getPositionCopy

      public MultiStagePosition getPositionCopy(int idx)
      Returns a copy of the multi-stage position associated with the position index.
      Parameters:
      idx - - position index
      Returns:
      multi-stage position
    • getPositionIndex

      public int getPositionIndex(String posLabel)
      Returns position index associated with the position name.
      Parameters:
      posLabel - - label (name) of the position
      Returns:
      index, or -1 when the name was not found
    • addPosition

      public void addPosition(MultiStagePosition pos)
      Adds a new position to the list.
      Parameters:
      pos - - multi-stage position
    • addPosition

      public void addPosition(int in0, MultiStagePosition pos)
      Insert a position into the list.
      Parameters:
      in0 - - place in the list where the position should be inserted
      pos - - multi-stage position
    • replacePosition

      public void replacePosition(int index, MultiStagePosition pos)
      Replaces position in the list with the new position.
      Parameters:
      index - index of the position to be replaced
      pos - - multi-stage position
    • getNumberOfPositions

      public int getNumberOfPositions()
      Returns the number of positions contained within the list.
      Returns:
      number of positions contained in the position list
    • clearAllPositions

      public void clearAllPositions()
      Empties the list.
    • removePosition

      public void removePosition(int idx)
      Removes a specific position based on the index.
      Parameters:
      idx - - position index
    • setPositions

      public void setPositions(MultiStagePosition[] posArray)
      Initialize the entire array by passing an array of multi-stage positions.
      Parameters:
      posArray - - array of multi-stage positions
    • getPositions

      public MultiStagePosition[] getPositions()
      Returns an array of positions contained in the list.
      Returns:
      position array
    • setLabel

      public void setLabel(int idx, String label)
      Assigns a label to the position index.
      Parameters:
      idx - - position index
      label - - new label (name)
    • toPropertyMap

      public PropertyMap toPropertyMap()
      Creates a PropertyMap from this PositionList.
      Returns:
      PropertyMap representing this PositionList
    • replaceWithPropertyMap

      public void replaceWithPropertyMap(PropertyMap map) throws IOException
      replaces the content of this PositionList with the content of the given PropertyMap.
      Parameters:
      map - PropertyMap whose content will replace this PositionList
      Throws:
      IOException - appears to be never thrown. TODO: Remove?
    • generateLabel

      public String generateLabel()
      Helper method to generate unique label when inserting a new position. Not recommended for use - planned to become obsolete.
      Returns:
      Unique label
    • generateLabel

      public String generateLabel(String proposal)
      Generates a label for a new Position.
      Parameters:
      proposal - user-supplied suggestion
      Returns:
      new, unique label that will be accepted by this list
    • isLabelUnique

      public boolean isLabelUnique(String label)
      Verify that the new label is unique.
      Parameters:
      label - - proposed label
      Returns:
      true if label does not exist
    • save

      public void save(File file) throws IOException
      Save list to a file.
      Parameters:
      file - destination; recommended suffix is ".json".
      Throws:
      IOException - can happen while saving to disk
    • save

      public void save(String path) throws IOException
      Save list to a file.
      Parameters:
      path - destination; recommended suffix is ".json".
      Throws:
      IOException - can happen while saving to disk
    • load

      public void load(File file) throws IOException
      Load position list from a file.
      Parameters:
      file - source JSON file, usually ".txt" or ".json".
      Throws:
      IOException - can happen while saving to disk
    • load

      public void load(String path) throws IOException
      Load position list from a file.
      Parameters:
      path - source JSON file, usually ".txt" or ".json".
      Throws:
      IOException - can happen while reading from disk
    • iterator

      public Iterator<MultiStagePosition> iterator()
      Specified by:
      iterator in interface Iterable<MultiStagePosition>
    • setPlate

      public void setPlate(MultiWellPlate plate)
    • getPlate

      public MultiWellPlate getPlate()