View Full Version : OT: I now have a video to show

11-05-2016, 06:26 PM
I have permission from the professor to show my work as long as I do not give away the actual data. This video shows the result of displaying the data but does not hand out any numbers so it is ok.

Here are a couple of stills that show how my software works. What you are seeing is a full model of the brain (my brain it happens to be <grin>). It is surrounded by a model of the EEG cap and the cap has a set of international standard 10-20 EEG electrodes spaced on the front half for a total of 16 channels. Surrounding the electrodes are areas that create the same colours depending on the strength of the EEG signals. Above all of that is a graph it makes (will make, I did this one by hand). That graph is the average of all the signals with about the same colours (except yellow at this time) depending on high versus low readings. I have snagged just two readings, one at very low and one very high. At both times the signals are very synchronized (nearly all the same amplitude) because of how the person was thinking at that exact moment. That means a lot and is a very import thing to see. This is a real reading from a very real person. And no, I don't know who. That is none of my business.

Keep in mind that the entire graph represents just one half second of time. This makes everything so very easy to see. In the video the time of the data display is slowed by about 30 times so the data change part runs about 15 seconds. The video sucks but that is the best I can do and keep it to a reasonable size.

This is a very early version and it will be a lot better when I am finished with it. I imagine I will never really be finished as I will always be thinking of some way to improve it. Even just the graph I hand made really impressed the professor. I felt rather guilty telling him how easy it was to make just by using Excel. He tells me it is the best he has ever seen. I think I need to do a little teaching of his students on how to make nice graphs with Excel. He wants to use graphs like that for publishing his work. I can do that easily and quickly and so can his students with a bit of instruction.

So, here are the stills:

This is most signals synced to very low (negative) voltage:


And this is mostly synced at very high positive. It is in microvolts, about 7.0 Áv max:


When the brain does this it is a very short term indicator of a special event taking place, a decision being made or perhaps something unusually good happening. Perhaps winning a little prize in the test sequence caused it. That takes just milliseconds and that is where my software comes in. It makes it so much easier to identify, especially when you need to scan many minutes of recordings. Just run at full speed until you see a flash and bingo! You know where to look closer. I wish I could show you what they currently do but that would be giving away real data. It is a very lengthy and tedious inspection of the squiggly lines in a huge set of readings. I sure wouldn't want to do that for a living and I have been for just a little while.

I am not putting the video on u-tube. I don't want to make it so thoroughly public. It is a 2 meg download from my server and my server has unlimited access rights. In fact I have a very cool contract, unlimited everything. But I will not be leaving it up for more than a week or two, sorry.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Video taken down as it is now very out of date. Will post a newer one in a little while.

I have a feeling that at least some of you will guess just how I am doing this job. It should be pretty obvious. <Grin>

Because of how I am doing it it isn't even totally off topic.

11-05-2016, 09:07 PM
The .wmv file won't play on my Mac. Can you post a .mov file?

11-05-2016, 09:30 PM
That is indeed intriguing. Wish I knew what it meant!

11-05-2016, 09:43 PM
Download VLC for the Mac. It will play it just fine. Converting to a .mov file will reduce the quality quite a lot. It is bad enough as it is.


11-05-2016, 11:06 PM
Very interesting, Evan. I can see that you'll be having some fun with this-

11-05-2016, 11:43 PM
Download VLC for the Mac.

I did, and now I can see your video. Nice graphics, indeed. Does the viewer select a particular sensor to see the transformed waveform, or will this be automated if and when something interesting shows up?

11-05-2016, 11:57 PM
The biggest problem I have been having it getting the software to run fast enough. To solve that I have been using some very old programmer tricks that I learned near the beginning. I have been programming for just over half a century. Back in the old days speed was always an issue as well as free memory. The two go hand in hand when using an interpreted language, which I must in this case. When the lab programmer, a young woman, sees my code she is really going to wonder what I am doing and why. I have a long string of code to activate and change every color change that must happen at a very high rate. I currently have it running up to about 10,000 changes per second. That is far faster than anybody would think possible in the system I am using.

The way I do it is to unwrap all possible loops. Modern programmers would look at my code and very much wonder why I am doing the nearly identical set of steps over and over again without making it into a simple loop. There is a very basic reason. Loops cost time and memory. When the code loops there must be parameters that are being handed into the loop, such as what color to change, what color to change it to and how many times to do it. That must be kept in some variables so those changes can be made in each pass through the loop. Variables requires memory in which to store those changes. Eventually the memory space must be cleaned up to make room for more variable changes. Then "garbage collection" must take place and that means shutting down the app until this background activity is finished. It is a matter of marking all the no longer needed variable values, clearing the allocated ram and essentially defragmenting the temp storage ram. Collection used to be very obvious on the slow machines as the app might be shut off for full seconds.

They now use "transparent" garbage collection but the time used is still there, just hidden. When a lot of high speed looping activity is taking place it can really slow down the process at hand. By writing essentially identical code numerous times over and over I can avoid the use of variables altogether. Instead I can simply write in explicit values for the parameters that must change each time that code is executed. No looping = no variables = no garbage collection = fast code. The speed difference can be remarkable and in this case it is. So what if the code is long and a hassle to debug? I only need to do that once. That memory is now essentially free. So I will end up with about 61 sets of identical code, one after the other with the only differences being the actual colour numbers and several data matrix indexes that would normally always be in variables.

All the interpreter must do is read the actual values in front of it's face as it creates the run code. Far far faster.

Yes, I am having fun. This is the sort of thing I really enjoy doing and have since I was 14.

11-06-2016, 12:00 AM
Does the viewer select a particular sensor to see the transformed waveform, or will this be automated if and when something interesting shows up?

I am not quite sure what you mean. I will be making all sorts of things available on a small control panel to one side. What I put there will depend on the professor and the other lab people. Once they finish the renovations of the lab meeting space I will be getting together with the other lab crew on a weekly basis most likely. That should be in a week or three.

The graphics look far better on a screen without being mangled in a video.

The CZ sensor right at the top is the one that usually gives some indication of what is happening just about anywhere in the brain. That is the one to monitor in most cases to see if anything unusual is going on. The brain is highly conductive so the sensor array does not have high resolution, even with a full 61 sensors (or even more now).

11-06-2016, 01:31 AM
I was confused. But after reading your first post again (now that I have seen the video) I am less in the dark.

This abstract might pertain to what you are doing: http://www.sciencedirect.com/science/article/pii/S0165027003003479, but I don't have the institutional credentials to read it for free. Can your prof give you access?

11-06-2016, 02:11 AM
That is very interesting Allan. I know the prof has quite a bit of Matlab based material but I'm not sure if he has that. I must assume that he knows about it and for some reason he wants what I am providing. What I can see on that one is that it is far more complex (and a lot nicer) than what I am doing right now but I have plans for the future that would take it a lot closer. I think the prof wants something that is very easy to use. When I showed him my model yesterday I emphasized how easy it is to start and use and he immediately agreed that was very important. On mine, even now, all you do is turn on the computer and click one icon and it is there, all set to go. Just click the mouse again and the display is running. My understanding is that this is for both displaying what is happening but also just simple quick scanning for those with low understanding, students for instance.

What I see on that Matlab based system is years of work by more than one person. However, much of what they have listed in the abstract are things already on my list of things to do. I shall ask him about that when he gets back from his vacation.

I should mention I already have access to many things including that.

I think this is most likely the reason he needs me to write something very easy to use. That would of course apply to anything to eventually be used by doctors for any sort of diagnosis. It must be very simple.

Experienced MATLAB users can use EEGLAB data structures and stand-alone signal processing functions to write custom and/or batch analysis scripts. Extensive function help and tutorial information are included.

I can tell you one thing. The name MATLAB will instantly scare away a lot of possible users.

11-06-2016, 02:37 AM
I can tell you one thing. The name MATLAB will instantly scare away a lot of possible users.

I feel the same way about Autocad.

11-06-2016, 02:43 AM
I read all of yer posts Even. I am in agreement with you on some points.

I am not as old as you guys, or in touch with the computer stuff these days.

My experience with PCs? Haa, be careful. I couldnt afford a Mac. So PC it was in 1989. My Bridgeport Boss 5 CNC Mill runs on DOS so there is that. JR

11-06-2016, 03:09 AM
I should mention I already have access to many things including that.

The abstract is from 2004, which I did not notice when I posted it. It might be a useful source of terminology, though, to find more current stuff.

11-06-2016, 05:09 AM
Optimizing assembly code...that was always the fun part for me when I worked at DEC. Several of us would work over some section of code, striving to make it as small and as fast as possible. One guy would take a crack at it, and when he couldn't improve it any more he'd pass it to the next guy who would see if he could find any optimizations the first guy missed. When we were done with it, we would show it to Richie. Richie was amazing. He would look at this piece of code that we had spent several hours squeezing and speeding up, and after about half a minute he would says, "Oh. You'll love this. Give me a pencil." Whereupon he would mangle what we had worked so hard on, invariably making it smaller, faster, and breathtaking in its cleverness.

Of course, that method of programming couldn't be sustained. It was too labor-intensive. When programming moved on to higher-level languages (e.g. C) and practically unlimited memory space I lost interest. It was fun while it lasted though.

11-06-2016, 08:25 AM
Assembly language didn't exist when I started programming. The first machine I programmed was the Bendix G-15. It was programmed in pure double precision octal code. Just the raw numbers, no clever three character names for the code, nothing. It had a huge 128 bytes of "ram", two tiny vacuum tubes for each bit of ram, six bits per byte.

Allan, I did some more investigation on that Matlab system. The prof has it and uses it too but for some reason it isn't what he wants. He showed me some screens that are definitely from that system. It must be the lack of simplicity for the users. I worry about how our kids are being taught these days. If the prof thinks that the little chart I made is "wonderful" I get concerned. He has made other comments in the past too. When I attended his lecture where this all started there were about 30 people there with me and most of us were the older crowd. The prof was about to show us on a map where Mount Everest is located and then said "I don't really need to show you this. You aren't like my students....". I remember doing a full report on nearly ever country on Earth including drawing my own map of where it is and that was in sixth grade.

One thing I haven't mentioned is that the display is very controllable. It can be set to transparency so the entire brain is visible under the lighted areas. This makes it a lot easier to identify the actual brain lobes under the sensors if one doesn't already know. It is amazing to me just how "standard" our brains are. The relative location of the various brain lobes and areas doesn't vary by more than just a few millimetres from person to person. There are some exceptions in a few people and I am one of those.

In one of the large deep "fissures" otherwise known as a "sulcus" that separate the major lobes of the brain mine has a shortened part where it is filled with additional "gray matter". The gray matter is the part of the brain that does the thinking. The white matter is the "wiring", the parts of the nervous tissue that handles the communications all around in the brain. In my case the lateral sulcus, also known as the "Sylvian Fissure" is bridged by brain tissue. This is creating a connection that "they" think has something to do with additional communication of the visual occipital lobes to the anterior and temporal cortex, the thinking areas of the brain. I discovered this when I just recently was doing the model of my entire brain for this project. I hadn't looked at the entire outside profile of my brain before in my MRIs. I was more interested in what was happening inside.

When I saw this I immediately thought of the one other person that I know has been documented as having the same characteristic. That person was always known to state that they thought "visually", all things that they think about are in some way directly related to how it looks in reality (or could look if it actually existed). That is how I always think and is why I do not often draw plans for what I build. The plans are in my head visually. The only time I draw plans with cad are when I want to show others or sometimes just because it looks cool. My entire CNC mill has virtually no plans. So at least one other person has (had) the same feature that I do. That person is now long dead.

I hesitate to mention who that is because I don't want it taken the wrong way. I doubt this has much to do with level of intelligence directly, just how one thinks about things. I actually think it runs in my family too. It would explain some things both in the past and the younger generations in my family.

The other person documented to have this is Albert Einstein.

11-06-2016, 01:45 PM
Allan, I now know what the problem is with that much older Matlab system. While it has all sorts of nice features it is missing the most important one, speed. From what I saw when I was meeting with the prof I now realize that what I was looking at on his machine is one of the functions that system provides. What it cannot do is provide what he needs, the ability to show all the nice brain actions at anything close to the activity rate. That is what he needs more than anything else since they are investigating things never looked at before. It's all about events that occur in milliseconds. Nobody knew there are brain activities that mean something and take place so quickly. The human brain clock speed is far higher than we realized. There are many things like that we are now discovering and that is a really big one. There is so much about our brains that we do not yet know. It is a very new field of study. In my present work that speed is priority number 1 and is something I saw right from the start. In the line graphs it most likely has been considered noise and is probably intentionally filtered out. It is filtered on the graph I drew. I will need to watch out for that. You can even see some of it in the video where the colours suddenly change and that is slowed down a lot. My own work is teaching me things I didn't know. That is what I like the most about this project, learning. I am and always have been seriously addicted to learning.

As I think about this while writing here I am starting to wonder. I wonder if the sample clock rate is even high enough? Something to talk about with the prof, I think. I need to do some analysis and see if there is evidence of aliasing due to the Nyquist limit being reached. There is a brain wave they recently found that is up as high as 50 hertz. That is awfully high for a biological system. It is now called the Gamma wave spectrum. They originally dismissed it as noise. It isn't.

Spending all day staring at raw numbers sure isn't the way to find this sort of thing. But, it is hard to ignore when it flashes in front of you. The more I work on this the cooler it looks and that isn't because I am somehow doing such a good job. It is very educational. But then, that is the entire point.

The best thing of all about this project is that it puts me in a position to directly take part in the research.

11-06-2016, 07:58 PM
Allan, I now know what the problem is with that much older Matlab system. While it has all sorts of nice features it is missing the most important one, speed. ...

If MATLAB is fundamentally too slow for your application, then it is good that you can avoid this trap using your old programming tricks.

There are a lot of plug-ins for EEGLAB, for displaying data in unique ways. This website might be useful as an overview of ideas: https://sccn.ucsd.edu/wiki/EEGLAB_Extensions_and_plug-ins.

11-06-2016, 08:38 PM
When I first spoke to the prof and asked how I might be able to help him he then asked if I could "build" some sort of high speed visual display system. This wasn't my idea. He very specifically asked for what I am programming. It wasn't down to the details of what it would look like other than being in some way visual. I had previously introduced myself to him via a detailed e-mail that I can write software and made it very clear that what I like best is anything visual from highly technical data to artwork as long as it is done on a computer screen. That is why I am writing this the way I am.

My visual way of thinking is also the reason I bought a quite expensive 4K 29 inch monitor some years ago. They are finally almost good enough in the graphics capability department. Not quite, but getting a lot closer. I have been waiting most of my life for computer screens to be at least this good. The screen on my Samsung 10" tablet is almost perfect with the OLED 4K screen. I have extremely sharp vision, better than 20/10 and the Samsung is good enough that I cannot distinguish individual pixels unless they are light on dark.

Incidentally, sharp vision isn't all about the lens. It matters a lot just how dense the cones are in the retina. Mine must be very dense.

Through my life I have always wondered what I would do if I lost my vision. I then quickly turn away from those thoughts. The most likely result wouldn't be good.

11-06-2016, 08:56 PM
I have just found some bugs in my code (and data especially) and the display system is now far better. I think I will do another video, most likely tomorrow, so those that care stay tuned. There was some noise (real noise, crazy numbers) in the data so I need to write a filter for that.

Wow!. The code runs really pretty now. I rewrote a good bit of it and it looks far better. Making lots of progress now. The prof is off for a week so I have lots of time to make it look much nicer. Time to put in a little control panel. Adding more channels is just grunt work.

11-14-2016, 04:54 PM
A bit off topic, but maybe of interest. A bit of near-spam came into work the other day, related to some sensors we have installed for students. Different measuring devices, measuring different things, but still...


Might have something for those interested... seems like they're overlaying info on a standard picture of the brain.


11-15-2016, 04:53 PM
quote: NIR spectrum light takes advantage of the optical window in which skin, tissue, and bone are mostly transparent to NIR light in the spectrum of 700-900 nm

I find that hard to believe. I have never heard of such solid materials having an optical window to photons in such a high spectrum. The visible spectrum is 390 to 700 nm. They are claiming (and writing in Wikipedia) the such near infrared can pass right through the skull? This is news to me and I have played around with IR light a lot including IR photography.

I did find an original medical article on this but do not have full access to it unfortunately.


This is something worth experimenting with. I have the proper filters and several of my cameras are usable at near IR. It isn't in any way related to what I am doing but it is still something I would like to know more about. Thanks for the update.

My project is coming along nicely and is now at a point where it is at a professional level. I have completely rewritten the code among other things. I am going to post an update soon with another video showing how it looks now. It is very different. You should drop by and see what it looks like in real life.