Jon,
None of the existing utilities will calculate the Dice of two labels (at
least not in a straightforward manner). However, its easy to do in
matlab.
Attached is a script to do this. Copy it to your
$FREESURFER_HOME/matlab directory.
Usage is:
dice_labels('label1.label','label2.label')
or just
dice_labels('label1','label2')
this assumes the two labels were created in the same volume.
Nick
On Thu, 2009-08-20 at 12:21 -0400, [email protected] wrote:
> Hi,
>
> I need to compute the reliability of two manually traced ROIs and I was
> told to use the command mri_compute_seg_overlap. However, it seems
> this command needs its input to be in .mgz format, but the ROIs have
> been saved as .label files in Freeview. A simple renaming function
> does not work, so is there another way to make mri_compute_seg_overlap
> work with .label files? Thanks.
>
> Best,
> Jon
> _______________________________________________
> Freesurfer mailing list
> [email protected]
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
>
function dice = dice_labels(lname1, lname2)
% d = dice_labels(lname1, lname2)
%
% computes Dice coefficient of the two given label files.
%
%
% dice_labels.m
%
% Original Author: Nick Schmansky
% CVS Revision Info:
% $Author: nicks $
% $Date: 2009/08/20 18:01:32 $
% $Revision: 1.1 $
%
% Copyright (C) 2009,
% The General Hospital Corporation (Boston, MA).
% All rights reserved.
%
% Distribution, usage and copying of this software is covered under the
% terms found in the License Agreement file named 'COPYING' found in the
% FreeSurfer source code root directory, and duplicated here:
% https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense
%
% General inquiries: [email protected]
% Bug reports: [email protected]
%
label1 = read_label('',lname1);
label2 = read_label('',lname2);
label1Size = size(label1,1);
label2Size = size(label2,1);
hits = 0;
for i=1:label1Size
x1 = label1(i,2);
y1 = label1(i,3);
z1 = label1(i,4);
for j=1:label2Size
x2 = label2(j,2);
y2 = label2(j,3);
z2 = label2(j,4);
if ((x1==x2) && (y1==y2) && (z1==z2))
hits = hits+1;
break;
end
end
end
dice = (2 * hits) / (label1Size + label2Size);
_______________________________________________
Freesurfer mailing list
[email protected]
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer