Monday, January 28, 2013

Hypoplasia: Improved Algorithm Explained

Let's take a closer look at my outlier ignoring algorithm.  First, let's look at what is going on in the photo.  The tiny dots every are the data points gathered during a simulated left hand test.  The slightly transparent purple regions are the regions the algorithm "deletes" from the list of valid data points.  The cyan dot is the average point from the available data and the cyan lines are the lines made by the Cartesian coordinate system centered at the average point (I am aware that the cyan dot in this picture is not in the exact average location, but it is close enough to illustrate how the algorithm works).  The red numbers number each quadrant.

First off, the algorithm finds the average point of the collected data.  That point should be inside the circle made by the arc.  Next, the algorithm determines which hand is being tested.  In the screenshot, it uses the average point, but I have since changed it to use the first data point because patients start with their thumb along the side of the device and sweep their thumb towards themselves.  The change was made to accomodate smaller devices in which the test may take up the entire screen.  Once the average point and the hand being tested are found, the algorithm deletes all data in the 3rd quadrant for left handed tests and the 4th quadrant for right handed tests.  This region is represented by the semi-transparent magenta rectangle in the screenshot of the app.  A collection of data points along the edge of the screen is common during tests on smaller devices, but not on tablets, because the palm comes in contact with the screen.  

Second, the algorithm uses some statistics to calculate the maximum allowed distances between valid data points.  I have yet to take a stats class, so I used a formula that I found on Yahoo Answers.  I really wish my school offered AP Stats...

Third, the algorithm checks all remaining data points to see if they have a neighbor within the allowed maximum distance.  If they do, then the data point is assumed to be valid.  This caused problems earlier with the palm's invalid data points because they had neighbors within the allowed maximum distance, but they were all invalid data points.  But if the data point does not have a neighbor within the specified distance, then it is discarded.  In the screenshot of the app, you can see data points discarded by this part of the algorithm highlighted in a semi-transparent magenta circle.

That pretty much sums up the algorithm.  It can be processor intensive, especially the third part because of the number of calculations involved, but since the user starts the process by clicking on the "analyze data" button I'm not too worried if it takes a second or two to finish.

Thanks for stopping by!

Chris Konstad

Update: Robotics, Thumb Hypoplasia, Algorithms, etc.

I've been busy recently with school work, Robotics and working on the thumb hypoplasia app.  My homework load is manageable, but it keeps me busy (thank you, AP classes).

As far as Robotics goes, we've been having double workdays so that we can get in the water a little early, and we're making the most complex ROV we've ever had.  We are designing and making many parts that we used to buy commercially, and we are packing more electronics onboard the ROV than we *ever* have before.  This ROV is going to have more processing power than my first computer (a Win98 SE hand-me-down).  To top it all off, we have the absolute COOLEST electronics canister.  It honestly belongs in a Sci-Fi movie!  I wish I could post some pictures, but you'll have to wait for our team's official tech report.  Sorry!

The lab that I'm working with for the thumb hypoplasia app recently got a Samsung Galaxy Player, so I've been busy optimizing the app for their screen size and making changes as they report issues discovered during their field testing.  For example, on my A500 (10.1" tablet), there were no accidental touches by the palm on the edge of the screen, but on the Galaxy Player it is quite easy to accidentally touch the edge.  I worked out a function last night to remove one outlying point.  I need to modify the algorithm because it only works for a single outlying point and it needs to be able to remove many.  Here's an explanation of the function:

It takes a little time to execute when there are many data points to check, but that doesn't really affect the user experience as it is only run when the user tells the app to analyze the data.

This summer, I plan to work on many projects.  I want to finish the Git client during summer vacation, and I'd really like to finish porting Monterey to Android.  I also want to tweak ROV-Suite to add in some Raspberry Pi fun (probably on the bottomside).

Thanks for stopping by!

Chris Konstad

Tuesday, January 1, 2013

Android Git Client (GUI)

Great news!  I've started working on a GUI Git client for Android devices.  Right now, all it does is install Git and then display the version, but I'll expand on the feature set in the coming months.  It is written in Qt using Necessitas.  Right now, I use wget (from BusyBox, I believe) to download a Git binary, but I plan on writing a downloader class to handle that because stock Android does not have wget (or that's what my testing has shown).  The UI then passes commands to the git binary using QProcess.  Yes, this is not the most elegant way to handle Git, but it works.  Also, this will let me expose the entire feature set of Git to the GUI.  You can find the source for it here.  Please keep in mind that the current app is currently in a proof-of-concept state, so the code may be a little sloppy.  Sorry about that!  I'll be cleaning up the current code as I flesh out this app.

You can find the proof-of-concept build here.  When you run it, please be patient with the initial black screen!  I need to show a progress indicator for the git binary download, but right now there is no indication that the app is running.  It should show a black screen for a few seconds while it downloads the 5.5MB binary.

Thanks for stopping by!

Chris Konstad