Skip to content
Mar 13 17

Formatting external drives for Mac and Windows

by manuel

Formatting external drives (flash drives and external HD) for use in Mac and Windows environment can be quite confusing. Here is some info I put together:

Windows (XP+): read/write
Mac: read*

Note: There is an option to activate writing to NTFS partitions in Mac, but it’s not stable and can corrupt files.

Windows (XP+): read/write
Mac: read/write

Note: Seems to be the most compatible (also with older versions of Windows, Linux, etc). Limitations: Max file size = 4 Gb / Max partition size = 4 Tb.

Windows (7+): read/write
Mac: read/write

Note: Best options for flash drives. Limitation: not ideal for hard drives (unless solid state drives) because it’s slow in these cases.

HFS+ (Mac OS Extended)
Windows (7+): read*
Mac: read/write

Note: Windows 7+ can read, but only by using a free program called HFS Explorer or installing Apple bootcamp drivers.

Summarizing,  for bigger flash drives and solid state external drives, ExFAT seems to be the best option (although it might not work on older versions of Windows). For external drives, I would choose either NTFS or HFS+, depending on what OS you use most, and add a small partition in FAT32 to be able to read/write in both environments, and in case of HFS+, containing the necessary drivers to read the drive in Windows.


Jan 29 17

Scheduling automatic Google Sheets changes

by manuel

I have a weekly schedule for our rotations at the hospital in Google Sheets. It usually contains the schedule for the next two months. The problem was that one always had always to search for the current week… So I thought there should be a way to automatically hide past weeks from the sheet. In fact, this can be achieved by using Google Scripts.

On Google Sheets, go to Tools > Script editor… and add this script:

Change the sheet ID and sheet name, the starting date (d1) and the number of rows to hide each week (17 in my case).

Basically what the script does is it calculates the weeks elapsed from d1, multiplies this by the number of rows to hide and hides the rows.

To make it run automatically, in Google Script, go to Edit > Current project’s triggers, and add a new trigger: Time-driven / Day timer / From 1-2 am.

That’s it! The script should run every day between 1-2 am and on Saturday, the last week will be hidden, so that the first week is always the current one.

Sep 1 15

Matlab and Freesurfer

by manuel

Some functions of Freesurfer 5.3.0 (like computing the local Gyrification Index) require integration with Matlab. In order to do this, the following code has to be in matlab’s startup.m file:

Also, if you are getting “ERROR: Matlab is required to run mris_compute_lgi!”, it means your have to add the Matlab path to Freesurfer`s $PATH variable for it to run.

To do this automatically when starting FS, just edit the .tcshrc file (assuming you run FS from TCSH) adding the location of your Matlab’s bin folder:

Finally, the LGI function also has a bug when running in Matlab versions 2013+. To fix this, make the following change to /Applications/freesurfer/matlab/SearchProjectionOnPial.m:

You should be able to run LGI now! 😉

Aug 17 15

Running FreeSurfer in batch mode

by manuel

Here is a quick way to run FS for each MRI image as a Nifti file in a folder.

Start by creating a new text file in the terminal (eg vi

Put in the following code:

Save it an run it from inside the folder containing the images.

Jun 5 15

Printing your brain in 3D

by manuel

So I’ve been doing some testing on our newly acquired CubeX 3D printer and had the idea to print a miniature of my brain.

Since I served as a control for one study, I had a great T1 scan from a 3T MRI. This scan had allready been processed by FreeSurfer, so all I had to do was convert the pial surfaces to an STL file. This is actually very simple, you just need to type into the terminal:

For more information on how to install and use FreeSurfer check out this post I wrote a while ago.

Now, there are different approaches on how to process the STL files for printing. Since we have a CubeX printer, I just opened the models in the CubeX software (its free), which asked me if I wanted to correct errors in the STL file (sure I did!). With the models loaded, I scaled them to 30% and positioned both sides on the board, medial face down, saving the result as a new STL file. I imagine this new, scaled version can be imported in any slicer software. I’ve been using KISSlicer with great results (much better prints than the CubeX software, more detailed and with better supports, you also don’t need to use the original $$$ cartridges!).

Since I printed in ABS, I did some postprocessing on the brain by leaving it for about 2h in acetone vapor.


This is the original FreeSurfer generated 3D model and the printed version.