Jump to content

Recommended Posts

UPDATE:

🎉🎉Found the fix and now have functional dilation extraction going. 🎉🎉

-----------------------------------------------------------

SRanipalEye_FunctionLibrary.cpp

bool USRanipalEye_FunctionLibrary::GetPupilDiameter(EyeIndex eye, float& diameter_mm)
{
	return SRanipalEye_Core::Instance()->GetPupilDiameter(eye, diameter_mm);
}

SRanipalEye_Core.cpp

bool SRanipalEye_Core::GetPupilDiameter(EyeIndex eye, float &diameter_mm)
{
	bool valid = false;
	if (SRanipalEye_Framework::Instance()->GetStatus() == SRanipalEye_Framework::FrameworkStatus::NOT_SUPPORT) {
		valid = true;
		diameter_mm = 0.0f;
	}
	else {
		UpdateData();

		Eye::SingleEyeData eyeData;
		switch (SRanipalEye_Framework::Instance()->GetEyeVersion())
		{
		case SupportedEyeVersion::version1:
			eyeData = eye == EyeIndex::LEFT ? EyeData_.verbose_data.left : EyeData_.verbose_data.right;
			break;
		case SupportedEyeVersion::version2:
			eyeData = eye == EyeIndex::LEFT ? EyeData_v2.verbose_data.left : EyeData_v2.verbose_data.right;
			break;
		}

		valid = eyeData.GetValidity(Eye::SingleEyeDataValidity::SINGLE_EYE_DATA_PUPIL_DIAMETER_VALIDITY);
		if (valid) {
			diameter_mm = eyeData.pupil_diameter_mm;
		}
		else
			diameter_mm = 0.0f;
	}
	return valid;
}

SRanipal_Core.h

	bool GetPupilDiameter(EyeIndex eye, float& diameter_mm);

SRanipalEye_FunctionLibrary.h

UFUNCTION(BlueprintCallable, Category = "SRanipal|Eye")
		static bool GetPupilDiameter(EyeIndex eye, float& diameter_mm);

 

  • Thanks 1
Link to post
Share on other sites
  • 3 months later...

@cte, thank you so much! Works like a charm on UE 4.25. For those who are completely new to modifying the .cpp and .h files, a few more things to note in order to not get lost:

  • The "SRanipal_Core.h" file is actually called "SRanipalEye_Core.h" (as of the 1.3.1.1 Release, perhaps previously it was named differently or just a type from cte)
  • After adding all the above code, you may need to right-click on your .uproject file in Explorer and select "generate visual studio project files" in order for the new BP node to appear (I also reopened the project from Epic Games Launcher for the node to finally become available, not sure if this is a needed step though).

Cheers

  • Like 1
Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...