I would like to create a left and right hemisphere atlas and add 1000 to the Right hemisphere.
atlas_L.nii.gz is the left hemisphere image.
atlas.nii.gz the entire atlas.
I first tried:
3dcalc -a atlas_L.nii.gz -b atlas.nii.gz -expr "(b-a)+(step(b-a)*1000)" -prefix atlas_R.nii.gz
and it didn’t give me any logical result when:
3dcalc -a atlas_L.nii.gz -b atlas.nii.gz -expr "(b-a)+(step(b-a)*100)" -prefix atlas_R.nii.gz
did
I am not sure I understand what is going on =)
Have a good Weekend Y’all
The atlas is probably a ‘byte’ dataset going from 0-255. So adding 1000 would not make sense.
Use 3dinfo to check the datum, and add “-datum short” to 3dcalc to convert it.
One use here might be to use a full atlas on its own and add 1000 everywhere that the x coordinate is >0:
3dcalc -a atlas.nii.gz -expr "a+1000*a*ispositive(x)" -prefix atlas_adding_1000_to_half.nii.gz -datum short
… which could also be written:
3dcalc -a atlas.nii.gz -expr "a*(1+1000*ispositive(x))" -prefix atlas_adding_1000_to_half.nii.gz -datum short
If it is the negative coords that are on the right side of the brain (like in RAI-DICOM notation), then perhaps:
3dcalc -a atlas.nii.gz -expr "a*(1+1000*isnegative(x))" -prefix atlas_adding_1000_to_half.nii.gz -datum short
Deciding exactly where you want the boundary to be is an important consideration (everything >0, or everything >=0?) You can shift the boundary line algebraically, as needed:
3dcalc -a atlas.nii.gz -expr "a*(1+1000*isnegative(x-17))" -prefix atlas_adding_1000_to_half.nii.gz -datum short
–pt
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.