Select Page

# Curve Toolbox – Curve lenght

• Author
Posts
• #1523

Hi, I’m using the curve toolbox on BrainSuite v13a4. I would like to compare the length of one specific sulcus between subjects. I’m wondering if it is possible to measure the lenght of the drawn curves or extract any other quantitative measure of the sulci.
Thanks for your kind help and support
Davide Fedeli

• #1524

hi Davide –

We don’t have tools for that as part of the package, but if you are familiar with Matlab or C++ you can calculate these lengths pretty easily. If you save out the curves as a .dfc file, you can then read them with one of our file readers.

You can find a Matlab function for reading the dfc file at the bottom of this page: http://brainsuite.org/formats/dfc/. (I think it is out

``````function [curves,hdr,xml]=readdfc(filename)
%
% Author : David Shattuck, UCLA Brain Mapping Center
fid=fopen(filename,'rb');
if (fid<0)
error(['unable to open file ' filename(:)']);
end;
curves=cell(hdr.nCurves,1);
fseek(fid,hdr.dataStart,'bof');
for i=1:hdr.nCurves;
end;
fclose(fid);``````

The curves are represented as a series of points in mm coordinates, so you can compute the path lengths very easily:

``````function curvelength=curvelength(curve)
curvelength=sum(sqrt(sum((curve(2:size(curve,1),:)-curve(1:size(curve,1)-1,:)).^2,2)));``````

If you then read in a dfc, you can easily compute the length of any of the curves:

``````curveset=readdfc('/Applications/BrainSuite18a/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain.right.dfc');
curvelength(curveset{1})
``````

Let us know if that does what you need.

thanks,
David Shattuck

• #1525

Thank you David for your answer! That’s exactly what I was looking for!
Best
Davide