Tracking using two Infrared LEDs

318 views
Skip to first unread message

Simone Calabrese

unread,
Oct 28, 2019, 5:04:05 AM10/28/19
to Bonsai Users

Dear Users,

I am planning to record mouse neuronal activity and couple it with the animal position using infrared LEDs. For neuronal recording, I am using OpenEphys GUI and for the tracking, I am using Bonsai. The two programs interact thanks to a plugin developed by the group on this paper: https://www.biorxiv.org/content/10.1101/340141v1.full

The workflow that I am now using is made to distinguishing between 2 colors. My plan is to modify it in order to recognize two different IR light sources. The two LEDs have a different dimension, is it possible to differentiate between them and use the same workflow?

Thanks in advance
Simone

Gonçalo Lopes

unread,
Oct 31, 2019, 10:20:22 PM10/31/19
to Simone Calabrese, Bonsai Users
Hi Simone and welcome to the forums!

Can you elaborate a bit more on your strategy? What do you want to measure and what have you currently tried? Do you need just position, or orientation? Do you have any example workflows or videos of example data you have tried to run the system on?

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/9b5ba82e-9e84-4187-a1aa-ef4b5c65015b%40googlegroups.com.

Simone Calabrese

unread,
Nov 4, 2019, 6:46:26 AM11/4/19
to Bonsai Users
Hi Gonçalo,
Thanks for replying. We are interested in recording neurons firing in specific space locations in an open-field arena. To do that we want to track the animal using Infrared LEDs sources. The LEDs are attached with a headstage to the animal. Our plan is to have information about the two LED reciprocal position, so we can use this information for knowing where the neuron were firing and we can extract also information about the head rotation. I attached the workflow that I am currently using.

Thanks 
Simone



Il giorno venerdì 1 novembre 2019 03:20:22 UTC+1, goncaloclopes ha scritto:
Hi Simone and welcome to the forums!

Can you elaborate a bit more on your strategy? What do you want to measure and what have you currently tried? Do you need just position, or orientation? Do you have any example workflows or videos of example data you have tried to run the system on?

On Mon, 28 Oct 2019 at 09:04, Simone Calabrese <calabres...@gmail.com> wrote:

Dear Users,

I am planning to record mouse neuronal activity and couple it with the animal position using infrared LEDs. For neuronal recording, I am using OpenEphys GUI and for the tracking, I am using Bonsai. The two programs interact thanks to a plugin developed by the group on this paper: https://www.biorxiv.org/content/10.1101/340141v1.full

The workflow that I am now using is made to distinguishing between 2 colors. My plan is to modify it in order to recognize two different IR light sources. The two LEDs have a different dimension, is it possible to differentiate between them and use the same workflow?

Thanks in advance
Simone

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai...@googlegroups.com.
Bonsai workflow.png

João Frazão

unread,
Nov 4, 2019, 7:54:25 AM11/4/19
to Simone Calabrese, Bonsai Users
Can you use more leds? Like 4?

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/d09fdc69-13b7-4568-96ac-4debe2a0d723%40googlegroups.com.

Simone Calabrese

unread,
Nov 8, 2019, 5:05:39 AM11/8/19
to Bonsai Users
Hi, I think that 4 LEDs could be too much for a mouse headstage, it could be too heavy and the behaviour could be strongly altered.


Il giorno lunedì 4 novembre 2019 13:54:25 UTC+1, João Frazão ha scritto:
Can you use more leds? Like 4?

On Mon, Nov 4, 2019, 11:46 Simone Calabrese <calabres...@gmail.com> wrote:
Hi Gonçalo,
Thanks for replying. We are interested in recording neurons firing in specific space locations in an open-field arena. To do that we want to track the animal using Infrared LEDs sources. The LEDs are attached with a headstage to the animal. Our plan is to have information about the two LED reciprocal position, so we can use this information for knowing where the neuron were firing and we can extract also information about the head rotation. I attached the workflow that I am currently using.

Thanks 
Simone



Il giorno venerdì 1 novembre 2019 03:20:22 UTC+1, goncaloclopes ha scritto:
Hi Simone and welcome to the forums!

Can you elaborate a bit more on your strategy? What do you want to measure and what have you currently tried? Do you need just position, or orientation? Do you have any example workflows or videos of example data you have tried to run the system on?

On Mon, 28 Oct 2019 at 09:04, Simone Calabrese <calabres...@gmail.com> wrote:

Dear Users,

I am planning to record mouse neuronal activity and couple it with the animal position using infrared LEDs. For neuronal recording, I am using OpenEphys GUI and for the tracking, I am using Bonsai. The two programs interact thanks to a plugin developed by the group on this paper: https://www.biorxiv.org/content/10.1101/340141v1.full

The workflow that I am now using is made to distinguishing between 2 colors. My plan is to modify it in order to recognize two different IR light sources. The two LEDs have a different dimension, is it possible to differentiate between them and use the same workflow?

Thanks in advance
Simone

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/9b5ba82e-9e84-4187-a1aa-ef4b5c65015b%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai...@googlegroups.com.

João Frazão

unread,
Nov 8, 2019, 11:10:04 AM11/8/19
to Simone Calabrese, Bonsai Users
Ok! with 4 you could try to extract 3d head position, and also be more resilient to occlusions and noise.
With two and having two different sizes can work if in all situations seem from the camera the biggest led is always bigger than the small.
changing the bonsai workflow should be simple to do that.
Can you send the bonsai workflow file (instead of just the screen capture)? and if you have a movie?

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/1c32ddbc-7c3a-4081-9137-f5ae54e7c002%40googlegroups.com.


--
Joao Frazao
Intelligent Systems Laboratory
Champalimaud Centre for the Unknown
Av. Brasília, Doca de Pedrouços
1400-038 Lisboa, Portugal
www.neuro.fchampalimaud.org

Laurenz M

unread,
Nov 8, 2019, 11:21:34 AM11/8/19
to Bonsai Users
Hi Simone,

FYI, people in our lab routinely use 4 infrared LEDs on a mouse head stage to track the position of the animal with no problem (they are mounted on a piece of wire). We use 1 of these
in the back and an array of 3 in the front - I haven't got the details for the ones in the front, but they are ~2mm white squares (if you space these out well they will form one nice large dot of brightness). I hope that helps.

Best

Laurenz

Simone Calabrese

unread,
Nov 11, 2019, 5:21:59 AM11/11/19
to Bonsai Users
Hi! I attached the workflow file. About the video, is enough if it is directly from FlyCapture acquisition? 
For the size issue, Laurenz makes me notice that I explained myself wrong. I am talking about two different infrared LEDs arrays, with a different number of LEDs each, that is why they are of different size. Two arrays are usually enough to overcome of occlusions and noise.
Thanks again! 
Simone


Il giorno venerdì 8 novembre 2019 17:10:04 UTC+1, João Frazão ha scritto:
Ok! with 4 you could try to extract 3d head position, and also be more resilient to occlusions and noise.
With two and having two different sizes can work if in all situations seem from the camera the biggest led is always bigger than the small.
changing the bonsai workflow should be simple to do that.
Can you send the bonsai workflow file (instead of just the screen capture)? and if you have a movie?

tracking.bonsai
Message has been deleted

Simone Calabrese

unread,
Nov 11, 2019, 5:53:48 AM11/11/19
to Bonsai Users
Hi Laurenz!
Thanks for your reply! Actually you make me noticed that I explained myself wrong. We also use two LEDs arrays, I just express myself in a not proper way talking about the tracking system.
Thanks for make me notice it!
All the best
Simone

João Frazão

unread,
Nov 12, 2019, 6:35:27 PM11/12/19
to Simone Calabrese, Bonsai Users
Hi simone,
I have changed the tracking, I removed the part for tracking two colors, and I just sort the blobs by size, and when we have at least two we use them.
Hope this works for you

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/0d52c126-a4bb-41f5-886c-f4f930079515%40googlegroups.com.
trackingHead2Leds.bonsai

Simone Calabrese

unread,
Nov 13, 2019, 5:03:00 AM11/13/19
to Bonsai Users
Hi! Thanks for the help. I tried it and it gave me this error message. How can I fix it?
All the best
Simone


Il giorno mercoledì 13 novembre 2019 00:35:27 UTC+1, João Frazão ha scritto:
Hi simone,
I have changed the tracking, I removed the part for tracking two colors, and I just sort the blobs by size, and when we have at least two we use them.
Hope this works for you

Error tracking.png

João Frazão

unread,
Nov 13, 2019, 7:39:59 AM11/13/19
to Simone Calabrese, Bonsai Users
Sorry, it was missing the grayscale conversion

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/54119d6e-0600-4cac-95c0-3d69cbde6b48%40googlegroups.com.
trackingHead2Leds.bonsai

Simone Calabrese

unread,
Nov 20, 2019, 5:56:07 AM11/20/19
to Bonsai Users
Hi guys,
I tried these days and it worked out. Thanks a lot!
All the best and have  a nice day 
Simone


Il giorno mercoledì 13 novembre 2019 13:39:59 UTC+1, João Frazão ha scritto:
Sorry, it was missing the grayscale conversion

calabrese...@gmail.com

unread,
Mar 4, 2021, 4:51:59 AM3/4/21
to Bonsai Users
Hi all,

We are now using this code to track the LEDs mounted on the mouse head stage, and we now need to align them with neuronal signals. To do so we will need all the information that comes from the tracking software. We noticed that between the original file and the modified version some information is missing from the tracking. In the original file whenever the LED was not detected, the inforamtion was stored as a NaN value. In the new version, this is not happening. Could you help us in finding where the difference is, and find a way to store the missing point as a NaN value in the recording data?
Find attached both files, the original one is called "tracking", and the new one is called "trackingHead2Leds (1)".
Thanks in advance and all the best
Simone

tracking.bonsai
trackingHead2Leds (1).bonsai

João Frazão

unread,
Mar 31, 2021, 8:08:21 AM3/31/21
to Bonsai Users
Hi,
So sorry for the late reply, this was lost,
In fact the expression condition ((Item1.count >= 2)) in the workflow filters out the NAN values.
I have changed and simplified the workflow (attached), so that NaN are being sent to OSC whenever we detect less than 2 Leds.
can you try it?
I don't know if you where doing anything when only one of the Leds is detected?
Thank You
trackingHead2LedsNaN.bonsai

calabrese...@gmail.com

unread,
Mar 31, 2021, 12:24:00 PM3/31/21
to Bonsai Users
Hi all,

Thanks a lot for the help. I tried the workflow, and it gave some issues. The LEDs were not followed while I was moving them. I went into the Expression Transformation and I changed into  ((Item1.count >=2)). With this change, the program is detecting both LEDs and sends their position to OpenEphys GUI. 
After that when I am looking into the data the undetected points are registered as NaN values. 
Is what I have done correct?
Find attached the workflow.

Thanks in advance and all the best
Simone

trackingHead2LedsNaN-2.bonsai

João Frazão

unread,
Mar 31, 2021, 12:37:03 PM3/31/21
to calabrese...@gmail.com, Bonsai Users
Yes, exactly right! my mistake :)

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/f3cc579d-1618-49d1-b15b-36e4d1cb629fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages