announcing Ctrax for Mac

246 views
Skip to first unread message

John Bender

unread,
May 2, 2013, 1:10:39 AM5/2/13
to ct...@googlegroups.com
I've finally been able to build and distribute Ctrax for Mac OS X.
It's a standalone app that has been tested in Lion and Mountain Lion
and is available from the expected location on Sourceforge:
https://sourceforge.net/projects/ctrax/files/ . Running under Mountain
Lion might require you to download XQuartz first
(http://xquartz.macosforge.org) - please let me know if that's the
case, so I can update the documentation.

You can run Ctrax by double-clicking on the Ctrax.app file, or you can
also run it from the command line as Ctrax.app/Contents/MacOS/Ctrax
with all the usual arguments.

If you're used to the Linux or Windows version, you might notice a few
changes in the user interface related to how windows or controls look
or behave. These are due to the differences inherent to Mac and are
generally outside our control. The Mac version is not referenced in
the Ctrax documentation yet, since I'm depending on the first batch of
users to point out any differences.

It's likely that some of you will notice real bugs that need to be
fixed, but overall Ctrax for Mac seems to be in pretty good shape.
Once we have ironed out all the glitches, we should be able to package
it for the Mac App Store. Please send us your feedback!

JB

John Bender

unread,
May 3, 2013, 4:39:44 PM5/3/13
to ct...@googlegroups.com
Hi Bryn,

Here's the first thing I didn't document - I couldn't get Ctrax for Mac to read compressed AVI files. I'm actively working to make this work better on all platforms, but it's not there yet. Here's the existing documentation on how to convert videos for use with Ctrax:
http://ctrax.sourceforge.net/install.html#input-video-formats . It's a sore spot in general, definitely Ctrax's biggest weakness, I think.

Also, it's good to know it works on Snow Leopard! That's something else I can add to the documentation.

JB


On Fri, May 3, 2013 at 1:07 PM, Bryn Gaertner <bgae...@gmail.com> wrote:
Hi!  I'm a total total newbie to ctrax.  I just downloaded it to osX.  I'm running snow leopard. You have really good documentation but I'm so pathetically naive when it comes to a lot of computer programs....

So I have a movie.  I converted it to AVI.  I tried to open it in ctrax and it said "unknown file extension; will try AVbin to open.  Then it threw an exception: Trying to read compressed AVI, but USE_AVBIN flag set to false

Is there a simple fix for this?  Is there a program other that quicktime I should be using to convert my files to AVI?  I couldn't quite figure out how to get them into the fmf format.

Thanks... and I'm sorry I'm so naive :-/

Bryn
--
You received this message because you are subscribed to the Google Groups "ctrax" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ctrax+un...@googlegroups.com.
To post to this group, send email to ct...@googlegroups.com.
Visit this group at http://groups.google.com/group/ctrax?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bryn Gaertner

unread,
May 6, 2013, 10:36:01 AM5/6/13
to ct...@googlegroups.com
Hi John,

I thought I had it completely uncompressed!  Hrm. Okay well I guess I can give Matlab a try?  That's the only product listed that works with mac?  I'm sorry I suck at this :-/

Bryn


--
You received this message because you are subscribed to a topic in the Google Groups "ctrax" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ctrax/mGHU5AEnuOs/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ctrax+un...@googlegroups.com.

John Bender

unread,
May 6, 2013, 12:33:59 PM5/6/13
to ct...@googlegroups.com
Hi Bryn,

OK, I looked at your error message more closely. It looks like your
file is not named with a ".avi" extension, which is how Ctrax
determines its file type. Try just renaming your movie to "movie.avi"
or something and see if it will open in Ctrax.

You can use the mencoder/ffmpeg options on Mac, even though they're
just listed for Linux. It will take some extra time to set them up on
your Mac, but they'll definitely work. I've used the VLC application
as a movie editing and conversion tool in the past, though I'm not
certain if it produces movies compatible with Ctrax.

JB

Bryn Gaertner

unread,
May 6, 2013, 3:52:20 PM5/6/13
to ct...@googlegroups.com
Hi again John,

It says that the filename is .AVI.  I changed it to .avi, and now the error is that it could open AVbin but not read the AVI.  Maybe quicktime is converting it incorrectly?  It's a huge file but quicktime can't read it. 

(FYI for mac users:: for downloading ffmpegx, you also have to download a couple other components that don't come bundled because of the open-sourceness of this all.  they are linked on the ffmpegx install page.  For this component: mpeg2enc.intel, this website: http://mjpeg.sourceforge.net/MacOS/ will take you to a download page, but to download pre-compiled software, you can't download it directly (if you click the link it goes to awful html crap), you have to do option + click to download it, and *that* only works in Safari, not Firefox.  *whew*)

Anyway, I converted to .avi using ffmpeg but it is still not working.  What codec should I be using?  There are several with the file extension .avi: mpeg4, divx, msmpeg, etc.  Nothing says "uncompressed"

Thanks again for your help. 

John Bender

unread,
May 6, 2013, 4:23:54 PM5/6/13
to ct...@googlegroups.com
Hi Bryn,

Ah yes, file extensions are case-sensitive. I can actually fix that in
a future release.

The Ctrax docs say to use the "raw" codec with ffmpeg (though I've
never actually done this myself).
http://ctrax.sourceforge.net/install.html#input-video-formats You
won't get Ctrax to open any compressed video format in Mac, because I
can't get AVbin to read any of the AVIs I've tried. I am working on
that.

Thanks for the notes on ffmpeg installation. I'll put those into the docs, too!

JB

John Bender

unread,
May 14, 2013, 12:53:47 AM5/14/13
to ct...@googlegroups.com
Hi Bryn,

Did this ever work for you? I'm updating the documentation now and
want to make sure I have it correct and complete, if possible.

JB

Bryn gaertner

unread,
May 14, 2013, 1:53:17 AM5/14/13
to ct...@googlegroups.com
Hi John,

Sorry I'm in Oregon for the week so I've been out of touch. I never got it to convert to a proper .avi format. The Mac version of ffmpeg is called ffmpegx and there's a disclaimer on the website that they're not affiliated with ffmpeg, so I'm wondering if Maybe I just can't get the right format with that program? I can try again on Friday, but I might just throw in the towel and use a PC. Maybe the stars will be in the right alignment on Friday though!

Thanks for checking in--

Bryn

John Bender

unread,
May 14, 2013, 11:06:22 AM5/14/13
to ct...@googlegroups.com
Hi Bryn,

I've definitely installed FFmpeg from source on a Mac before. The
download site also lists some binaries for Mac, which I haven't tried:
http://www.ffmpeg.org/download.html . However, it wouldn't be the end
of the world to convert your movies on a Windows or Linux machine,
either.

JB

Bryn Gaertner

unread,
May 21, 2013, 10:37:40 AM5/21/13
to ct...@googlegroups.com
Hi John,
OMG it's working!!!

I ended up installing quicktime pro, converting it to grayscale, then exporting it as an uncompressed .avi and that worked fine.   Bummer, you have to pay for it, but we had a license floating around.

Right now it's tracking!  IT'S ACTUALLY TRACKING!!!!  I don't think I can express to you how excited I am right now.

I did try to make a background model (there's a lot of empty space in this particular arena) and it crashed, though I'm not sure why because the wxPython window also closed.

Anyway thank you sooooo much for all your help and for making a Mac installer for this!   You're fantastic!

John Bender

unread,
May 21, 2013, 11:45:51 AM5/21/13
to ct...@googlegroups.com
I'm happy to hear it's working! If you have the crash happen again with the same movie, you should send me the movie and detailed instructions on how to reproduce the crash. 

JB

Bryn Gaertner

unread,
May 21, 2013, 5:44:08 PM5/21/13
to ct...@googlegroups.com
Here you go!  THis time it froze without crashing, so here's the error report.  It doesn't do it when I use the wizard (which I just discovered!) but it does when you use the dropdown menus.

This program is absolutely fantastic, and I'm really impressed with how user-friendly it is.  Thanks again.

Oh!  I had FixErrors crashing in matlab, I think if I used a full-sized video?  Not sure.  Here's the error message for that:
loaded /Users/bryn/Desktop/CTRAX/test.mat
detecting births...
detecting deaths...
detecting jumps...
detecting orientation changes...
detecting swaps...
detecting large major axes...
detecting orientation-velocity mismatches...
Movie: /Users/bryn/Desktop/CTRAX/test.avi
Mat: /Users/bryn/Desktop/CTRAX/test.mat
Annname: /Users/bryn/Desktop/CTRAX/test.ann
Temporary file created at: tmpfixed_test.mat
Index exceeds matrix dimensions.

Error in fixerrorsgui>fixerrorsgui_OpeningFcn (line 73)
       if any(~isnan(handles.timestamps(t0:t1)) & ...

Error in gui_mainfcn (line 221)
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in fixerrorsgui (line 23)
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in fixerrors (line 294)
trx = fixerrorsgui(seqs,moviename,trx0,annname,params,matname,loadname,readframe_fcn);
 
If it did this, it wouldn't load the GUI. 

Thanks again!
Bryn


--
drawbox_crashreport.rtf

John Bender

unread,
Jun 15, 2013, 11:10:30 PM6/15/13
to ct...@googlegroups.com
Hi Bryn,

Are you still having Ctrax crash when calculating the background? It
looks like a bug in the windowing library we're using, which only
recently started to support Mac. I can file a bug report with them,
but the more information you can provide, the better.

The FixErrors crash is one I can fix, which I'll do as soon as I can.

JB
> You received this message because you are subscribed to the Google Groups
> "ctrax" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Bryn gaertner

unread,
Jun 16, 2013, 5:46:11 PM6/16/13
to ct...@googlegroups.com
Hi JB,

Thinks seem to be working now. I'm actually away on a summer program but I was able to pipeline things for my undergrad. Basically we down sampled the video while we were putting it into .avi format to reduce the memory, and it worked fine. However, when we were going into fix errors, you know how the track loads on the video so you can look at flagged frames? The video is in some strange orientation so the flies don't line up with the tacks. This is the case even when we hit the " flip video" button. Any thoughts?

Thanks!
Bryn
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ctrax/mGHU5AEnuOs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ctrax+un...@googlegroups.com.
> To post to this group, send email to ct...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ctrax.

John Bender

unread,
Jun 16, 2013, 7:11:27 PM6/16/13
to ct...@googlegroups.com
Hi Bryn,

That's odd. Can you figure out what the orientation change is? I could potentially add another button to make that transformation, too, whatever it is. Sometimes it also happens that the frames are offset in time from the tracks, especially with compressed AVIs. Maybe you can send me a screenshot, or share a video with me so I can see what you're seeing?

JB
>>>> <> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ctrax/mGHU5AEnuOs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ctrax+un...@googlegroups.com.
> To post to this group, send email to ct...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ctrax.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "ctrax" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ctrax+un...@googlegroups.com.
To post to this group, send email to ct...@googlegroups.com.

Bryn Gaertner

unread,
Nov 13, 2013, 3:39:53 PM11/13/13
to ct...@googlegroups.com
Hi John!

Blast from the past.  I had a lot of CTRAX movies to analyze so I did the batch processing all night.  Great, it's done!  But now a question, hopefully simple.

For our current purposes, we don't need to use matlab after the analysis is done-- our flies don't touch each other and stay in restricted areas, so exporting as .csv and annotating from there works just fine.  However, the batch processing automatically exported as .mat!  I thought I could just go back and open the movie and associated .ann file for each video and export it as .csv, however, now when I do that it saves OVER the .ann file and I lose that information.  I have a vague memory from before that if I opened a movie with its .ann file that it would just appear, with the tracks loaded and everything.

So my questions are: 1) can I load the .ann file in CTRAX, and somehow I'm just doing it the wrong way?  It's been several months since I've used the program so that's not unlikely.  Or, 2) is there a simple way to get the .mat files into .csv?  Here's what I have so far in a .m file (Oh, and it's been forever since I've used matlab, so...)

C=horzcat(identity,x_pos,y_pos) %these are the only three columns I need for the analysis I'm doing
dlmwrite('file.dat', C, 'precision',7)

and if that's as simple as it gets, is there any way to throw a for loop in there such that I can run this in my folder containing all my .mat files?  If not that's okay but I remain eternally hopeful.

If you have time to answer this I really appreciate it; I realize this is a bonehead email but I am really bad at this stuff :-(

Thanks again,
Bryn


--
You received this message because you are subscribed to a topic in the Google Groups "ctrax" group.

John Bender

unread,
Nov 13, 2013, 4:03:53 PM11/13/13
to ct...@googlegroups.com
Hi Bryn,

Ctrax should never be overwriting your .ann files. When it opens an annotation file, it creates a backup copy of the old annotation file in the same directory, named bak_XXX.ann. You ought to be able to select or rename these bak_ files in order to use them instead of a new (empty) file. If this isn't happening, there's something wrong that I'd like to fix.

However, if it even looks like Ctrax is overwriting your .ann files, that also sounds like a bug which I'd like to fix. Your memory is accurate, and it should load and display the previous annotation. What version of Ctrax are you using? And are you using Mac? Can you give me an exact sequence of steps I can use to reproduce this bug? (E.g., open an AVI movie, click this button, then that button, select that option, etc.)

In addition to fixing this bug, I can suggest two things. One thing, which will help you immediately, is to open the movie in FixErrors in Matlab, and then quit FixErrors. It should prompt you to save a .csv file at that point. Let me know if this works. The second thing is that I could automatically do .csv export from Ctrax in batch mode, or add it as an option. Would that help you?

JB

Bryn Gaertner

unread,
Nov 13, 2013, 4:35:35 PM11/13/13
to ct...@googlegroups.com
Hey John,

Thank you SOOO much for being so attentive towards me :)

Problem is solved, as I pieced together .csv for all my files from matlab doing lots of copying and pasting.  (one of these days, I'll figure out how to do "for" loops....)

Sigh.

I tried to recreate the error and now it's not erroring, it works just fine.  Annotation files load no problem, I can see the tracks.  There must be some magic that once I ask for help, I stop having problems. 

I think exporting .csv in batch mode would be a nice option, maybe export as both?  Though honestly now that I figured out what to do in matlab it'd be a simple task to make a .m file that does it.

Anyway thank you so much.  Until the next adventure...

John Bender

unread,
Apr 29, 2014, 1:22:22 AM4/29/14
to ct...@googlegroups.com
For reference, beginning with Ctrax 0.5.0, it can now read compressed
AVIs on Mac.

JB

adelain...@usask.ca

unread,
Apr 25, 2016, 9:00:36 PM4/25/16
to ctrax
Hi John,
I was going to purchase a linux machine to set up ctrax in my lab. I didn't know there's a Mac version now. Have all the glitches been fixed or am I better off using linux?
Adelaine

John Bender

unread,
Apr 25, 2016, 9:02:46 PM4/25/16
to ct...@googlegroups.com
Hi Adelaine,

I think the Mac version is in good shape - at least, I think there are a number of people using it, and I haven't heard complaints. Anybody care to confirm?

JB
--
You received this message because you are subscribed to the Google Groups "ctrax" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ctrax+un...@googlegroups.com.
To post to this group, send email to ct...@googlegroups.com.
Visit this group at https://groups.google.com/group/ctrax.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages