Spaces and Zones

fort::myrmidon::Space

class Space

An homogenous coordinate system for tracking data.

A Space represent the physical space tracked by one single Camera. Coordinates in one Space cannot be compared with coordinate from another Space.

Space are uniquely identified with their ID().

Zoning

Within a single Space, it could be relevant to define Zone where interaction between Ant could be measured. I.e. Ant in different Zone won’t report interactions.

Zone are manipulated with CreateZone() and DeleteZone().

Note

Space can only be created from an Experiment with Experiment::CreateSpace()

Public Functions

SpaceID ID() const

Gets the Space ID.

Returns:

this Space SpaceID;

const std::string &Name() const

Gets the Space name.

Returns:

the Space name

void SetName(const std::string &name)

Sets the Space name.

Parameters:

name – the wanted name

Zone::Ptr CreateZone(const std::string &name)

Creates a new Zone in this Space.

Parameters:

name – the Zone::Name()

Returns:

the newly created Zone

void DeleteZone(ZoneID zoneID)

Deletes a Zone in this Space.

Parameters:

zoneID – the ZoneID of the Zone to delete.

Throws:

std::out_of_range – if zoneID is not the ID of a Zone owned by this Space.

const ZoneByID &Zones() const

Gets the Zones in this space.

Returns:

a map of Zone::ByID of all Zone in this Space.

std::pair<std::string, uint64_t> LocateMovieFrame(const Time &time) const

Locates a movie file and frame number.

Parameters:

time – the Time we want a movie frame for.

Throws:

std::out_of_range – if a movie frame for the specified Time could not be found.

Returns:

a pair of an absolute file path to the movie file, and the wanted movie frame number.

fort::myrmidon::Zone

class Zone

A tracking region where collisions/interactions are computed.

A Zone defines a tracked area region where collisions and interactions can be computed. I.e. two Ant in different Zone won’t report any collisions or interactions.

Naming and Identification

Zone are managed by Space, and have a unique ZoneID within an experiment. Zone have a user definable Name() but internally only their ZoneID is used.

By default, any Ant is considered to be within the null Zone with ZoneID 0, so all possible interactions are reported. User needs to add Zone only to prune unwanted interactions or to be able to query where an Ant is at any given Time.

Geometric definition

Zone have time valid ZoneDefinition. In most cases there would be a single ZoneDefinition for any Zone valid for ]Time::SinceEver(),Time::Forever()[, but it is possible to assign different ZoneDefinition::Shapes() for different time range using multiple ZoneDefinition.

ZoneDefinition are manipulated using AddDefinition() and DeleteDefinition().

Note

Zone can only be created from a Space with Space::CreateZone().

Public Types

typedef std::shared_ptr<Zone> Ptr

a pointer to a Zone

Public Functions

ZoneDefinition::Ptr AddDefinition(const Shape::List &shapes, const Time &start, const Time &end)

Adds a new timed ZoneDefinition.

Adds a new timed ZoneDefinition valid for [start,end[ to this Zone. It accepts Time::SinceEver() and Time::Forever() for start or end.

Parameters:
  • shapes – the shape of the Zone as a Shape::List

  • start – the first valid Time for this definition.

  • end – the first invalid Time for this definition.

Throws:

std::invalid_argument – if start or end would make the resulting definition overlap in time with another ZoneDefinition for this Zone.

Returns:

the new ZoneDefinition

const ZoneDefinitionList &Definitions() const

Gets the Zone’s ZoneDefinition.

Returns:

a ZoneDefinition::List of ZoneDefinition for this Zone

void DeleteDefinition(size_t index)

Removes a ZoneDefinition.

Parameters:

index – the index in Definitions() to remove.

Throws:

std::out_of_range – if index >= Definitions().size()

const std::string &Name() const

Gets the Zone name.

Returns:

the Zone name

void SetName(const std::string &name)

Gets the Zone name.

Parameters:

name – the wanted Name()

ZoneID ID() const

Gets the Zone ID.

Returns:

the Zone ZoneID

fort::myrmidon::ZoneDefinition

class ZoneDefinition

Defines the geometry of a Zone in Time.

ZoneDefinition contains for a time range [Start(),End()[ the Shapes() for a Zone.

Note

ZoneDefinition can only be created from a Zone with Zone::AddDefinition().

Public Types

typedef std::shared_ptr<ZoneDefinition> Ptr

A pointer to a Zone.

Public Functions

const Shape::List &Shapes() const

Gets the geometry of this ZoneDefinition.

Returns:

a list of Shape that define the Shape of the Zone for [Start();End()[

void SetShapes(const Shape::List &shapes)

Sets the Shapes of this ZoneDefinition.

Parameters:

shapes – a union of Shape defining the Zone shapes.

const Time &Start() const

Gets the first valid time of the ZoneDefinition.

Returns:

the first valid Time of this definition. It can be Time::SinceEver().

const Time &End() const

Gets the first invalid time of the ZoneDefinition.

Returns:

the first invalid Time of this definition. It can be Time::Forever().

void SetStart(const Time &start)

Sets the first valid time of the ZoneDefinition.

Parameters:

start – the first valid Time of this definition. It can be Time::SinceEver().

void SetEnd(const Time &end)

Sets the first invalid time of the ZoneDefinition.

Parameters:

end – the first invalid Time of this definition. It can be Time::Forever().