I am trying to use 3dcalc to combine 2 masks. I want a resulting mask that will only include the voxels which are in both input masks. But I am getting a warning saying
“*+ WARNING: Template space of dataset strcon_thr25_3_AD_TD_4_3_tr+tlrc. does not match space of first dataset”
This was the command I used:
3dcalc -a mask_AD_TD_4_3_trend+tlrc. -b strcon_thr25_3_AD_TD_4_3_tr+tlrc. -expr ‘step(a)+2*step(b)’ -prefix strcon_thr25_3_mask_AD_TD_4_3_trend
I tried using 3dwarp to convert it but the result looked like it had many decimal values, whereas the input had just had 3 values (1,2,3)
3dWarp -mni2tta -prefix converted-striatcon-thr50-3sub-2mm+tlrc. striatum-con-label-thr50-3sub-2mm.nii.gz
I also tried using 3dresample
3dresample -master mask_AD_TD_4_3_trend+tlrc. -input striatum-con-label-thr25-3sub-2mm+tlrc. -prefix strcon_thr25_3_AD_TD_4_3_tr
but I still get that original warning when I do 3dcalc. Can anyone help me figure out what I am doing wrong? Maybe many things
Well, I’m not sure why the second dset doesn’t appear to exist-- I had just tried to copy+paste the names from your 3dcalc command above, but perhaps they aren’t in the same directory or something?
Mainly, could you run the following before each of the two input files used in your 3dcalc command, and then report the output? i.e.:
I am so sorry - I made a mistake last time I executed it - I guess I was sleepy Here is the correct output (I had changed the name of the 2nd mask to _resampled and forgot)
Thank you so much! I am sure your suggestion will fix the problem - I will try it right now. But I am curious to understand what I did wrong, if possible?
I think the source for the one of the files was MNI (it came from from FSL - https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Atlases/striatumconn)
The other one is derived from my AFNI group contrast (using clust_mask) so that is the one that is probably Talairach?
But I am confused that it is still showing like this because I tried to convert from MNI to Talairach before doing the 3dCalc using 3dresample (using the command -
3dresample -master mask_AD_TD_4_3_trend+tlrc. -input striatum-con-label-thr25-3sub-2mm+tlrc. -prefix strcon_thr25_3_AD_TD_4_3_tr) because I saw it suggested somewhere to try this. It would be great if you could give me any idea about this?
We can look at this more tomorrow, but it does not seem quite right.
3dresample can change the grid, but it does not transform between
spaces. There may be a 3dWarp command to do that. So running
3drefit might be masking a real problem, in that the volumes really
are in different spaces, and they are not ready to be combined.
Rick’s suggestion that 3dresample and 3drefit don’t actually change the space of a dataset except in the header is correct. A more complicated spatial transformation is needed - like alignment, application of an affine transformation or 12-piece transformation. See this previous post and the links there for more information.
thank you so much. I will go through these posts. I never realized there were variants of the spaces themselves! Since I got my mask from FSL probably I should be using one of the methods with MNI FSL transformation matrix you suggest here: https://afni.nimh.nih.gov/afni/community/board/read.php?1,70173,80922#msg-80922
But I also have one question - I was using the command 3dcalc and it was giving me a warning about space mismatch. After I did 3drefit this warning went away. Does this mean the space issue was correctly fixed by 3drefit?
3drefit is a program for changing header information. It is used when the header is incorrect, and needs to be adjusted. The space property is a designation that mainly affects properties of what can be associated with a dset (like an atlas). See more here: https://afni.nimh.nih.gov/AFNIAtlases
Note that 3drefit behaves veeery differently than 3dresample, which can also adjust header information (as part of its functionality), but in this case the info is assumed to be correct to start with, and so it changes the property both in the header and in the data itself. For example, if you need to adjust the orientation of a dset you would use 3drefit if the existing orientation were wrong, and 3dresample if it were correct.
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.