Of course! I haven't tested the code below, but I think it should work right away.
Let's assume that FreeSurfer is installed in /usr/local/freesurfer/ (if not, replace the location in the code below). Also, you'd need to replace the name of your subject directory.
Finally, I have assumed that brainstemSsLabels.v10.mgz was modified and saved as brainstemSsLabels.v10.edited.mgz (again, replace as needed).
subjectdir='/mysubjectdir/';
editedFileName='brainstemSsLabels.v10.edited.mgz';
addpath /usr/local/freesurfer/matlab
d=dir(subjectdir);
for i=1:length(d)
tentativeSegFile=[subjectdir '/' d(i).name '/mri/' editedFileName];
if d(i).isdir && exist(tentativeSegFile,'file')
A=MRIread(tentativeSegFile);
MidbrainVol=8*sum(A.vol(:)==173); % the eight is because each voxel of the segmentation has a volume equal to 0.125 cubic mm
PonsVol=8*sum(A.vol(:)==174);
MedullaVol=8*sum(A.vol(:)==175);
SCPvol=8*sum(A.vol(:)==178);
disp(['Subject ' d(i).name ', midbrain = ' num2str(MidbrainVol) ', pons = ' num2str(PonsVol) ', medulla = ' num2str(MedullaVol) ', SCP = ' num2str(SCPvol)]);
end
end
One more thing: if you haven't edited anything around the SCP, I would use the original estimate for this structure. The reason is that, because the SCP is very thing, the voxel count is a much poorer approximation for the volume as computed by the code (i.e., using soft segmentations).
Cheers,
Eugenio
Juan Eugenio Iglesias
Postdoctoral researcher BCBL
www.jeiglesias.com
www.bcbl.eu
Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer
From: "Jacky Lee" <cylee10@gmail.com>
To: "Freesurfer support list" <Freesurfer@nmr.mgh.harvard.edu>
Cc: "Eugenio Iglesias" <e.iglesias@bcbl.eu>
Sent: Thursday, May 12, 2016 10:32:24 AM
Subject: Re: [Freesurfer] Manual correction for brainstem module
Hi Eugenio,
Yes please give me some advice on the matlab commands for this since I am not very familiar with matlab...
Cheers,
Jacky
Hi Jacky,
this is a good question, and unfortunately there isn't a great answer to it.
The volume is computed upong a probabilitic segmentation of the voxels that is
not written to disk (this is very similar to what happens with aseg.mgz and
aseg.stats). In order to properly update the volume estimates, you would have
to know the probability that the inpainted voxels belong to the brainstem as
estimated by the algorithm, which we don't currently write to disk.
Another option would be to toss the volumes given by the algorithm, and compute
new volumes for all cases and brainstem structures using the hard
segmentations. You would simply have to count the number of voxels labeled as
midbrain, pons, SCP and medulla for each subject. You can easily do this e.g.
with Matlab (let me know if you need help with this).
Cheers,
Eugenio
Juan Eugenio Iglesias
Postdoctoral researcher BCBL
www.jeiglesias.com
www.bcbl.eu
Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer
From: "Jacky Lee" <cyle...@gmail.com>
To: "Freesurfer support list" <Freesurfer@nmr.mgh.harvard.edu>
Sent: Monday, May 9, 2016 2:01:53 AM
Subject: [Freesurfer] Manual correction for brainstem module
Hi freesurfer experts,
I have successfully run the brainstem module for some subjects. On visual
checking, I can see there are voxels with T1 hypointense lesions mislabelled as
non-brainstem tissue. I manually corrected them on the
brainstemSsLabels.v10.mgz on Freeview. Then how do I obtain this new corrected
volume of the brainstem substructures?
Thanks.
Regards,
Jacky
addressed. If you believe this e-mail was sent to you in error and the e-mail
http://www.partners.org/complianceline . If the e-mail was sent to you in error
dispose of the e-mail.