AVWsize, split and merge: ensuring proper file size!
The great catastrophe of running an analysis on the wrong data matrix – akin to trying to squeeze blood from a rock – can be avoided very simply: correct the size of your matrix so it is the correct number of volumes.
1. Know how many volumes you expect your preprocessed data to be. Then check. You can check by
a. In a unix terminal, in the folder in which the preprocessed data resides, type avwsize preproc1.feat/filtered_func_data
b. Loading the file into the FEAT GUI – it will automatically tell you how many volumes there are.
2. Is this the size you want? If so, bueno. But if it is too long you may have to trim it. For example, someone named Steve may have entered that you were going to acquire 130 volumes instead of 103 on the day of the scan, leaving you with over 25 extra volumes… in which case to avoid dampening your results with all that noise at the tail end you will need to remove it from the analysis.
a. Let’s say your file is named preproc1.feat, locate the r1 file on which it is based. It should be in the same folder.
b. Make a temporary folder in which to manipulate it – ‘mkdir r1temp’
c. Move it to that folder (after checking that the folder exists!) – ‘mv r1.* r1temp’. DONT COPY IT! Move it – so when you bring r1 back, it has a hole to fill.
d. Unzip it. command is: gunzip r1.* unzips it.
i. NOTE that you won’t see any evidence of the fact that unzipping has occurred – save that avwsplit (the next step) won’t work otherwise.
e. ‘avwsplit r1’ splits it. You will see a little ticker in the terminal window telling you as each volume is pared off the matrix. Now each volume is separate.
i. NOTE that the original r1 is kept, and the unziped volumes are copies. Remember this when you name the merged new result!
f. Remove the volumes you don’t want, eg ‘rm vol011?.*’
i. NOTE that you can also remove volumes at the front should you want to.
ii. Use the arrow keys to iteratively and quickly remove volumes. Note that ? is a placeholder and * is a wildcard to make this faster.
g. Merge what’s left. Type avwmerge [enter] for usage. But you will probably end up using this command:
avwmerge –t r1new vol0???.img
PLEASE NOTE: It will be a catastrophe if you type ‘vol0????.* instead of .img. Why? The * will concatenate the .hdr files in with the .img files – catastrophe.
PLEASE NOTE: you MUST call it r1new, not r1. You don’t want to obliterate the orignal r1.
h. Now copy these new r1s to the directory you removed them from: ‘cp r1new.* ../’
i. Then move up to this directory and copy these to r1s of the same name, ‘mv r1new.img.gz r1.img.gz’
j. VOILA! You have replaced your bad old r1 with a good new r1.