Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Klein1
Posted - Sep 06 2005 : 1:33:10 PM When I've run the coregistration and normalization step together, the bhx files are name sncra while the image files are still named snra. SPM doesn't like this. Is anyone else having this problem, or is there a scrip out there to rename the snra image files sncra?
It was designed for renaming MP3 files, but worked well for renaming images and such when I used it.
Chuck
josh.bizzell
Posted - Sep 08 2005 : 10:04:48 AM Is there any reason you can't just change the directory name?
If not, then the following sample code shows how to change the directory names from sncrarun* to snrarun* in Matlab. (It could also be edited slightly to change file names as well):
fpath = '\\Server\Study.01\Data\Func\49999';
fspec = 'sncra';
replspec = 'snra';
d = dir(fullfile(fpath,[fspec,'*']));
if ~isempty(d)
for i = 1:length(d)
if d(i).isdir
movefile(d(i).name,[replspec,d(i).name(length(fspec)+1:end)]);
end
end
end
-Josh
ckim
Posted - Sep 08 2005 : 09:40:19 AM I suggest using CodeWright since you can open up all the .BXH files at once and do a global search and replace to change the filenames.
syam.gadde
Posted - Sep 08 2005 : 09:38:03 AM The following script can be used to rename snra files to sncra.
#!/bin/sh
for oldname in "$@" ; do
newname=`echo "$oldname" | sed 's/\(.*\)snra/\1sncra/'`
if [ "$oldname" != "$newname" ] ; then
mv $oldname $newname
fi
done
Save the above to a file, for example "snra_rename.sh". Run it like this:
sh snra_rename.sh snra*
The argument snra* selects all files starting with snra. You will have to change the filenames in the .bxh file too using an editor.
scott.huettel
Posted - Sep 08 2005 : 08:53:41 AM The issue is that we have SPM-batching scripts that expect that the file name and file directory are named similarly. (The former is snra and the latter is sncra). If there is a simple way to rename the files en masse, then it would let us continue with the analyses while we rewrite the scripts to make them more general. At one point, Chuck had identified a freeware (I think) tool for renaming, and I assume that there is a quick way to write such a tool in matlab.
syam.gadde
Posted - Sep 06 2005 : 1:39:09 PM This has been the case for as long as I remember. I don't know why. SPM will not read the .bxh file, so I assume you are trying to read snra* files into SPM. What does SPM not like about the missing 'c'?