Hi Pedro,

There is probably a way to do that using FS tools from the command line, but the attached script should do the same. The result is a "data-per-vertex" file, which is the same as the .asc files from mris_convert. There is no geometry input, hence the vertex coordinates are all set to (0,0,0).

Hope it helps!

All the best,

Anderson


On 08/10/11 17:17, Pedro Paulo de Magalhães Oliveira Junior wrote:
I need to create a file where I have the parcellation value (structure name) per vertex.

I've tried mris_convert --annot /Applications/freesurfer/subjects/bert/label/lh.aparc.annot /Applications/freesurfer/subjects/bert/surf/lh.pial parc.asc

But I get the error: ERROR: unknown file annot file type specified for output: saida.asc

Has someone done this before?

Thanks
---------------------------------------------------------------------
Pedro Paulo de Magalhães Oliveira Junior
Netfilter & SpeedComm Telecom
-- www.netfilter.com.br <http://www.netfilter.com.br>
-- For mobile: http://itunes.apple.com/br/artist/netfilter/id365306441



_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

function annot2dpv(annotfile,dpvfile)
% Convert an annotation file to a DPV file.
%
% Usage:
% annot2dpv(annotfile,dpvfile)
%
% Inputs:
% annotfile : Annotation file.
% dpvfile   : Output DPV file.
%
% Before running, be sure that ${FREESURFER_HOME}/matlab is in your
% OCTAVE/MATLAB path.
%
% _____________________________________
% Anderson M. Winkler
% Yale University / Institute of Living
% Aug/2011

% Read the annotation file
[vtx,lab,ctab] = read_annotation(annotfile);

% For each structure, replace its coded colour by its index
for s = 1:ctab.numEntries,
    lab(lab==ctab.table(s,5)) = s;
end

% Save the result
dpxwrite(dpvfile,lab)
function crvwrite(varargin)
% Write a curvature file (DPV or DPF), in ASCII format.
% This function is much faster than 'dlmread' for large files,
% and works only in Linux and Mac.
%
% crvwrite(filename,crv)
% crvwrite(filename,crv,crd,idx)
%
% - fname is the file name to be created
% - crv contains the values for each vertex or face
% - crd contains the vertex coordinates or face indices
% - idx contains vertex or face sequential index
%
% _____________________________________
% Anderson M. Winkler
% Yale University / Institute of Living
% Aug/2011

% File name
fname = varargin{1};

% Get the actual data
crv = varargin{2}(:);
nX  = numel(crv);

% Check if all are integers and use appropriate formating
if all(mod(crv,1)==0),
    fstr = '%d';
else
    fstr = '%f';
end

if nargin == 2,

    % Organise the data, fill the coords with zeros amd prep to save
    crv = [(0:nX-1) ; zeros(3,nX) ; crv'];

elseif nargin == 4,

    % Organise the coords
    crd = varargin{3};
    if size(crd,1) > size(crd,2),
        crd = crd';
    end

    % Take the indices
    idx = varargin{4}(:);

    % Prepare to save
    crv = [idx' ; crd ; crv'];

else
    error('Incorrect number of arguments');
end

% Save
fid = fopen(fname,'w');
fprintf(fid,['%d %g %g %g ' fstr ' \n'],crv);
fclose(fid);
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Reply via email to