Skip to content

Commit d900539

Browse files
committed
fix: partial fix (in null transform) for API output errors
1 parent d66d17b commit d900539

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Assets/Scripts/Pinpoint/Probes/ProbeManager.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private string perShankDepthIDs(int shank)
470470
//Vector3 topCoordWorldT = uiManager.ShankTipT().position + _probeController.ProbeTipT.up * _channelMaxY;
471471

472472
Vector3 baseCoordWorldT = uiManager.ShankTipT().position;
473-
Vector3 topCoordWorldT = uiManager.ShankTipT().position + _probeController.ProbeTipT.up * _channelMap.FullHeight;
473+
Vector3 topCoordWorldT = uiManager.ShankTipT().position - _probeController.ProbeTipT.forward * _channelMap.FullHeight;
474474
//float height = _channelMaxY - _channelMinY;
475475
float height = _channelMap.FullHeight;
476476

@@ -549,10 +549,9 @@ public string GetChannelAnnotationIDs(bool collapsed = true)
549549
{
550550
// For now we'll ignore x changes and just use the y coordinate, this way we don't need to calculate the forward vector for the probe
551551
// note that we're ignoring depth here, this assume the probe tip is on the electrode surface (which it should be)
552-
Vector3 channelCoordWorldT = shankTipCoordWorldT + _probeController.ProbeTipT.up * channelMapData[i].y / 1000f;
552+
Vector3 channelCoordWorldT = shankTipCoordWorldT - _probeController.ProbeTipT.forward * channelMapData[i].y / 1000f;
553553

554554
// Now transform this into WorldU
555-
ProbeInsertion insertion = _probeController.Insertion;
556555
Vector3 channelCoordWorldU = BrainAtlasManager.WorldT2WorldU(channelCoordWorldT, true);
557556

558557
int elecIdx = si * channelMapData.Count + i;
@@ -576,10 +575,9 @@ public string GetChannelAnnotationIDs(bool collapsed = true)
576575
{
577576
// For now we'll ignore x changes and just use the y coordinate, this way we don't need to calculate the forward vector for the probe
578577
// note that we're ignoring depth here, this assume the probe tip is on the electrode surface (which it should be)
579-
Vector3 channelCoordWorldT = tipCoordWorldT + _probeController.ProbeTipT.up * channelMapData[i].y / 1000f;
578+
Vector3 channelCoordWorldT = tipCoordWorldT - _probeController.ProbeTipT.forward * channelMapData[i].y / 1000f;
580579

581580
// Now transform this into WorldU
582-
ProbeInsertion insertion = _probeController.Insertion;
583581
Vector3 channelCoordWorldU = BrainAtlasManager.WorldT2WorldU(channelCoordWorldT, true);
584582

585583
int ID = BrainAtlasManager.ActiveReferenceAtlas.GetAnnotationIdx(BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(channelCoordWorldU));
@@ -1082,9 +1080,21 @@ private void SetMaterialsLine()
10821080
}
10831081

10841082
#endregion
1083+
1084+
#region Static conversion functions
1085+
//public static ProbeData ProbeManager2ProbeData(ProbeManager probeManager)
1086+
//{
1087+
// ProbeData data = new ProbeData();
1088+
1089+
// data.Insertion = probeManager.ProbeController.Insertion.Data;
1090+
1091+
// data.SelectionLayerName = probeManager.SelectionLayerName;
1092+
// // [TODO]
1093+
//}
1094+
#endregion
10851095
}
10861096

1087-
[Serializable]
1097+
[Serializable, Obsolete("Replaced by ProbeData")]
10881098
public struct ProbeManagerData
10891099
{
10901100
// ProbeInsertion

0 commit comments

Comments
 (0)