Skip to content

Commit c36cfb9

Browse files
committed
Merge branch 'develop' into data-model
2 parents b77f69a + c3e63e8 commit c36cfb9

File tree

11 files changed

+70
-43
lines changed

11 files changed

+70
-43
lines changed

Assets/Editor/Editor_BuildAll.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private static void BuildLinux()
3333
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions
3434
{
3535
scenes = new[] { "Assets/Scenes/TrajectoryPlanner.unity" },
36-
locationPathName = "Builds/Linux/Pinpoint",
36+
locationPathName = "Builds/Linux/Pinpoint.x86_64",
3737
target = BuildTarget.StandaloneLinux64,
3838
options = BuildOptions.None
3939
};

Assets/Scenes/TrajectoryPlanner.unity

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44912726, g: 0.49919963, b: 0.5757154, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44824904, g: 0.49827605, b: 0.5755831, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -3130,15 +3130,15 @@ PrefabInstance:
31303130
objectReference: {fileID: 1703646459}
31313131
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
31323132
propertyPath: m_AnchorMax.y
3133-
value: 1
3133+
value: 0
31343134
objectReference: {fileID: 0}
31353135
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
31363136
propertyPath: m_AnchorMin.y
3137-
value: 1
3137+
value: 0
31383138
objectReference: {fileID: 0}
31393139
- target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
31403140
propertyPath: m_AnchoredPosition.x
3141-
value: 169.88
3141+
value: 0
31423142
objectReference: {fileID: 0}
31433143
- target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
31443144
propertyPath: m_IsOn
@@ -3274,19 +3274,19 @@ PrefabInstance:
32743274
objectReference: {fileID: 0}
32753275
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
32763276
propertyPath: m_AnchorMax.y
3277-
value: 1
3277+
value: 0
32783278
objectReference: {fileID: 0}
32793279
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
32803280
propertyPath: m_AnchorMin.y
3281-
value: 1
3281+
value: 0
32823282
objectReference: {fileID: 0}
32833283
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
32843284
propertyPath: m_AnchoredPosition.x
3285-
value: 354.84
3285+
value: 0
32863286
objectReference: {fileID: 0}
32873287
- target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
32883288
propertyPath: m_AnchoredPosition.y
3289-
value: -15
3289+
value: 0
32903290
objectReference: {fileID: 0}
32913291
- target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
32923292
propertyPath: m_AnchorMax.x
@@ -3566,19 +3566,19 @@ PrefabInstance:
35663566
objectReference: {fileID: 0}
35673567
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
35683568
propertyPath: m_AnchorMax.y
3569-
value: 1
3569+
value: 0
35703570
objectReference: {fileID: 0}
35713571
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
35723572
propertyPath: m_AnchorMin.y
3573-
value: 1
3573+
value: 0
35743574
objectReference: {fileID: 0}
35753575
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
35763576
propertyPath: m_AnchoredPosition.x
3577-
value: 384.91998
3577+
value: 0
35783578
objectReference: {fileID: 0}
35793579
- target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
35803580
propertyPath: m_AnchoredPosition.y
3581-
value: -15
3581+
value: 0
35823582
objectReference: {fileID: 0}
35833583
- target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3}
35843584
propertyPath: m_AnchorMax.y
@@ -8481,7 +8481,7 @@ PrefabInstance:
84818481
objectReference: {fileID: 2108153954}
84828482
- target: {fileID: 1302158968166640874, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3}
84838483
propertyPath: m_IsActive
8484-
value: 1
8484+
value: 0
84858485
objectReference: {fileID: 0}
84868486
- target: {fileID: 1302158968379378328, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3}
84878487
propertyPath: m_LocalScale.x
@@ -10480,10 +10480,6 @@ PrefabInstance:
1048010480
propertyPath: brainModel
1048110481
value:
1048210482
objectReference: {fileID: 1877060505}
10483-
- target: {fileID: 8016510558008620343, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3}
10484-
propertyPath: ProbeString
10485-
value:
10486-
objectReference: {fileID: 0}
1048710483
- target: {fileID: 8016510558008620343, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3}
1048810484
propertyPath: _blDistance
1048910485
value:
@@ -10552,10 +10548,6 @@ PrefabInstance:
1055210548
propertyPath: sliceRenderer
1055310549
value:
1055410550
objectReference: {fileID: 379075881}
10555-
- target: {fileID: 8016510558008620343, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3}
10556-
propertyPath: SettingsString
10557-
value:
10558-
objectReference: {fileID: 0}
1055910551
- target: {fileID: 8016510558008620343, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3}
1056010552
propertyPath: _relCoordPanel
1056110553
value:

Assets/Scripts/EphysLink/CommunicationManager.cs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour
2020

2121
#region Properties
2222

23-
private static readonly int[] EPHYS_LINK_MIN_VERSION = { 1, 0, 6 };
23+
private static readonly int[] EPHYS_LINK_MIN_VERSION = { 1, 1, 0 };
2424

2525
public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION);
2626

@@ -153,13 +153,33 @@ public void VerifyVersion(Action onSuccess, Action onFailure)
153153
{
154154
GetVersion(version =>
155155
{
156-
if (!version.Split(".").Where((versionNumber, index) =>
157-
int.Parse(new string(versionNumber.TakeWhile(char.IsDigit).ToArray())) <
158-
EPHYS_LINK_MIN_VERSION[index])
159-
.Any())
160-
onSuccess.Invoke();
161-
else
156+
var versionNumbers = version.Split(".").Select(versionNumber =>
157+
int.Parse(new string(versionNumber.TakeWhile(char.IsDigit).ToArray()))).ToArray();
158+
159+
// Fail if major version mismatch (breaking changes).
160+
if (versionNumbers[0] != EPHYS_LINK_MIN_VERSION[0])
161+
{
162+
onFailure.Invoke();
163+
return;
164+
}
165+
166+
// Fail if minor version is too small (missing features).
167+
if (versionNumbers[1] < EPHYS_LINK_MIN_VERSION[0])
168+
{
162169
onFailure.Invoke();
170+
return;
171+
}
172+
173+
// Fail if patch version is too small and minor version is not greater (bug fixes).
174+
if (versionNumbers[1] == EPHYS_LINK_MIN_VERSION[1] &&
175+
versionNumbers[2] < EPHYS_LINK_MIN_VERSION[2])
176+
{
177+
onFailure.Invoke();
178+
return;
179+
}
180+
181+
// Passed checks.
182+
onSuccess.Invoke();
163183
}, onFailure.Invoke);
164184
}
165185

Assets/Scripts/Insertion/ProbeInsertion.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,24 @@ public Vector3 PositionWorldU()
155155
return BrainAtlasManager.ActiveReferenceAtlas.Atlas2World(PositionSpaceU());
156156
}
157157

158+
[Obsolete("Method is now BrainAtlasManager, please replace")]
158159
public Vector3 World2T(Vector3 coordWorld)
159160
{
160161
return BrainAtlasManager.ActiveAtlasTransform.U2T(BrainAtlasManager.ActiveReferenceAtlas.World2Atlas(coordWorld));
161162
}
162163

164+
[Obsolete("Method is now BrainAtlasManager, please replace")]
163165
public Vector3 World2T_Vector(Vector3 vectorWorld)
164166
{
165167
return BrainAtlasManager.ActiveAtlasTransform.U2T_Vector(BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(vectorWorld));
166168
}
167169

170+
[Obsolete("Method is now BrainAtlasManager, please replace")]
168171
public Vector3 T2World(Vector3 coordT)
169172
{
170173
return BrainAtlasManager.ActiveReferenceAtlas.Atlas2World(BrainAtlasManager.ActiveAtlasTransform.T2U(coordT));
171174
}
175+
[Obsolete("Method is now BrainAtlasManager, please replace")]
172176
public Vector3 T2World_Vector(Vector3 vectorT)
173177
{
174178
return BrainAtlasManager.ActiveReferenceAtlas.Atlas2World_Vector(BrainAtlasManager.ActiveAtlasTransform.T2U_Vector(vectorT));

Assets/Scripts/Pinpoint/Probes/Controllers/CartesianProbeController.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,12 @@ public override void SetProbeAngles(Vector3 angles)
805805
/// <returns></returns>
806806
public override (Vector3 tipCoordWorldU, Vector3 tipRightWorldU, Vector3 tipUpWorldU, Vector3 tipForwardWorldU) GetTipWorldU()
807807
{
808-
Vector3 tipCoordWorldU = BrainAtlasManager.WorldT2WorldU(_probeTipT.position);
809-
Vector3 tipRightWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.right, false) - tipCoordWorldU).normalized;
810-
Vector3 tipUpWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.up, false) - tipCoordWorldU).normalized;
811-
Vector3 tipForwardWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.forward, false) - tipCoordWorldU).normalized;
808+
// Note: we need to use the reference coordinates here so that the world positions resolve to (0,0,0) at Bregma,
809+
// otherwise any rotations that get applied will be incorrect
810+
Vector3 tipCoordWorldU = BrainAtlasManager.WorldT2WorldU(_probeTipT.position, true);
811+
Vector3 tipRightWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.right, true) - tipCoordWorldU).normalized;
812+
Vector3 tipUpWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.up, true) - tipCoordWorldU).normalized;
813+
Vector3 tipForwardWorldU = (BrainAtlasManager.WorldT2WorldU(_probeTipT.position + _probeTipT.forward, true) - tipCoordWorldU).normalized;
812814

813815
return (tipCoordWorldU, tipRightWorldU, tipUpWorldU, tipForwardWorldU);
814816
}

Assets/Scripts/Pinpoint/Probes/ProbeManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,7 @@ public void UpdateSurfacePosition()
801801
// get the surface coordinate in un-transformed world space
802802
_brainSurfaceWorldU = BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(entryCoordAtlasIdx);
803803
// go back into transformed space, only using the reference coordinate for the entry coordinate (not the transform coordinate)
804-
_brainSurfaceWorldT = BrainAtlasManager.WorldU2WorldT(_brainSurfaceWorldU, false);
805-
804+
_brainSurfaceWorldT = BrainAtlasManager.WorldU2WorldT(_brainSurfaceWorldU, true);
806805
_brainSurfaceCoordT = BrainAtlasManager.ActiveAtlasTransform.U2T(
807806
BrainAtlasManager.ActiveReferenceAtlas.World2Atlas(_brainSurfaceWorldU, true));
808807
}
@@ -829,7 +828,7 @@ public void UpdateSurfacePosition()
829828
Vector3 tipInBrain = tipAtlasIdxU;
830829

831830
// Adjust the tip coordinate to put it into the brain
832-
// This is kind of a dumb algorithm, we
831+
// This is kind of a dumb algorithm
833832
if (!probeInBrain)
834833
{
835834
// Get which direction we need to go

Assets/Scripts/Pinpoint/TrajectoryPlannerManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ public async void Startup()
166166

167167
// Load Atlas
168168
// Settings.AtlasName returns CCF if PlayerPrefs is cleared, otherwise returns the previous atlas setting
169-
await BrainAtlasManager.LoadAtlas(Settings.AtlasName);
169+
string atlasName = Settings.AtlasName;
170+
if (!BrainAtlasManager.AtlasNames.Contains(atlasName))
171+
atlasName = "allen_mouse_25um";
172+
173+
await BrainAtlasManager.LoadAtlas(atlasName);
170174
ReferenceAtlas referenceAtlas = BrainAtlasManager.ActiveReferenceAtlas;
171175

172176
// Set the reference coordinate before anything else happen

Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ private void Start()
2222
var textEndIndex = _text.text.LastIndexOf(": A", StringComparison.Ordinal);
2323
if (textEndIndex == -1) return;
2424

25-
// Get the probe manager with this UUID (if it exists)
25+
// Get the probe manager with this UUID (if it exists).
2626
var probeNameString = _text.text[..textEndIndex];
2727
var matchingManager = InsertionSelectionPanelHandler.TargetableProbeManagers.First(manager =>
2828
manager.name.Equals(probeNameString) || (manager.OverrideName?.Equals(probeNameString) ?? false));
2929
if (!matchingManager) return;
3030

31-
// Set the toggle color to match the probe color
31+
// Get a copy of the toggle's color block.
3232
var colorBlockCopy = _toggle.colors;
3333
colorBlockCopy.normalColor = matchingManager.Color;
3434
colorBlockCopy.selectedColor = new Color(colorBlockCopy.normalColor.r * 0.9f,

Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ public void OnTargetInsertionDropdownValueChanged(int value)
137137
_lineGameObjects.ap.SetActive(false);
138138
_lineGameObjects.ml.SetActive(false);
139139
_lineGameObjects.dv.SetActive(false);
140+
141+
// Reset dropdown color.
142+
var colorBlockCopy = _targetInsertionDropdown.colors;
143+
colorBlockCopy.normalColor = new Color(1, 1, 1);
144+
colorBlockCopy.selectedColor = new Color(0.8f, 0.8f, 0.8f);
145+
colorBlockCopy.highlightedColor = colorBlockCopy.selectedColor;
146+
_targetInsertionDropdown.colors = colorBlockCopy;
140147
}
141148
else
142149
{

Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Linq;
44
using EphysLink;
55
using TMPro;
6-
using TrajectoryPlanner.UI.EphysLinkSettings;
76
using UnityEngine;
87
using UnityEngine.Events;
98
using UnityEngine.UI;

0 commit comments

Comments
 (0)