Skip to content

Commit

Permalink
Merge branch 'release/4.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
zigaroula committed Feb 9, 2023
2 parents 58f08cc + 30ca0c7 commit 415c8d1
Show file tree
Hide file tree
Showing 51 changed files with 542 additions and 128 deletions.
Binary file modified Assets/Plugins/x86_64/Linux/libhbp_export.so
Binary file not shown.
Binary file not shown.
Binary file modified Assets/Plugins/x86_64/Windows/hbp_export.dll
Binary file not shown.
Binary file modified Assets/Prefabs/Dataset/DataInfo/DataInfo item.prefab
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Resources/Themes/Main/States/Warning.asset
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Resources/Themes/Main/States/Warning.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo destinationDirectory, string projectDirectory, string oldProjectDirectory)
{
// TODO
Expand Down
15 changes: 15 additions & 0 deletions Assets/Scripts/HBP/Core/Data/Dataset/Container/DataContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ public virtual Error[] Errors
}
}

protected Warning[] m_Warnings = new Warning[0];
/// <summary>
/// Errors of the dataContainer.
/// </summary>
public virtual Warning[] Warnings
{
get
{
List<Warning> warnings = new List<Warning>();
warnings.AddRange(m_Warnings);
return warnings.Distinct().ToArray();
}
}

/// <summary>
/// True if the dataContainer is OK, False otherwise.
/// </summary>v
Expand Down Expand Up @@ -84,6 +98,7 @@ public DataContainer() : base()
/// </summary>
/// <returns>DataContainer errors</returns>
public abstract Error[] GetErrors();
public abstract Warning[] GetWarnings();

public abstract void ConvertAllPathsToFullPaths();
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo destinationDirectory, string projectDirectory, string oldProjectDirectory)
{
SavedFile = File.CopyToDirectory(destinationDirectory).Replace(projectDirectory, oldProjectDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo destinationDirectory, string projectDirectory, string oldProjectDirectory)
{
EEGHeader.CopyToDirectory(destinationDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo destinationDirectory, string projectDirectory, string oldProjectDirectory)
{
SavedFile = File.CopyToDirectory(destinationDirectory).Replace(projectDirectory, oldProjectDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo dataInfoDirectory, string projectDirectory, string oldProjectDirectory)
{
SavedPath = Path.CopyToDirectory(dataInfoDirectory).Replace(projectDirectory, oldProjectDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ public override Error[] GetErrors()
m_Errors = errors.ToArray();
return m_Errors;
}
public override Warning[] GetWarnings()
{
List<Warning> warnings = new List<Warning>();
m_Warnings = warnings.ToArray();
return m_Warnings;
}
public override void CopyDataToDirectory(DirectoryInfo destinationDirectory, string projectDirectory, string oldProjectDirectory)
{
// TODO
Expand Down
30 changes: 29 additions & 1 deletion Assets/Scripts/HBP/Core/Data/Dataset/DataInfo/CCEPDataInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ public override Error[] Errors
return errors.Distinct().ToArray();
}
}

protected Warning[] m_CCEPWarnings = new Warning[0];
public override Warning[] Warnings
{
get
{
List<Warning> warnings = new List<Warning>(base.Warnings);
warnings.AddRange(m_CCEPWarnings);
return warnings.Distinct().ToArray();
}
}
#endregion

#region Constructors
Expand Down Expand Up @@ -179,13 +190,30 @@ public virtual Error[] GetCCEPErrors(Protocol protocol)
errors.Add(new BlocsCantBeEpochedError());
}
}
if(!m_Patient.Sites.Any(site => site.Name == StimulatedChannel))
if (!m_Patient.Sites.Any(site => site.Name == StimulatedChannel))
{
errors.Add(new ChannelNotFoundError());
}
m_CCEPErrors = errors.ToArray();
return m_CCEPErrors;
}
public override Warning[] GetWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>(base.GetWarnings(protocol));
warnings.AddRange(GetCCEPWarnings(protocol));
return warnings.Distinct().ToArray();
}
/// <summary>
/// Get all dataInfo errors related to CCEP.
/// </summary>
/// <param name="protocol"></param>
/// <returns>CCEP related errors</returns>
public virtual Warning[] GetCCEPWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>();
m_CCEPWarnings = warnings.ToArray();
return m_CCEPWarnings;
}
#endregion
}
}
81 changes: 81 additions & 0 deletions Assets/Scripts/HBP/Core/Data/Dataset/DataInfo/DataInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public Dataset Dataset
/// </summary>
protected Error[] m_NameErrors = new Error[0];

protected Warning[] m_NameWarnings = new Warning[0];

/// <summary>
/// True if the dataInfo is visualizable, False otherwise.
/// </summary>
Expand All @@ -110,6 +112,20 @@ public virtual Error[] Errors
}
}

/// <summary>
/// All dataInfo warnings.
/// </summary>
public virtual Warning[] Warnings
{
get
{
List<Warning> warnings = new List<Warning>();
warnings.AddRange(m_NameWarnings);
warnings.AddRange(m_DataContainer.Warnings);
return warnings.Distinct().ToArray();
}
}

/// <summary>
/// Callback executed when error checking is required.
/// </summary>
Expand Down Expand Up @@ -180,6 +196,7 @@ public virtual string GetErrorsMessage()
if (errors.Length == 0) stringBuilder.Append(string.Format("• {0}", "No error detected."));
else
{
stringBuilder.AppendLine("Errors:");
for (int i = 0; i < errors.Length - 1; i++)
{
if (errors[i].Message != "")
Expand Down Expand Up @@ -207,6 +224,70 @@ public virtual string GetErrorsMessage()
return stringBuilder.ToString();
}
/// <summary>
/// Get all dataInfo warnings.
/// </summary>
/// <param name="protocol">Protocol of the dataset the dataInfo belongs to.</param>
/// <returns>All dataInfo errors.</returns>
public virtual Warning[] GetWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>();
warnings.AddRange(m_DataContainer.GetWarnings());
return warnings.Distinct().ToArray();
}
/// <summary>
/// Get all naming-related errors.
/// </summary>
/// <returns>All naming-related errors.</returns>
public virtual Warning[] GetNameWarnings()
{
List<Warning> warnings = new List<Warning>();
m_NameWarnings = warnings.ToArray();
return m_NameWarnings;
}
/// <summary>
/// Get all message warnings in a readable form.
/// </summary>
/// <returns></returns>
public virtual string GetWarningsMessage()
{
Warning[] warnings = Warnings;
StringBuilder stringBuilder = new StringBuilder();
if (warnings.Length == 0) stringBuilder.Append(string.Format("• {0}", "No error detected."));
else
{
stringBuilder.AppendLine("Warnings:");
for (int i = 0; i < warnings.Length - 1; i++)
{
if (warnings[i].Message != "")
{
stringBuilder.AppendLine(string.Format("• {0} ({1})", warnings[i].Title, warnings[i].Message));

}
else
{
stringBuilder.AppendLine(string.Format("• {0}", warnings[i].Title));

}
}
if (warnings.Last().Message != "")
{
stringBuilder.Append(string.Format("• {0} ({1})", warnings.Last().Title, warnings.Last().Message));

}
else
{
stringBuilder.Append(string.Format("• {0}", warnings.Last().Title));

}
}
return stringBuilder.ToString();
}
public virtual void GetErrorsAndWarnings(Protocol protocol)
{
GetErrors(protocol);
GetWarnings(protocol);
}
/// <summary>
/// Generate a new unique identifier.
/// </summary>
public override void GenerateID()
Expand Down
28 changes: 28 additions & 0 deletions Assets/Scripts/HBP/Core/Data/Dataset/DataInfo/FMRIDataInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ public override Error[] Errors
return errors.Distinct().ToArray();
}
}

protected Warning[] m_FMRIWarnings = new Warning[0];
public override Warning[] Warnings
{
get
{
List<Warning> warnings = new List<Warning>(base.Warnings);
warnings.AddRange(m_FMRIWarnings);
return warnings.Distinct().ToArray();
}
}
#endregion

#region Constructors
Expand Down Expand Up @@ -131,6 +142,23 @@ public virtual Error[] GetFMRIErrors(Protocol protocol)
m_FMRIErrors = errors.ToArray();
return m_FMRIErrors;
}
public override Warning[] GetWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>(base.GetWarnings(protocol));
warnings.AddRange(GetFMRIWarnings(protocol));
return warnings.Distinct().ToArray();
}
/// <summary>
/// Get all dataInfo errors related to CCEP.
/// </summary>
/// <param name="protocol"></param>
/// <returns>CCEP related errors</returns>
public virtual Warning[] GetFMRIWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>();
m_FMRIWarnings = warnings.ToArray();
return m_FMRIWarnings;
}
#endregion
}
}
37 changes: 32 additions & 5 deletions Assets/Scripts/HBP/Core/Data/Dataset/DataInfo/MEGcDataInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,24 @@ namespace HBP.Core.Data
public class MEGcDataInfo : PatientDataInfo
{
#region Properties
protected Error[] m_FMRIErrors = new Error[0];
protected Error[] m_MEGErrors = new Error[0];
public override Error[] Errors
{
get
{
List<Error> errors = new List<Error>(base.Errors);
errors.AddRange(m_FMRIErrors);
errors.AddRange(m_MEGErrors);
return errors.Distinct().ToArray();
}
}

protected Warning[] m_MEGWarnings = new Warning[0];
public override Warning[] Warnings
{
get
{
List<Warning> errors = new List<Warning>(base.Warnings);
errors.AddRange(m_MEGWarnings);
return errors.Distinct().ToArray();
}
}
Expand Down Expand Up @@ -127,9 +138,25 @@ public override Error[] GetErrors(Protocol protocol)
public virtual Error[] GetMEGErrors(Protocol protocol)
{
List<Error> errors = new List<Error>();
// TODO
m_FMRIErrors = errors.ToArray();
return m_FMRIErrors;
m_MEGErrors = errors.ToArray();
return m_MEGErrors;
}
public override Warning[] GetWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>(base.GetWarnings(protocol));
warnings.AddRange(GetMEGWarnings(protocol));
return warnings.Distinct().ToArray();
}
/// <summary>
/// Get all dataInfo errors related to CCEP.
/// </summary>
/// <param name="protocol"></param>
/// <returns>CCEP related errors</returns>
public virtual Warning[] GetMEGWarnings(Protocol protocol)
{
List<Warning> warnings = new List<Warning>();
m_MEGWarnings = warnings.ToArray();
return m_MEGWarnings;
}
#endregion
}
Expand Down
Loading

0 comments on commit 415c8d1

Please sign in to comment.