Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various UI element issues #28

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ on:

jobs:
build_and_publish:
uses: open-ephys/github-actions/.github/workflows/build.yml@main
uses: open-ephys/github-actions/.github/workflows/build_dotnet_publish_nuget.yml@main
secrets:
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<UseArtifactsOutput>true</UseArtifactsOutput>
<PackageIcon>icon.png</PackageIcon>
<VersionPrefix>0.3.1</VersionPrefix>
<VersionPrefix>0.3.2</VersionPrefix>
<VersionSuffix></VersionSuffix>
<LangVersion>10.0</LangVersion>
<Features>strict</Features>
Expand Down
2 changes: 1 addition & 1 deletion OpenEphys.Miniscope/LegacyUclaMiniscope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
namespace OpenEphys.Miniscope
{
[Description("Produces a video sequence acquired from a UCLA Miniscope V3 using legacy DAQ firmware.")]
public class LegacyUclaMiniscope : Source<IplImage>

Check warning on line 12 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope'

Check warning on line 12 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope'

Check warning on line 12 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope'

Check warning on line 12 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope'
{

// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum FrameRateLegacy

Check warning on line 16 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy'

Check warning on line 16 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy'

Check warning on line 16 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy'

Check warning on line 16 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy'
{
Fps5 = 0x11,

Check warning on line 18 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps5'

Check warning on line 18 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps5'

Check warning on line 18 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps5'

Check warning on line 18 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps5'
Fps10 = 0x12,

Check warning on line 19 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps10'

Check warning on line 19 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps10'

Check warning on line 19 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps10'

Check warning on line 19 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps10'
Fps15 = 0x13,

Check warning on line 20 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps15'

Check warning on line 20 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps15'

Check warning on line 20 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps15'

Check warning on line 20 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps15'
Fps20 = 0x14,

Check warning on line 21 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps20'

Check warning on line 21 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps20'

Check warning on line 21 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps20'

Check warning on line 21 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps20'
Fps30 = 0x15,

Check warning on line 22 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps30'

Check warning on line 22 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps30'

Check warning on line 22 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps30'

Check warning on line 22 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps30'
Fps60 = 0x16

Check warning on line 23 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps60'

Check warning on line 23 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps60'

Check warning on line 23 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps60'

Check warning on line 23 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.FrameRateLegacy.Fps60'
};

//[TypeConverter(typeof(MiniscopeIndexConverter))]
[Description("The index of the camera from which to acquire images.")]
public int Index { get; set; } = 0;

Check warning on line 28 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.Index'

Check warning on line 28 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (debug, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.Index'

Check warning on line 28 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, ubuntu-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.Index'

Check warning on line 28 in OpenEphys.Miniscope/LegacyUclaMiniscope.cs

View workflow job for this annotation

GitHub Actions / build_and_publish / build (release, windows-latest)

Missing XML comment for publicly visible type or member 'LegacyUclaMiniscope.Index'

[Description("Indicates whether to activate the hardware frame pulse output.")]
public bool RecordingFramePulse { get; set; } = false;
Expand Down
19 changes: 10 additions & 9 deletions OpenEphys.Miniscope/UclaMiniCam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OpenEphys.Miniscope
[Description("Produces a data sequence from a UCLA MiniCAM behavioral monitoring camera.")]
public class UclaMiniCam : Source<UclaMiniCamFrame>
{
// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum GainMiniCam
{
Low = 8,
Expand All @@ -26,14 +26,15 @@ public enum GainMiniCam

// Percent -> register scale factor for setting illumination LED brightness
// TODO: Actual value is 0.31. However, if the DAQ is USB powered, using this value
// causes link instabilities even with a short, high-quality, nomimal-gauge SMA cable.
const double LedBrigthnessScaleFactor = 0.26;
// causes link instabilities even with a short, high-quality, nominal-gauge SMA cable.
const double LedBrightnessScaleFactor = 0.26;

[Editor("OpenEphys.Miniscope.Design.UclaMiniCamIndexEditor, OpenEphys.Miniscope.Design", typeof(UITypeEditor))]
[Description("The index of the camera from which to acquire images.")]
public int Index { get; set; } = 0;

[Range(0, 26)] //
[Range(0, 100)]
[Precision(1, 0.1)]
[Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))]
[Description("LED brightness (percent of max).")]
public double LedBrightness { get; set; } = 0;
Expand All @@ -43,15 +44,15 @@ public enum GainMiniCam

[Description("Frames captured per second.")]
[Range(5, 47)]
[Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))]
[Editor(DesignTypes.NumericUpDownEditor, typeof(UITypeEditor))]
public int FramesPerSecond { get; set; } = 30;

// State
readonly IObservable<UclaMiniCamFrame> source;
readonly object captureLock = new object();
AbusedUvcRegisters originalState;

// NB: Camera regiser (ab)uses
// NB: Camera register (ab)uses
// CaptureProperty.Saturation -> Start acquisition
// CaptureProperty.Gamma -> Inverted state of trigger input (3.3 -> Gamma = 0, 0V -> Gamma != 0)
// CaptureProperty.Contrast -> DAQ Frame number
Expand All @@ -70,15 +71,15 @@ static internal AbusedUvcRegisters IssueStartCommands(Capture capture)
var cgs = Helpers.ReadConfigurationRegisters(capture);

// Magik configuration sequence (configures SERDES and chip default states)
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 7, 176)); // Provide deserializwer with serializer address
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 7, 176)); // Provide deserializer with serializer address
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 34, 2)); // Speed up i2c bus timer to 50us max
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 32, 10)); // Decrease BCC timeout, units in 2 ms
Helpers.SendConfig(capture, Helpers.CreateCommand(176, 15, 2)); // Speed up I2c bus timer to 50u Max
Helpers.SendConfig(capture, Helpers.CreateCommand(176, 30, 10)); // Decrease BCC timeout, units in 2 ms
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 8, 186, 108)); // Set aliases for MT9P031 and LM3509
Helpers.SendConfig(capture, Helpers.CreateCommand(192, 16, 186, 108)); // Set aliases for MT9P031 and LM3509
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 3, 5, 255)); // Set height to 1535 rows
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 4, 7, 255)); // Set width to 2047 colums
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 4, 7, 255)); // Set width to 2047 columns
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 34, 0, 17)); // 2x subsamp and binning 1
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 35, 0, 17)); // 2x subsamp and binning 2
Helpers.SendConfig(capture, Helpers.CreateCommand(186, 32, 0, 96)); // Set column binning to summing instead of averaging
Expand Down Expand Up @@ -129,7 +130,7 @@ public UclaMiniCam()

if (LedBrightness != lastLedBrightness || !initialized)
{
var scaled = LedBrigthnessScaleFactor * LedBrightness;
var scaled = LedBrightnessScaleFactor * LedBrightness;
Helpers.SendConfig(capture, Helpers.CreateCommand(108, 160, (byte)scaled));
lastLedBrightness = LedBrightness;
}
Expand Down
4 changes: 2 additions & 2 deletions OpenEphys.Miniscope/UclaMiniscopeV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ namespace OpenEphys.Miniscope
[Description("Produces a image sequence acquired from a UCLA Miniscope V3.")]
public class UclaMiniscopeV3 : Source<IplImage>
{
// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum GainV3
{
Low = 225,
Medium = 228,
High = 36
};

// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum FrameRateV3
{
Fps10,
Expand Down
77 changes: 61 additions & 16 deletions OpenEphys.Miniscope/UclaMiniscopeV4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,7 @@ namespace OpenEphys.Miniscope
[Description("Produces a data sequence from a UCLA Miniscope V4.")]
public class UclaMiniscopeV4 : Source<UclaMiniscopeV4Frame>
{
// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
public enum GainV4
{
Low = 225,
Medium = 228,
High = 36,
};

// NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues
public enum FrameRateV4
{
Fps10 = 39 & 0x000000FF | 16 << 8,
Fps15 = 26 & 0x000000FF | 11 << 8,
Fps20 = 19 & 0x000000FF | 136 << 8,
Fps25 = 15 & 0x000000FF | 160 << 8,
Fps30 = 12 & 0x000000FF | 228 << 8,
};

// Frame size
const int Width = 608;
Expand All @@ -41,19 +25,23 @@ public enum FrameRateV4
[Description("The index of the camera from which to acquire images.")]
public int Index { get; set; } = 0;

[Precision(1, 0.1)]
[Range(0, 100)]
[Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))]
[Description("Excitation LED brightness (percent of max).")]
public double LedBrightness { get; set; } = 0;

[Precision(1, 0.1)]
[Range(-100, 100)]
[Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))]
[Description("Electro-wetting lens focal plane adjustment (percent of range around nominal).")]
public double Focus { get; set; } = 0;

[TypeConverter(typeof(GainV4TypeConverter))]
[Description("Image sensor gain setting.")]
public GainV4 SensorGain { get; set; } = GainV4.Low;

[TypeConverter(typeof(FrameRateV4TypeConverter))]
[Description("Frames captured per second.")]
public FrameRateV4 FramesPerSecond { get; set; } = FrameRateV4.Fps30;

Expand Down Expand Up @@ -258,4 +246,61 @@ public override IObservable<UclaMiniscopeV4Frame> Generate()
return source;
}
}

// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum GainV4
{
Low = 225,
Medium = 228,
High = 36,
}

class GainV4TypeConverter : EnumConverter
{
internal GainV4TypeConverter()
: base(typeof(GainV4))
{
}

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new[]
{
GainV4.Low,
GainV4.Medium,
GainV4.High,
});
}
}

// NB: Needs a unique name, even though its a class member, for de/serialization without issues
public enum FrameRateV4
{
Fps10 = 39 & 0x000000FF | 16 << 8,
Fps15 = 26 & 0x000000FF | 11 << 8,
Fps20 = 19 & 0x000000FF | 136 << 8,
Fps25 = 15 & 0x000000FF | 160 << 8,
Fps30 = 12 & 0x000000FF | 228 << 8,
};


class FrameRateV4TypeConverter : EnumConverter
{
internal FrameRateV4TypeConverter()
: base(typeof(FrameRateV4))
{
}

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new[]
{
FrameRateV4.Fps10,
FrameRateV4.Fps15,
FrameRateV4.Fps20,
FrameRateV4.Fps25,
FrameRateV4.Fps30,
});
}
}
}
Loading