-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from open-ephys/jon-review
Modularize API and code review
- Loading branch information
Showing
11 changed files
with
939 additions
and
1,057 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
namespace OpenEphys.ProbeInterface.NET | ||
{ | ||
/// <summary> | ||
/// Struct that extends the Probeinterface specification by encapsulating all values for a single contact. | ||
/// </summary> | ||
public readonly struct Contact | ||
{ | ||
/// <summary> | ||
/// Gets the x-position of the contact. | ||
/// </summary> | ||
public float PosX { get; } | ||
|
||
/// <summary> | ||
/// Gets the y-position of the contact. | ||
/// </summary> | ||
public float PosY { get; } | ||
|
||
/// <summary> | ||
/// Gets the <see cref="ContactShape"/> of the contact. | ||
/// </summary> | ||
public ContactShape Shape { get; } | ||
|
||
/// <summary> | ||
/// Gets the <see cref="ContactShapeParam"/>'s of the contact. | ||
/// </summary> | ||
public ContactShapeParam ShapeParams { get; } | ||
|
||
/// <summary> | ||
/// Gets the device ID of the contact. | ||
/// </summary> | ||
public int DeviceId { get; } | ||
|
||
/// <summary> | ||
/// Gets the contact ID of the contact. | ||
/// </summary> | ||
public string ContactId { get; } | ||
|
||
/// <summary> | ||
/// Gets the shank ID of the contact. | ||
/// </summary> | ||
public string ShankId { get; } | ||
|
||
/// <summary> | ||
/// Gets the index of the contact within the <see cref="Probe"/> object. | ||
/// </summary> | ||
public int Index { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Contact"/> struct. | ||
/// </summary> | ||
/// <param name="posX">Center value of the contact on the X-axis.</param> | ||
/// <param name="posY">Center value of the contact on the Y-axis.</param> | ||
/// <param name="shape">The <see cref="ContactShape"/> of the contact.</param> | ||
/// <param name="shapeParam"><see cref="ContactShapeParam"/>'s relevant to the <see cref="ContactShape"/> of the contact.</param> | ||
/// <param name="deviceId">The device channel index (<see cref="Probe.DeviceChannelIndices"/>) of this contact.</param> | ||
/// <param name="contactId">The contact ID (<see cref="Probe.ContactIds"/>) of this contact.</param> | ||
/// <param name="shankId">The shank ID (<see cref="Probe.ShankIds"/>) of this contact.</param> | ||
/// <param name="index">The index of the contact within the context of the <see cref="Probe"/>.</param> | ||
public Contact(float posX, float posY, ContactShape shape, ContactShapeParam shapeParam, | ||
int deviceId, string contactId, string shankId, int index) | ||
{ | ||
PosX = posX; | ||
PosY = posY; | ||
Shape = shape; | ||
ShapeParams = shapeParam; | ||
DeviceId = deviceId; | ||
ContactId = contactId; | ||
ShankId = shankId; | ||
Index = index; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace OpenEphys.ProbeInterface.NET | ||
{ | ||
/// <summary> | ||
/// Class holding all of the annotations for each contact. | ||
/// </summary> | ||
public class ContactAnnotations | ||
{ | ||
/// <summary> | ||
/// Gets the array of strings holding annotations for each contact. Not all indices must have annotations. | ||
/// </summary> | ||
public string[] Annotations { get; protected set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ContactAnnotations"/> class. | ||
/// </summary> | ||
/// <param name="contactAnnotations">Array of strings containing annotations for each contact. Size of the array should match the number of contacts, but they can be empty strings.</param> | ||
[JsonConstructor] | ||
public ContactAnnotations(string[] contactAnnotations) | ||
{ | ||
Annotations = contactAnnotations; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace OpenEphys.ProbeInterface.NET | ||
{ | ||
/// <summary> | ||
/// Shape of the contact. | ||
/// </summary> | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum ContactShape | ||
{ | ||
/// <summary> | ||
/// Circle. | ||
/// </summary> | ||
[EnumMember(Value = "circle")] | ||
Circle = 0, | ||
|
||
/// <summary> | ||
/// Rectangle. | ||
/// </summary> | ||
[EnumMember(Value = "rect")] | ||
Rect = 1, | ||
|
||
/// <summary> | ||
/// Square. | ||
/// </summary> | ||
[EnumMember(Value = "square")] | ||
Square = 2, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace OpenEphys.ProbeInterface.NET | ||
{ | ||
/// <summary> | ||
/// Class holding parameters used to draw the contact. | ||
/// </summary> | ||
/// <remarks> | ||
/// Fields are nullable, since not all fields are required depending on the shape selected. | ||
/// </remarks> | ||
public class ContactShapeParam | ||
{ | ||
/// <summary> | ||
/// Gets the radius of the contact. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is only used to draw <see cref="ContactShape.Circle"/> contacts. Field can be null. | ||
/// </remarks> | ||
public float? Radius { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the width of the contact. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is used to draw <see cref="ContactShape.Square"/> or <see cref="ContactShape.Rect"/> contacts. | ||
/// Field can be null. | ||
/// </remarks> | ||
public float? Width { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the height of the contact. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is only used to draw <see cref="ContactShape.Rect"/> contacts. Field can be null. | ||
/// </remarks> | ||
public float? Height { get; protected set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ContactShapeParam"/> class. | ||
/// </summary> | ||
/// <param name="radius">Radius. Can be null.</param> | ||
/// <param name="width">Width. Can be null.</param> | ||
/// <param name="height">Height. Can be null.</param> | ||
[JsonConstructor] | ||
public ContactShapeParam(float? radius = null, float? width = null, float? height = null) | ||
{ | ||
Radius = radius; | ||
Width = width; | ||
Height = height; | ||
} | ||
|
||
/// <summary> | ||
/// Copy constructor given an existing <see cref="ContactShapeParam"/> object. | ||
/// </summary> | ||
/// <param name="shape">Existing <see cref="ContactShapeParam"/> object to be copied.</param> | ||
protected ContactShapeParam(ContactShapeParam shape) | ||
{ | ||
Radius = shape.Radius; | ||
Width = shape.Width; | ||
Height = shape.Height; | ||
} | ||
} | ||
} |
Oops, something went wrong.