Hi Donna,
I tried your 2nd suggestion and it ALMOST worked:
for CONDITION in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii`
do
OUTFILE=RH_`basename $CONDITION .nii`.metric
CONDITION=`basename $CONDITION`[1]
ENTRIES=""
for METRIC in `ls
/mrt/Visac/group_metrics/Visac_fullGLM/deformed_RH_*Visac_beta.metric`
do
ENTRIES="$METRIC $CONDITION"
done
caret_command -metric-composite-identified-columns $OUTFILE $ENTRIES
done
The code is running through and is creating four metric files with correct
names. But the output metric files only contain the information of sub02.
So somehow the code seems to overwrite the information of sub01 and does
not combine the information of the two subjects:
Filename: RH_cCue_EndoLeft.metric (output file)
Number of Nodes: 73730
Number of Columns: 1
Column Minimum Maximum Mean Sample Dev %
Positive % Negative Column Name
1 -0.066 0.089 0.001 0.011
44.949 55.051 cCue_EndoLeft.nii[1]
Filename: deformed_RH_02Visac_beta.metric (input sub02)
Number of Nodes: 73730
Number of Columns: 4
Column Minimum Maximum Mean Sample Dev %
Positive % Negative Column Name
1 -0.066 0.089 0.001 0.011
44.949 55.051 cCue_EndoLeft.nii[1]
2 -0.039 0.102 0.005 0.011
60.243 39.757 cCue_EndoRight.nii[1]
3 -0.025 0.103 0.005 0.011
60.221 39.779 cCue_ExoLeft.nii[1]
4 -0.025 0.116 0.007 0.011
64.321 35.679 cCue_ExoRight.nii[1]
So somehow caret_command doesn't get the arguments the way it needs to.
I've tried to feed in the input files without the *for loop* but then the
2nd input file is taken as condition name. I wondered how the structure of
ENTRIES looks like: [METRIC_1 METRIC_2 CONDITION_1 CONDITION_2
CONDITION_3 CONDITION_4]? It seems like ENTRIES is the key here.
I couldn't figure out how to do your first approach (my computational
skills are very basic), but as far as I understand,the above problem would
occur as well so, right?
thanks a lot!
Julia
> Julia,
>
> The problem is a trailing bucket index '[1]' in the column name, e.g.:
>
> caret_command -metric-information /upload/deformed_RH_01Visac_beta.metric
>
> 1 -0.071 0.052 0.001 0.011
> 49.951 50.049 cCue_EndoLeft.nii[1]
> 2 -0.050 0.076 0.005 0.010
> 65.433 34.567 cCue_EndoRight.nii[1]
> 3 -0.044 0.060 0.005 0.009
> 70.949 29.051 cCue_ExoLeft.nii[1]
> 4 -0.078 0.072 0.001 0.011
> 52.947 47.053 cCue_ExoRight.nii[1]
>
> I haven't had a chance to figure out exactly how to get around this, but
> there are two approaches:
>
> * strip the '[1]' from the column-name -- probably using a combination
> of caret_command -metric-information (to get the current name), sed (to
> strip the trailing '[1]'), and caret_command -metric-set-column-name (to
> set the column-name to the stripped version).
>
> * massage CONDITION in the script to add the '[1]'; this is easy enough,
> but I think to make the shell happy, you'll need for the whole
> column-name to be in single quotes, which is a bit tricky to pull off.
> Getting those quotes to survive this part is the tricky bit:
>
> ENTRIES="$METRIC $CONDITION"
>
>
> Try your hand at one or both of these approaches. Let me know if you
> get stuck.
>
> Note: I'm taking tomorrow afternoon off.
>
> Donna
>
> On 04/01/2010 02:52 PM, Julia Bender wrote:
>> Donna,
>>
>> I've uploaded both deformed*.metric files, so you can have a look.
>> Thanks so much for your help.
>>
>> Julia
>>
>>
>>> Julia,
>>>
>>> Please upload deformed_RH_02Visac_beta.metric here:
>>>
>>> http://pulvinar.wustl.edu/cgi-bin/upload.cgi
>>>
>>> Also, where your script reads like so:
>>>
>>> OUTFILE=RH_$CONDITION.metric
>>> CONDITION=`basename $CONDITION`
>>>
>>> ... change it to read:
>>>
>>> CONDITION=`basename $CONDITION`
>>> OUTFILE=RH_"$CONDITION".metric
>>>
>>> I didn't realize the basename step should have preceded the OUTFILE
>>> definition until I had already hit send.
>>>
>>> The quotes around $CONDITION are needed due to the RH_ preceding the
>>> variable name.
>>>
>>> But that error suggests your actual column names do not match the
>>> volume
>>> names exactly. For example, might they be preceded by "AFM " or "MFM "
>>> or
>>> something like that? Looking at your actual metric file will help me
>>> pinpoint the problem.
>>>
>>> Donna
>>>
>>>
>>> On 04/01/2010 06:20 AM, Julia Bender wrote:
>>>
>>>> Hi Donna,
>>>>
>>>> yes, you're right, that's exactly what I want. Unfortunately the
>>>> script
>>>> you've sent me doesnt' go through and I don't know why. I did:
>>>>
>>>> for CONDITION in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii`
>>>> do
>>>> OUTFILE=RH_$CONDITION.metric
>>>> CONDITION=`basename $CONDITION`
>>>> ENTRIES=""
>>>> for METRIC in `ls
>>>> /mrt/Visac/group_metrics/Visac_fullGLM/deformed_RH_*Visac_beta.metric`
>>>> do
>>>> ENTRIES="$METRIC $CONDITION"
>>>> done
>>>>
>>>> caret_command -metric-composite-identified-columns $OUTFILE
>>>> $ENTRIES
>>>> done
>>>>
>>>> I get:
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_EndoLeft.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_EndoRight.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_ExoLeft.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_ExoRight.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_EndoLeft.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_EndoRight.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_ExoLeft.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column name/number
>>>> cCue_ExoRight.nii not found in file deformed_RH_02Visac_beta.metric
>>>>
>>>>
>>>> This is weird because both deformed_RH_01Visac* and
>>>> deformed_RH_02Visac*
>>>> are in the same folder, have the same permissions and the header info
>>>> is
>>>> the same (despite the sub# of course):
>>>> :
>>>> BeginHeader
>>>> Caret-Version 5.613
>>>> Date 2010-03-30T14:22:43
>>>> comment Deformed from: RH_02Visac_beta.metric Deformed with:
>>>> deformed_Human.02Visac.R.73730.deform_map
>>>> encoding BINARY
>>>> EndHeader
>>>> tag-version 2
>>>> tag-number-of-nodes 73730
>>>> tag-number-of-columns 4
>>>> tag-title
>>>> tag-column-name 0 cCue_EndoLeft.nii[1]
>>>> tag-column-name 1 cCue_EndoRight.nii[1]
>>>> tag-column-name 2 cCue_ExoLeft.nii[1]
>>>> tag-column-name 3 cCue_ExoRight.nii[1]
>>>> tag-column-comment 0 CARET v5.613 Mapped to surface:
>>>> Human.02Visac.R.Fiducial.65561.coord Mapped from volume:
>>>> cCue_EndoLeft.nii Subvolume: 0 Algorithm: Metric Enclosing
>>>> Voxel intent:
>>>> None intent_code: 0 intent_p1: 0.000 intent_p2: 0.000
>>>> intent_p3:
>>>> 0.000 Date Mapped: 30.03.10 14:22 Deformed with:
>>>> deformed_Human.02Visac.R.73730.deform_map
>>>> tag-column-comment 1 CARET v5.613 Mapped to surface:
>>>> Human.02Visac.R.Fiducial.65561.coord Mapped from volume:
>>>> cCue_EndoRight.nii Subvolume: 0 Algorithm: Metric Enclosing
>>>> Voxel intent:
>>>> None intent_code: 0 intent_p1: 0.000 intent_p2: 0.000
>>>> intent_p3:
>>>> 0.000 Date Mapped: 30.03.10 14:22 Deformed with:
>>>> deformed_Human.02Visac.R.73730.deform_map
>>>> tag-column-comment 2 CARET v5.613 Mapped to surface:
>>>> Human.02Visac.R.Fiducial.65561.coord Mapped from volume:
>>>> cCue_ExoLeft.nii Subvolume: 0 Algorithm: Metric Enclosing
>>>> Voxel intent:
>>>> None intent_code: 0 intent_p1: 0.000 intent_p2: 0.000
>>>> intent_p3:
>>>> 0.000 Date Mapped: 30.03.10 14:22 Deformed with:
>>>> deformed_Human.02Visac.R.73730.deform_map
>>>> tag-column-comment 3 CARET v5.613 Mapped to surface:
>>>> Human.02Visac.R.Fiducial.65561.coord Mapped from volume:
>>>> cCue_ExoRight.nii Subvolume: 0 Algorithm: Metric Enclosing
>>>> Voxel intent:
>>>> None intent_code: 0 intent_p1: 0.000 intent_p2: 0.000
>>>> intent_p3:
>>>> 0.000 Date Mapped: 30.03.10 14:22 Deformed with:
>>>> deformed_Human.02Visac.R.73730.deform_map
>>>> tag-column-study-meta-data 0
>>>> tag-column-study-meta-data 1
>>>> tag-column-study-meta-data 2
>>>> tag-column-study-meta-data 3
>>>> tag-column-color-mapping 0 -1.000000 1.000000
>>>> tag-column-color-mapping 1 -1.000000 1.000000
>>>> tag-column-color-mapping 2 -1.000000 1.000000
>>>> tag-column-color-mapping 3 -1.000000 1.000000
>>>> tag-column-threshold 0 0.000000 0.000000
>>>> tag-column-threshold 1 0.000000 0.000000
>>>> tag-column-threshold 2 0.000000 0.000000
>>>> tag-column-threshold 3 0.000000 0.000000
>>>> tag-column-average-threshold 0 0.000000 0.000000
>>>> tag-column-average-threshold 1 0.000000 0.000000
>>>> tag-column-average-threshold 2 0.000000 0.000000
>>>> tag-column-average-threshold 3 0.000000 0.000000
>>>> tag-BEGIN-DATA
>>>>
>>>> also I don't understand why I get the error message twice for every
>>>> condition. I'm sorry this is so persistent...
>>>>
>>>> Thanks a lot,
>>>>
>>>> Julia
>>>>
>>>>
>>>>> Julia,
>>>>>
>>>>> Okay, if I understand you correctly, deformed_RH_*.metric does NOT
>>>>>
>>>>>
>>>> contain a single column, but rather multiple columns for different
>>>> conditions for the same subject. Thus, you can't use this:
>>>>
>>>>
>>>>> COL_ENTRIES="$COL_ENTRIES `basename $EACHCOL` 1"
>>>>>
>>>>> ... because the " 1" means grab the first column. I suggested this,
>>>>>
>>>>>
>>>> thinking you had only a single column in your metric file, which
>>>> appears
>>>> to be not the case.
>>>>
>>>>
>>>>> So, you need to get the column name exactly right, and evidently you
>>>>>
>>>>>
>>>> haven't.
>>>>
>>>>
>>>>> Maybe instead you need:
>>>>>
>>>>> for CONDITION in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii`
>>>>> do
>>>>> OUTFILE=my.$CONDITION.metric
>>>>> CONDITION=`basename $CONDITION`
>>>>> ENTRIES=""
>>>>> for METRIC in `ls
>>>>> /mrt/Visac/group_metrics/Visac_fullGLM/deformed_RH_*Visac_beta.metric`
>>>>> do
>>>>> ENTRIES="$METRIC $CONDITION"
>>>>> done
>>>>> caret_command -metric-composite-identified-columns $OUTFILE
>>>>> $ENTRIES
>>>>> done
>>>>>
>>>>> Donna
>>>>>
>>>>> On 03/31/2010 09:57 AM, Julia Bender wrote:
>>>>>
>>>>>
>>>>>> Hi Donna,
>>>>>> thanks for your help. `ls
>>>>>>
>>>>>>
>>>> /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii`
>>>>
>>>>
>>>>>> only specifies the conds =column names. The stat-values are stored
>>>>>> in
>>>>>>
>>>>>>
>>>> $CURRDIR/deformed_RH_*.metric files, one for each subject. So my code
>>>> needs to take the names of the .nii files, find each of the so
>>>> specified
>>>>
>>>>
>>>>>> columns in each of the two deformed.metrics files, and combine them
>>>>>>
>>>>>>
>>>> into
>>>>
>>>>
>>>>>> one metric file. So I think what I need is 2 loops. I tried this:
>>>>>>
>>>>>>
>>>> OUTFILE=my_composite.metric
>>>>
>>>>
>>>>>> rm -rf $OUTFILE
>>>>>> COL_ENTRIES=""
>>>>>> MET_ENTRIES=""
>>>>>> for EACHCOL in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii` do
>>>>>> COL_ENTRIES="$COL_ENTRIES `basename $EACHCOL` 1"
>>>>>> done
>>>>>> for EACHMETRIC in `ls
>>>>>> /mrt/Visac/group_metrics/Visac_fullGLM/deformed_RH_*Visac_beta.metric`
>>>>>> do
>>>>>> MET_ENTRIES="$MET_ENTRIES $EACHMETRIC 1"
>>>>>> done
>>>>>> caret_command -metric-composite-identified-columns $OUTFILE
>>>>>> $EACHMETRIC
>>>>>>
>>>>>>
>>>> $COL_ENTRIES
>>>>
>>>>
>>>>>> I get: METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column
>>>>>> name/number
>>>>>> cCue_EndoLeft.nii not found in file deformed_RH_02Visac_beta.metric
>>>>>>
>>>>>>
>>>> deformed_RH_02Visac_beta.metric looks the same as the file for subj 01
>>>> and
>>>>
>>>>
>>>>>> is in the same folder. Any ideas what could be wrong?
>>>>>> Also, what is the "1" at the end of the line for?
>>>>>> Thanks a lot!!
>>>>>> Julia
>>>>>>
>>>>>>
>>>>>>> Julia,
>>>>>>> Here is the usage for this command:
>>>>>>> caret_command -metric-composite-identified-columns
>>>>>>> <output-metric-file-name>
>>>>>>> [input-metric-file-1 file-1-column]
>>>>>>> ...
>>>>>>> [input-metric-file-N file-2-column]
>>>>>>> Composite the selected columns from the input metric
>>>>>>> files and place them into the output metric file.
>>>>>>> "column" is either the number of the column, which
>>>>>>> starts at one, or the name of the column. If a
>>>>>>> a name contains spaces, it must be enclosed in double
>>>>>>> quotes.
>>>>>>>
>>>>>>>
>>>> Name has priority over number.
>>>>
>>>>
>>>>>>> I'm not 100% certain, but I think file-1-column refers to what the
>>>>>>>
>>>>>>>
>>>>>> column is named in the input file, rather than what you want it to
>>>>>> be
>>>>>>
>>>>>>
>>>> named in the output file. So if there is just a single column in
>>>> $EACHCOL, the simplest thing is to just specify 1 there, to indicate
>>>> the
>>>>
>>>>
>>>>>> first (and only) column.
>>>>>>
>>>>>>
>>>>>>> I think I would do this, instead of what you have:
>>>>>>> OUTFILE=my_composite.metric
>>>>>>> rm -rf $OUTFILE
>>>>>>> COL_ENTRIES=""
>>>>>>> for EACHCOL in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii`
>>>>>>> do
>>>>>>> COL_ENTRIES="$COL_ENTRIES $EACHCOL 1"
>>>>>>> done
>>>>>>> caret_command -metric-composite-identified-columns $OUTFILE
>>>>>>> $COL_ENTRIES
>>>>>>> Note that there should be only one caret_command, but it should
>>>>>>>
>>>>>>>
>>>> specify
>>>>
>>>>
>>>>>> all four cols. All you need the loop for is to generate this part
>>>>>> of
>>>>>>
>>>>>>
>>>> the command:
>>>>
>>>>
>>>>>>> [input-metric-file-1 file-1-column]
>>>>>>> ...
>>>>>>> [input-metric-file-N file-2-column]
>>>>>>> Donna
>>>>>>> On 03/30/2010 10:19 AM, Julia Bender wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> thanks for your help. I'm trying to composite four conds columns
>>>>>>>> from
>>>>>>>>
>>>>>>>>
>>>> two
>>>>
>>>>
>>>>>>>> subjects' deformed-metric-files into one combined metric file: for
>>>>>>>>
>>>>>>>>
>>>> EACHCOL in `ls /mrt/Visac/*Visac/stats/*Visac_fullGLM/c*.nii` (= my
>>>>
>>>>
>>>>>> four conds files)
>>>>>>
>>>>>>
>>>>>>>> do
>>>>>>>> caret_command -metric-composite-identified-columns
>>>>>>>>
>>>>>>>>
>>>>>> $CURRDIR/RH_`basename
>>>>>>
>>>>>>
>>>>>>>> $EACHCOL .nii`.metric $CURRDIR/deformed_RH_*.metric `basename
>>>>>>>>
>>>>>>>>
>>>> $EACHCOL
>>>>
>>>>
>>>>>> .nii`
>>>>>>
>>>>>>
>>>>>>>> done
>>>>>>>> I get: "METRIC COMPOSITE IDENTIFIED COLUMNS ERROR: ERROR column
>>>>>>>>
>>>>>>>>
>>>>>> name/number cCue_EndoLeft (=my first conds column) not found in file
>>>>>>
>>>>>>
>>>> deformed_RH_01Visac_beta.metric"
>>>>
>>>>
>>>>>>>> CURRDIR is the directory were the deformed-metric-files are. I
>>>>>>>> have
>>>>>>>>
>>>>>>>>
>>>>>> full
>>>>>>
>>>>>>
>>>>>>>> permission on all files. In the deformed-metric-files the columns
>>>>>>>> are
>>>>>>>>
>>>>>>>>
>>>>>> named like this: tag-column-name 0 cCue_EndoLeft.nii[1]
>>>>>>
>>>>>>
>>>>>>>> I understand that I need to specify either column name or number
>>>>>>>> so
>>>>>>>>
>>>>>>>>
>>>>>> that
>>>>>>
>>>>>>
>>>>>>>> columns are combined correctly. I tried to do that with `basename
>>>>>>>>
>>>>>>>>
>>>> $EACHCOL
>>>>
>>>>
>>>>>>>> .nii` , which obviously doesn't work. Do you know how I can assign
>>>>>>>>
>>>>>>>>
>>>>>> name/number in the loop?
>>>>>>
>>>>>>
>>>>>>>> Thanks a lot!
>>>>>>>> Julia
>>>>>>>> Dipl. Psych. Julia Bender
>>>>>>>> Humboldt Universität zu Berlin
>>>>>>>> Mathematisch - Naturwissenschaftliche Fakultät II
>>>>>>>> Institut für Psychologie, Abt. Klinische Psychologie
>>>>>>>> Unter den Linden 6
>>>>>>>> D-10099 Berlin
>>>>>>>> _______________________________________________
>>>>>>>> caret-users mailing list
>>>>>>>> [email protected]
>>>>>>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> caret-users mailing list
>>>>>>> [email protected]
>>>>>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>>>>>
>>>>>>>
>>>>>> Dipl. Psych. Julia Bender
>>>>>> Humboldt Universität zu Berlin
>>>>>> Mathematisch - Naturwissenschaftliche Fakultät II
>>>>>> Institut für Psychologie, Abt. Klinische Psychologie
>>>>>> Unter den Linden 6
>>>>>> D-10099 Berlin
>>>>>> _______________________________________________
>>>>>> caret-users mailing list
>>>>>> [email protected]
>>>>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> caret-users mailing list
>>>>> [email protected]
>>>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>>>
>>>>>
>>>>>
>>>> Dipl. Psych. Julia Bender
>>>> Humboldt Universität zu Berlin
>>>> Mathematisch - Naturwissenschaftliche Fakultät II
>>>> Institut für Psychologie, Abt. Klinische Psychologie
>>>> Unter den Linden 6
>>>> D-10099 Berlin
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> caret-users mailing list
>>>> [email protected]
>>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>>
>>>>
>>> _______________________________________________
>>> caret-users mailing list
>>> [email protected]
>>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>>
>>>
>>
>>
>> Dipl. Psych. Julia Bender
>> Humboldt Universität zu Berlin
>> Mathematisch - Naturwissenschaftliche Fakultät II
>> Institut für Psychologie, Abt. Klinische Psychologie
>> Unter den Linden 6
>> D-10099 Berlin
>>
>> _______________________________________________
>> caret-users mailing list
>> [email protected]
>> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>>
>
> _______________________________________________
> caret-users mailing list
> [email protected]
> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>
Dipl. Psych. Julia Bender
Humboldt Universität zu Berlin
Mathematisch - Naturwissenschaftliche Fakultät II
Institut für Psychologie, Abt. Klinische Psychologie
Unter den Linden 6
D-10099 Berlin
_______________________________________________
caret-users mailing list
[email protected]
http://brainvis.wustl.edu/mailman/listinfo/caret-users