AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
January 08, 2003 03:28PM
Hi,

We also addressed the image order problem by writing a UNIX shell script to rename the DICOM files, before using to3d to load images into AFNI. I can't speak for all DICOM formats out there, but it has worked successfully with our DICOM images, which are from a Siemens magnet running a recent upgrade of the Numaris OS. Basically, there is a UID in the text header portion of each DICOM file which contains a sequential number which represents file order. I'll post the script below, although it will probably need tweaks here and there. We are using SGi machines running IRIX 6.5. Some of the command flags may be slightly different in other UNIX/Linux OSes. Not only does the script list images sequentially, but it also adds a two letter suffix to the end of each filename (MP for mprage, EP for echo-planar, and LO for localizer images). These are the 3 main types of sequences we run in a typical scan session. Obviously, our sequence names (also in the dicom header) have this information in them, which is read by the script. Your sequence names will probably differ.
I think we may have posted this some time ago as well. It is slow and simple, but it does work well.

-Tim Souza





#!/bin/sh
echo "_____________________________________________________"
echo " "
echo " dicom_rename"
echo ""
echo " a simple ordered rename of dicom files"
echo " using study instance UID and sequence type."
echo " Tim 4/28/01"
echo "_____________________________________________________"


echo "Enter path where Dicom images are located: \c:"
read path
cd $path

echo "path is `pwd`"
echo ""
echo "reading headers and renaming Dicom images accordingly"
echo ""
sleep 1

for file in `ls`
do
# is the file a dicom image? check for DICM tag
dicom=`strings -ao $file | sed -n '1p' | cut -d " " -f2`
if test "$dicom" != DICM
then
echo $file "is not a dicom image!"
else
idnum=`strings -ao $file | grep 0000200 | cut -d" " -f2 | cut -d. -f12 | cut -c1-11`

strings -ao $file | grep tProtocolName | cut -d= -f2 | grep mpr > /dev/null
if [ "$?" -eq 0 ]
then
echo $file "MPRAGE renamed "$idnum"_MP"
mv $file "$idnum"_MP

else
strings -ao $file | grep tProtocolName | cut -d= -f2 | grep ep > /dev/null
if [ "$?" -eq 0 ]
then

echo $file "echo-planar BOLD renamed "$idnum"_EP"
mv $file "$idnum"_EP

else
strings -ao $file | grep tProtocolName | cut -d= -f2 | grep localizer > /dev/null
if [ "$?" -eq 0 ]
then

echo $file "LOCALIZER renamed "$idnum"_LO"
mv $file "$idnum"_LO
else
echo $file "UNKNOWN DICOM TYPE"
fi

fi
fi
fi
done
Subject Author Posted

Sieman's upgrade

Angela Ciccia January 08, 2003 11:06AM

Re: Sieman's [sic] upgrade

bob cox January 08, 2003 11:33AM

Re: Sieman's [sic] upgrade

angela January 08, 2003 12:54PM

Re: Sieman's [sic] upgrade

Angela Ciccia January 08, 2003 01:07PM

Re: Sieman's [sic] upgrade - call for Tom Ross

bob cox January 08, 2003 02:21PM

Re: Sieman's [sic] upgrade - call for Tom Ross

Tom Ross January 09, 2003 06:19PM

And another thing

Tom Ross January 09, 2003 06:22PM

Re: And another thing

bob cox January 10, 2003 12:47PM

Re: Sieman's [sic] upgrade

Tim Souza January 08, 2003 03:28PM