Duke-UNC Brain Imaging and Analysis Center
BIAC Forums | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password   Forgot your Password?
 All Forums
 Support Forums
 Analysis Software Support
 bputil image naming
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Klein1
BIAC Alum

USA
4 Posts

Posted - Sep 06 2005 :  1:33:10 PM  Show Profile  Reply with Quote
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?

Jeff Klein

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Sep 06 2005 :  1:39:09 PM  Show Profile  Reply with Quote
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'?
Go to Top of Page

scott.huettel
BIAC Faculty

USA
45 Posts

Posted - Sep 08 2005 :  08:53:41 AM  Show Profile  Visit scott.huettel's Homepage  Reply with Quote
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.
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Sep 08 2005 :  09:38:03 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

ckim
BIAC Alum

10 Posts

Posted - Sep 08 2005 :  09:40:19 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

josh.bizzell
BIAC Staff

USA
118 Posts

Posted - Sep 08 2005 :  10:04:48 AM  Show Profile  Reply with Quote
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
Go to Top of Page

charles.michelich
BIAC Alum

USA
183 Posts

Posted - Sep 09 2005 :  10:59:07 PM  Show Profile  Reply with Quote
The renaming program that I used is "1-4 Rename". You can download it from http://www.1-4a.com/rename/ or use the version installed on Gall (\\Gall\Programs\Tools\renamer.exe).

It was designed for renaming MP3 files, but worked well for renaming images and such when I used it.

Chuck
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
BIAC Forums © 2000-2010 Brain Imaging and Analysis Center Go To Top Of Page
This page was generated in 0.53 seconds. Snitz Forums 2000